-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPGX.pm
executable file
·105 lines (80 loc) · 2.31 KB
/
PGX.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package PGX;
use File::Basename;
use YAML::XS qw(LoadFile DumpFile);
use Data::Dumper;
use lib::CGItools;
use lib::CytobandReader;
use lib::GenomeIntervals;
use lib::GenomeIntervalStatistics;
use lib::PlotPrepareData;
use lib::PlotMakeParameters;
use lib::PlotHistoplots;
use lib::PlotArrays;
use lib::PlotErrorSVG;
use lib::PlotStripplots;
use lib::PlotCytobands;
use lib::Helpers;
use lib::ReadFiles;
use lib::WriteFiles;
use lib::AggregateData;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(
new
read_plot_defaults
);
######## #### #### #### #### #### #### #### #### ####
sub new {
my $class = shift;
my $args = shift;
my $debug_mode = shift || 0;
$args = args_modify_plot_parameters(read_plot_defaults(), $args);
my $self = {
parameters => $args,
debug_mode => $debug_mode,
config => read_config(),
cytobands => read_cytobands($args->{genome}),
datasetid => q{},
plotid => $args->{plotid},
svg => q{},
Y => 0,
errors => [],
};
bless $self, $class;
$self->{genomeintervals} = make_genome_intervals(
$self->{cytobands},
$self->{parameters}->{binning},
);
my $rbl = get_reference_base_limits($self->{cytobands});
$self->{referencebounds} = _remap_referencebounds($rbl);
$self->{genomesize} = get_genome_basecount(
$self->{cytobands},
$self->{parameters}->{chr2plot},
);
$self->{matrixindex} = [ 0..$#{ $self->{genomeintervals} } ];
$self = pgx_get_genome_regions($self);
return $self;
}
################################################################################
sub _remap_referencebounds {
my $refLims = shift;
my $rb = {};
for my $rn (keys %$refLims) {
$rb->{$rn} = $refLims->{$rn}->{"chro"};
}
return $rb;
}
################################################################################
sub read_config {
my $path_of_this_module = File::Basename::dirname( eval { ( caller() )[1] } );
my $config = LoadFile($path_of_this_module.'/config/config.yaml');
return $config;
}
################################################################################
sub read_plot_defaults {
my $path_of_this_module = File::Basename::dirname( eval { ( caller() )[1] } );
my $plotPars = LoadFile($path_of_this_module.'/config/plotdefaults.yaml');
return $plotPars;
}
################################################################################
1;