Microarray/Reporter.pm

filter: Statementstmt 89.6% 130 / 145 Branchbran 66.6% 40 / 60 Conditioncond 44.4% 28 / 63 MC/DCmcdc 4.0% 1 / 25 Subroutinesub 92.8% 26 / 28 Podpod n/a totaltotal 70.0% 225 / 321 CC 55 SCAR 28.3
CC
55
Cov
74%
do_spot_qc
44.6
new
26.5
genetic_data
6.0
CRAP 16.9
« Microarray/File/Data/BlueFuse.pm ↑ Summary Microarray/Image/QC_Plots.pm »
1 package Microarray::Reporter;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 our $VERSION = '1.5';
7  
8 # an array_reporter contains a number of spot objects
9 # the reporter objects are identified by a biologically relevant id
10 # the reporter summarises the averaged spot data
11 { package array_reporter;
12  
13 1 ▶ sub new {
Subroutine new: called CC=10 SCAR=32.8
14 1 my $class = shift;
15  
16 # require QC defaults
17 die "Microarray::Reporter ERROR: Quality control variables not set\n"
18 unless (
19 $ENV{ _LOW_SIGNAL_ } &&
20 $ENV{ _HIGH_SIGNAL_ } &&
21 $ENV{ _PERCEN_SAT_ } &&
22 $ENV{ _MIN_SNR_ } &&
23 $ENV{ _SIGNAL_QUALITY_ } &&
24 $ENV{ _MIN_DIAMETER_ } &&
25 $ENV{ _MAX_DIAMETER_ } &&
26 $ENV{ _TARGET_DIAMETER_ } &&
27 $ENV{ _MAX_DIAMETER_DEVIATION_ }
28 1 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
unless $ENV{"_LOW_SIGNAL_"} and $ENV{"_HIGH_SIGNAL_"} and $ENV{"_PERCEN_SAT_"} and $ENV{"_MIN_SNR_"} and $ENV{"_SIGNAL_QUALITY_"} and $ENV{"_MIN_DIAMETER_"} and $ENV{"_MAX_DIAMETER_"} and $ENV{"_TARGET_DIAMETER_"} and $ENV{"_MAX_DIAMETER_DEVIATION_"} 0 1 1
Condition33%8/24
$ENV{"_LOW_SIGNAL_"} and $ENV{"_HIGH_SIGNAL_"} and $ENV{"_PERCEN_SAT_"} and $ENV{"_MIN_SNR_"} and $ENV{"_SIGNAL_QUALITY_"} and $ENV{"_MIN_DIAMETER_"} and $ENV{"_MAX_DIAMETER_"} and $ENV{"_TARGET_DIAMETER_"} and $ENV{"_MAX_DIAMETER_DEVIATION_"}
!ll&&!rl&&r
001
$ENV{"_LOW_SIGNAL_"} and $ENV{"_HIGH_SIGNAL_"} and $ENV{"_PERCEN_SAT_"} and $ENV{"_MIN_SNR_"} and $ENV{"_SIGNAL_QUALITY_"} and $ENV{"_MIN_DIAMETER_"} and $ENV{"_MAX_DIAMETER_"} and $ENV{"_TARGET_DIAMETER_"}
!ll&&!rl&&r
001
$ENV{"_LOW_SIGNAL_"} and $ENV{"_HIGH_SIGNAL_"} and $ENV{"_PERCEN_SAT_"} and $ENV{"_MIN_SNR_"} and $ENV{"_SIGNAL_QUALITY_"} and $ENV{"_MIN_DIAMETER_"} and $ENV{"_MAX_DIAMETER_"}
!ll&&!rl&&r
001
$ENV{"_LOW_SIGNAL_"} and $ENV{"_HIGH_SIGNAL_"} and $ENV{"_PERCEN_SAT_"} and $ENV{"_MIN_SNR_"} and $ENV{"_SIGNAL_QUALITY_"} and $ENV{"_MIN_DIAMETER_"}
!ll&&!rl&&r
001
$ENV{"_LOW_SIGNAL_"} and $ENV{"_HIGH_SIGNAL_"} and $ENV{"_PERCEN_SAT_"} and $ENV{"_MIN_SNR_"} and $ENV{"_SIGNAL_QUALITY_"}
!ll&&!rl&&r
001
$ENV{"_LOW_SIGNAL_"} and $ENV{"_HIGH_SIGNAL_"} and $ENV{"_PERCEN_SAT_"} and $ENV{"_MIN_SNR_"}
!ll&&!rl&&r
001
$ENV{"_LOW_SIGNAL_"} and $ENV{"_HIGH_SIGNAL_"} and $ENV{"_PERCEN_SAT_"}
!ll&&!rl&&r
001
$ENV{"_LOW_SIGNAL_"} and $ENV{"_HIGH_SIGNAL_"}
!ll&&!rl&&r
001
MC/DC0%0/9
$ENV{"_LOW_SIGNAL_"} and $ENV{"_HIGH_SIGNAL_"} and $ENV{"_PERCEN_SAT_"} and $ENV{"_MIN_SNR_"} and $ENV{"_SIGNAL_QUALITY_"} and $ENV{"_MIN_DIAMETER_"} and $ENV{"_MAX_DIAMETER_"} and $ENV{"_TARGET_DIAMETER_"} and $ENV{"_MAX_DIAMETER_DEVIATION_"}
$ENV{"_LOW_SIGNAL_"} $ENV{"_HIGH_SIGNAL_"} $ENV{"_PERCEN_SAT_"} $ENV{"_MIN_SNR_"} $ENV{"_SIGNAL_QUALITY_"} $ENV{"_MIN_DIAMETER_"} $ENV{"_MAX_DIAMETER_"} $ENV{"_TARGET_DIAMETER_"} $ENV{"_MAX_DIAMETER_DEVIATION_"}
Truth table10%1/10
A and B and C and D and E and F and G and H and I
A= $ENV{"_LOW_SIGNAL_"}B= $ENV{"_HIGH_SIGNAL_"}C= $ENV{"_PERCEN_SAT_"}D= $ENV{"_MIN_SNR_"}E= $ENV{"_SIGNAL_QUALITY_"}F= $ENV{"_MIN_DIAMETER_"}G= $ENV{"_MAX_DIAMETER_"}H= $ENV{"_TARGET_DIAMETER_"}I= $ENV{"_MAX_DIAMETER_DEVIATION_"}
ABCDEFGHIresult
0XXXXXXXX0
10XXXXXXX0
110XXXXXX0
1110XXXXX0
11110XXXX0
111110XXX0
1111110XX0
11111110X0
1111111100
1111111111
29
30 1 my $self = { _id => shift, _spots => [] };
31 1 bless $self, $class;
32 1 return $self;
33 }
34 1 ▶ sub get_reporter_ratios {
Subroutine get_reporter_ratios: called CC=1 SCAR=0.0
35 1 my $self = shift;
36 1 my $hAnalysed_Data = { };
37 1 $hAnalysed_Data->{ M_mean_of_ratios } = $self->mean_log_ratios;
38 1 $hAnalysed_Data->{ M_ratio_of_means } = $self->log_ratio_means;
39 1 $hAnalysed_Data->{ ch1_mean } = $self->mean_ch1;
40 1 $hAnalysed_Data->{ ch2_mean } = $self->mean_ch2;
41 1 return $hAnalysed_Data;
42 }
43 # genetic_data() will set some relevant value(s)
44 # usually, a sub-class such as bac_reporter or gene_reporter
45 # will have its own methods for getting and setting the genetic data
46 0 ▶ sub genetic_data {
Subroutine genetic_data: not called CC=2 SCAR=17.9
47 0 my $self = shift;
48 @_ ? $self->{ _genetic_data } = shift
49 0 ▶ : $self->{ _genetic_data };
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
50 }
51 # reporter_id() will be an alias for the genetic reporter id
52 1 ▶ sub reporter_id {
Subroutine reporter_id: called CC=1 SCAR=0.0
53 1 my $self = shift;
54 1 $self->{ _id };
55 }
56 3 ▶ sub add_reporter_spot {
Subroutine add_reporter_spot: called CC=1 SCAR=0.0
57 3 my $self = shift;
58 3 my $aSpots = $self->get_reporter_spots;
59 3 push (@$aSpots, shift);
60 }
61 5 ▶ sub get_reporter_spots {
Subroutine get_reporter_spots: called CC=1 SCAR=0.0
62 5 my $self = shift;
63 5 $self->{ _spots };
64 }
65 1 ▶ sub get_reporter_replicates {
Subroutine get_reporter_replicates: called CC=2 SCAR=7.2
66 1 my $self = shift;
67 1 my $aSpots = $self->get_reporter_spots;
68 1 ▶ if (@$aSpots){
Branch: 1 branch
BranchTrueFalseTotal
if (@$aSpots) { } 1 0 1
69 1 my $replicates = @$aSpots;
70 1 return $replicates;
71 } else {
72 0 return;
73 }
74 }
75
76 #******************* SPOT QUALITY CONTROL VARIABLES *************************
77 # These are set as environment variables, not to individual feature objects
78 # Typically, these would be set within a Microarray object,
79 # (which defines defaults on initialisation) but could be set manually in a script
80 #****************************************************************************
81
82 1 ▶ sub do_spot_qc {
Subroutine do_spot_qc: called CC=22 SCAR=38.0
83 1 my $self = shift;
84 1 my $aSpots = $self->get_reporter_spots;
85
86 1 my $hBad_Flags = $ENV{ _BAD_FLAGS_ }; # from a Data File object
87
88 1 SPOT: for my $oSpot (@$aSpots) {
89 3 $oSpot->spot_status(0); # set spot to 'rejected' at start
90 3 ▶ next SPOT if (defined $hBad_Flags->{ $oSpot->flag_id });
Branch: 1 branch
BranchTrueFalseTotal
if defined $$hBad_Flags{$oSpot->flag_id} 0 3 3
91 3 ▶ unless ($ENV{ _ignore_signal_qa }){
Branch: 1 branch
BranchTrueFalseTotal
unless ($ENV{"_ignore_signal_qa"}) 3 0 3
92 ######## SIGNAL QUALITY ASSESSMENTS ########
93 3 ▶ if (($oSpot->channel1_signal < $ENV{ _LOW_SIGNAL_ }) ||
Branch: 1 branch
BranchTrueFalseTotal
if ($oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel1_sat and $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel1_snr < $ENV{"_MIN_SNR_"} or $oSpot->channel1_quality < $ENV{"_SIGNAL_QUALITY_"} or $oSpot->channel2_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel2_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel2_sat and $oSpot->channel2_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel2_snr < $ENV{"_MIN_SNR_"} or $oSpot->channel2_quality < $ENV{"_SIGNAL_QUALITY_"}) 1 2 3
Condition54%18/33
$oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel1_sat and $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel1_snr < $ENV{"_MIN_SNR_"} or $oSpot->channel1_quality < $ENV{"_SIGNAL_QUALITY_"} or $oSpot->channel2_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel2_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel2_sat and $oSpot->channel2_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel2_snr < $ENV{"_MIN_SNR_"} or $oSpot->channel2_quality < $ENV{"_SIGNAL_QUALITY_"}
l!l&&r!l&&!r
102
$oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel1_sat and $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel1_snr < $ENV{"_MIN_SNR_"} or $oSpot->channel1_quality < $ENV{"_SIGNAL_QUALITY_"} or $oSpot->channel2_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel2_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel2_sat and $oSpot->channel2_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel2_snr < $ENV{"_MIN_SNR_"}
l!l&&r!l&&!r
102
$oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel1_sat and $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel1_snr < $ENV{"_MIN_SNR_"} or $oSpot->channel1_quality < $ENV{"_SIGNAL_QUALITY_"} or $oSpot->channel2_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel2_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel2_sat and $oSpot->channel2_sat > $ENV{"_PERCEN_SAT_"}
l!l&&r!l&&!r
102
$oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel1_sat and $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel1_snr < $ENV{"_MIN_SNR_"} or $oSpot->channel1_quality < $ENV{"_SIGNAL_QUALITY_"} or $oSpot->channel2_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel2_signal > $ENV{"_HIGH_SIGNAL_"}
l!l&&r!l&&!r
102
$oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel1_sat and $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel1_snr < $ENV{"_MIN_SNR_"} or $oSpot->channel1_quality < $ENV{"_SIGNAL_QUALITY_"} or $oSpot->channel2_signal < $ENV{"_LOW_SIGNAL_"}
l!l&&r!l&&!r
102
$oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel1_sat and $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel1_snr < $ENV{"_MIN_SNR_"} or $oSpot->channel1_quality < $ENV{"_SIGNAL_QUALITY_"}
l!l&&r!l&&!r
102
$oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel1_sat and $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel1_snr < $ENV{"_MIN_SNR_"}
l!l&&r!l&&!r
012
$oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel1_sat and $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"}
l!l&&r!l&&!r
003
$oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"}
l!l&&r!l&&!r
003
$oSpot->channel1_sat and $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"}
!ll&&!rl&&r
300
$oSpot->channel2_sat and $oSpot->channel2_sat > $ENV{"_PERCEN_SAT_"}
!ll&&!rl&&r
200
MC/DC8%1/12
$oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel1_sat and $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel1_snr < $ENV{"_MIN_SNR_"} or $oSpot->channel1_quality < $ENV{"_SIGNAL_QUALITY_"} or $oSpot->channel2_signal < $ENV{"_LOW_SIGNAL_"} or $oSpot->channel2_signal > $ENV{"_HIGH_SIGNAL_"} or $oSpot->channel2_sat and $oSpot->channel2_sat > $ENV{"_PERCEN_SAT_"} or $oSpot->channel2_snr < $ENV{"_MIN_SNR_"} or $oSpot->channel2_quality < $ENV{"_SIGNAL_QUALITY_"}
$oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"} $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"} $oSpot->channel1_sat $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"} $oSpot->channel1_snr < $ENV{"_MIN_SNR_"} $oSpot->channel1_quality < $ENV{"_SIGNAL_QUALITY_"} $oSpot->channel2_signal < $ENV{"_LOW_SIGNAL_"} $oSpot->channel2_signal > $ENV{"_HIGH_SIGNAL_"} $oSpot->channel2_sat $oSpot->channel2_sat > $ENV{"_PERCEN_SAT_"} $oSpot->channel2_snr < $ENV{"_MIN_SNR_"} $oSpot->channel2_quality < $ENV{"_SIGNAL_QUALITY_"}
Truth table8%2/25
A or B or C and D or E or F or G or H or I and J or K or L
A= $oSpot->channel1_signal < $ENV{"_LOW_SIGNAL_"}B= $oSpot->channel1_signal > $ENV{"_HIGH_SIGNAL_"}C= $oSpot->channel1_satD= $oSpot->channel1_sat > $ENV{"_PERCEN_SAT_"}E= $oSpot->channel1_snr < $ENV{"_MIN_SNR_"}F= $oSpot->channel1_quality < $ENV{"_SIGNAL_QUALITY_"}G= $oSpot->channel2_signal < $ENV{"_LOW_SIGNAL_"}H= $oSpot->channel2_signal > $ENV{"_HIGH_SIGNAL_"}I= $oSpot->channel2_satJ= $oSpot->channel2_sat > $ENV{"_PERCEN_SAT_"}K= $oSpot->channel2_snr < $ENV{"_MIN_SNR_"}L= $oSpot->channel2_quality < $ENV{"_SIGNAL_QUALITY_"}
ABCDEFGHIJKLresult
1XXXXXXXXXXX1
01XXXXXXXXXX1
0011XXXXXXXX1
000X1XXXXXXX1
00101XXXXXXX1
000X01XXXXXX1
001001XXXXXX1
000X001XXXXX1
0010001XXXXX1
000X0001XXXX1
00100001XXXX1
000X000011XX1
0010000011XX1
000X00000X1X1
000X0000101X1
001000000X1X1
00100000101X1
000X00000X011
000X000010011
001000000X011
0010000010011
000X00000X000
000X000010000
001000000X000
0010000010000
94 ($oSpot->channel1_signal > $ENV{ _HIGH_SIGNAL_ }) ||
95 ($oSpot->channel1_sat && ($oSpot->channel1_sat > $ENV{ _PERCEN_SAT_ })) ||
96 ($oSpot->channel1_snr < $ENV{ _MIN_SNR_ }) ||
97 ($oSpot->channel1_quality < $ENV{ _SIGNAL_QUALITY_ }) ||
98 ($oSpot->channel2_signal < $ENV{ _LOW_SIGNAL_ }) ||
99 ($oSpot->channel2_signal > $ENV{ _HIGH_SIGNAL_ }) ||
100 ($oSpot->channel2_sat && ($oSpot->channel2_sat > $ENV{ _PERCEN_SAT_ })) ||
101 ($oSpot->channel2_snr < $ENV{ _MIN_SNR_ }) ||
102 ($oSpot->channel2_quality < $ENV{ _SIGNAL_QUALITY_ }) ){
103 1 next SPOT;
104 }
105 }
106 2 ▶ unless ($ENV{ _ignore_spot_qa }){
Branch: 1 branch
BranchTrueFalseTotal
unless ($ENV{"_ignore_spot_qa"}) 2 0 2
107 ######## SPOT QUALITY ASSESSMENTS ########
108 2 ▶ if (($oSpot->spot_diameter < $ENV{ _MIN_DIAMETER_ }) ||
Branch: 1 branch
BranchTrueFalseTotal
if ($oSpot->spot_diameter < $ENV{"_MIN_DIAMETER_"} or $oSpot->spot_diameter > $ENV{"_MAX_DIAMETER_"}) 0 2 2
Condition33%1/3
$oSpot->spot_diameter < $ENV{"_MIN_DIAMETER_"} or $oSpot->spot_diameter > $ENV{"_MAX_DIAMETER_"}
l!l&&r!l&&!r
002
MC/DC0%0/2
$oSpot->spot_diameter < $ENV{"_MIN_DIAMETER_"} or $oSpot->spot_diameter > $ENV{"_MAX_DIAMETER_"}
$oSpot->spot_diameter < $ENV{"_MIN_DIAMETER_"} $oSpot->spot_diameter > $ENV{"_MAX_DIAMETER_"}
Truth table33%1/3
A or B
A= $oSpot->spot_diameter < $ENV{"_MIN_DIAMETER_"}B= $oSpot->spot_diameter > $ENV{"_MAX_DIAMETER_"}
ABresult
1X1
011
000
109 ($oSpot->spot_diameter > $ENV{ _MAX_DIAMETER_ })){
110 0 next SPOT;
111 }
112 }
113 # spot passes quality assessment
114 2 $oSpot->spot_status(1);
115 2 $self->good_spot;
116 # for calculation of feature signal ratios
117 2 $self->all_ch1($oSpot->channel1_signal);
118 2 $self->all_ch2($oSpot->channel2_signal);
119 # for some plots
120 2 $self->x_pos($oSpot->x_pos);
121 2 $self->y_pos($oSpot->y_pos);
122 2 ▶ unless ($oSpot->channel2_signal == 0){
Branch: 1 branch
BranchTrueFalseTotal
unless ($oSpot->channel2_signal == 0) 2 0 2
123 2 $self->all_ratios(($oSpot->channel1_signal)/($oSpot->channel2_signal));
124 }
125 }
126 1 ▶ if ($ENV{ REJECT_UNIQUE } && ($self->spots_passed_qc < 2)){
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"REJECT_UNIQUE"} and $self->spots_passed_qc < 2) 0 1 1
Condition33%1/3
$ENV{"REJECT_UNIQUE"} and $self->spots_passed_qc < 2
!ll&&!rl&&r
100
MC/DC0%0/2
$ENV{"REJECT_UNIQUE"} and $self->spots_passed_qc < 2
$ENV{"REJECT_UNIQUE"} $self->spots_passed_qc < 2
Truth table33%1/3
A and B
A= $ENV{"REJECT_UNIQUE"}B= $self->spots_passed_qc < 2
ABresult
0X0
100
111
127 0 $self->reset_data;
128 }
129 }
130 2 ▶ sub good_spot {
Subroutine good_spot: called CC=1 SCAR=0.0
131 2 my $self = shift;
132 2 $self->{ _spots_passed_qc }++;
133 }
134 1 ▶ sub spots_passed_qc {
Subroutine spots_passed_qc: called CC=1 SCAR=0.0
135 1 my $self = shift;
136 1 $self->{ _spots_passed_qc };
137 }
138 0 ▶ sub reset_data {
Subroutine reset_data: not called CC=1 SCAR=6.9
139 0 my $self = shift;
140 0 $self->{ _all_ch1 } = [];
141 0 $self->{ _all_ch2 } = [];
142 0 $self->{ _all_ratios } = [];
143 }
144 # for the following methods, shifting a single value
145 # unlike similar methods in Microarray, which shift these array refs
146 8 ▶ sub all_ch1 {
Subroutine all_ch1: called CC=3 SCAR=11.0
147 8 my $self = shift;
148 8 ▶ unless (defined $self->{ _all_ch1 }){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_all_ch1"}) 1 7 8
149 1 $self->{ _all_ch1 } = [];
150 }
151 8 ▶ if (@_){
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2 6 8
152 2 my $aCh1_Signals = $self->{ _all_ch1 };
153 2 push (@$aCh1_Signals, shift);
154 } else {
155 6 $self->{ _all_ch1 };
156 }
157 }
158 11 ▶ sub all_ch2 {
Subroutine all_ch2: called CC=3 SCAR=11.0
159 11 my $self = shift;
160 11 ▶ unless (defined $self->{ _all_ch2 }){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_all_ch2"}) 1 10 11
161 1 $self->{ _all_ch2 } = [];
162 }
163 11 ▶ if (@_){
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2 9 11
164 2 my $aCh2_Signals = $self->{ _all_ch2 };
165 2 push (@$aCh2_Signals, shift);
166 } else {
167 9 $self->{ _all_ch2 };
168 }
169 }
170 6 ▶ sub all_ratios {
Subroutine all_ratios: called CC=3 SCAR=11.0
171 6 my $self = shift;
172 6 ▶ unless (defined $self->{ _all_ratios }){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_all_ratios"}) 1 5 6
173 1 $self->{ _all_ratios } = [];
174 }
175 6 ▶ if (@_){
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2 4 6
176 2 my $aRatios = $self->{ _all_ratios };
177 2 push (@$aRatios, shift);
178 } else {
179 4 $self->{ _all_ratios };
180 }
181 }
182 3 ▶ sub x_pos {
Subroutine x_pos: called CC=3 SCAR=11.0
183 3 my $self = shift;
184 3 ▶ unless (defined $self->{ _x_pos }){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_x_pos"}) 1 2 3
185 1 $self->{ _x_pos } = [];
186 }
187 3 ▶ if (@_){
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2 1 3
188 2 my $aX_Pos = $self->{ _x_pos };
189 2 push (@$aX_Pos, shift);
190 } else {
191 1 $self->{ _x_pos };
192 }
193 }
194 3 ▶ sub y_pos {
Subroutine y_pos: called CC=3 SCAR=11.0
195 3 my $self = shift;
196 3 ▶ unless (defined $self->{ _y_pos }){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"_y_pos"}) 1 2 3
197 1 $self->{ _y_pos } = [];
198 }
199 3 ▶ if (@_){
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2 1 3
200 2 my $aY_Pos = $self->{ _y_pos };
201 2 push (@$aY_Pos, shift);
202 } else {
203 1 $self->{ _y_pos };
204 }
205 }
206 ##########
207
208 5 ▶ sub mean_ch1 {
Subroutine mean_ch1: called CC=2 SCAR=7.6
209 5 my $self = shift;
210 5 ▶ if (my $sig = stats_or_return($self->all_ch1)){
Branch: 1 branch
BranchTrueFalseTotal
if (my $sig = stats_or_return($self->all_ch1)) { } 5 0 5
211 5 return $sig;
212 } else {
213 0 return 0;
214 }
215 }
216 8 ▶ sub mean_ch2 {
Subroutine mean_ch2: called CC=2 SCAR=7.6
217 8 my $self = shift;
218 8 ▶ if (my $sig = stats_or_return($self->all_ch2)){
Branch: 1 branch
BranchTrueFalseTotal
if (my $sig = stats_or_return($self->all_ch2)) { } 8 0 8
219 8 return $sig;
220 } else {
221 0 return 0;
222 }
223 }
224 1 ▶ sub mean_ratios {
Subroutine mean_ratios: called CC=1 SCAR=0.0
225 1 my $self = shift;
226 1 stats_or_return($self->all_ratios);
227 }
228 14 ▶ sub stats_or_return {
Subroutine stats_or_return: called CC=3 SCAR=15.1
229 14 my $aValues = shift;
230 14 ▶ if (@$aValues > 1){
Branch: 2 branches
BranchTrueFalseTotal
if (@$aValues > 1) { } 14 0 14
elsif (@$aValues == 1) { } 0 0 0
231 14 return mean_values($aValues);
232 } elsif (@$aValues == 1){
233 0 return $$aValues[0];
234 } else {
235 0 return;
236 }
237 }
238 3 ▶ sub ratio_means {
Subroutine ratio_means: called CC=2 SCAR=7.6
239 3 my $self = shift;
240 3 ▶ if ($self->mean_ch2 > 0){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->mean_ch2 > 0) { } 3 0 3
241 3 return ($self->mean_ch1) / ($self->mean_ch2);
242 } else {
243 0 return;
244 }
245 }
246 2 ▶ sub log_ratio_means {
Subroutine log_ratio_means: called CC=1 SCAR=0.0
247 2 my $self = shift;
248 2 return calculate_log2($self->ratio_means);
249 }
250 2 ▶ sub mean_log_ratios {
Subroutine mean_log_ratios: called CC=1 SCAR=0.0
251 2 my $self = shift;
252 2 my $aLog_Ratios = calculate_log2($self->all_ratios);
253 2 return mean_values($aLog_Ratios);
254 }
255 16 ▶ sub mean_values {
Subroutine mean_values: called CC=4 SCAR=14.5
256 16 my $aValues = shift;
257 16 my $sum;
258 16 for my $value (@$aValues){
259 32 ▶ next unless $value;
Branch: 1 branch
BranchTrueFalseTotal
unless $value 0 32 32
260 32 $sum += $value;
261 }
262 16 ▶ if ($sum){
Branch: 1 branch
BranchTrueFalseTotal
if ($sum) { } 16 0 16
263 16 return $sum/scalar(@$aValues);
264 } else {
265 0 return 0;
266 }
267 }
268 4 ▶ sub calculate_log2 {
Subroutine calculate_log2: called CC=5 SCAR=16.2
269 4 my $value = shift;
270 4 ▶ if (ref $value){
Branch: 1 branch
BranchTrueFalseTotal
if (ref $value) { } 2 2 4
271 2 my @aLog_Value = ();
272 2 for my $val (@$value){
273 4 ▶ next if ($val<=0);
Branch: 1 branch
BranchTrueFalseTotal
if $val <= 0 0 4 4
274 4 my $log_val = log ($val) / log(2);
275 4 push(@aLog_Value,$log_val);
276 }
277 2 return \@aLog_Value;
278 } else {
279 2 ▶ return if ($value<=0);
Branch: 1 branch
BranchTrueFalseTotal
if $value <= 0 0 2 2
280 2 return log ($value) / log(2);
281 }
282 }
283 }
284  
285 1 1;
286  
287  
288 __END__
« Microarray/File/Data/BlueFuse.pm ↑ Summary Microarray/Image/QC_Plots.pm »