blib/lib/Bio/sdrs.pl untested

filter: Statementstmt 0.0% 0 / 80 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 10 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 111 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!perl -w
2  
3 use strict;
4 use lib "lib";
5 use Getopt::Long;
6 use Bio::SDRS;
7  
8 my $multiple = 1.18;
9 my $ldose = 0.17;
10 my $hdose = 30000;
11 my $step = 60;
12 my $maxproc = 20;
13 my $trim = 0.0;
14 my $outdir = ".";
15 my $debug = 0;
16 my $significance = 0.05;
17 &GetOptions("multiple=f" => \$multiple,
18 "ldose=f" => \$ldose,
19 "hdose=f" => \$hdose,
20 "step=f" => \$step,
21 "maxproc=i" => \$maxproc,
22 "trim=f" => \$trim,
23 "significance=f" => \$significance,
24 "outdir=s" => \$outdir,
25 "debug!" => \$debug);
26  
27 my $usage = <<EOF;
28 sdrs.pl [-[no]debug ] input-file
29 [-multiple=<float> ] Default: $multiple
30 [-ldose=<float> ] Default: $ldose
31 [-hdose=<float> ] Default: $hdose
32 [-step=<float> ] Default: $step
33 [-maxproc=<integer> ] Default: $maxproc
34 [-trim=<float> ] Default: $trim
35 [-significance=<float> ] Default: $significance
36 [-outdir=<directory> ] Default: $outdir
37 EOF
38  
39 if (scalar(@ARGV) != 1) {
40 print STDERR $usage;
41 exit(1);
42 }
43  
44 my $sdrs = Bio::SDRS->new();
45 $sdrs->multiple($multiple);
46 $sdrs->ldose($ldose);
47 $sdrs->hdose($hdose);
48 $sdrs->step($step);
49 $sdrs->maxproc($maxproc);
50 $sdrs->trim($trim);
51 $sdrs->significance($significance);
52 $sdrs->debug($debug);
53  
54 my $infile = $ARGV[0];
55  
56 open (IN, $infile) || die "can not open infile $infile: $!\n";
57 my $doses = <IN>;
58 if (not defined $doses) {
59 die "$infile is empty.\n";
60 }
61 chomp($doses);
62 $doses =~ s/\s*$//;
63 my @doses = split (/\t/, $doses);
64 shift @doses;
65 if (scalar(@doses) == 0) {
66 die "No doses specified.\n";
67 }
68  
69 $sdrs->doses(@doses);
70 my $count = 0;
71 while (<IN>) {
72 chomp;
73 $count++;
74 my ($assay, @data) = split (/\t/, $_);
75 $sdrs->set_assay($assay, @data);
76 }
77 close IN;
78 $sdrs->calculate;
79 if (not -d $outdir) {
80 my $status = system("mkdir -p $outdir");
81 if ($status != 0) {
82 die "Unable to create $outdir. Status = $status\n";
83 }
84 }
85 my $file = "$outdir/sdrs.$multiple.$step.out";
86 open (OUT, ">$file") ||
87 die "Unable to open $file: $!\n";
88 print OUT $sdrs->scandata;
89 close OUT;
90 open (OUT, ">$outdir/sdrs.$multiple.$step.EC50.out") ||
91 die "can not open EC50 output file: $!\n";
92 foreach my $assay ($sdrs->assays) {
93 print OUT "$assay";
94 foreach my $prop (('MAX', 'MIN', 'LOW', 'HIGH', 'EC50',
95 'PVALUE', 'EC50RANGE', 'PEAK', 'A', 'B',
96 'D', 'FOLD')) {
97 my $ec50data = $sdrs->ec50data($assay, $prop);
98 if (not defined $ec50data) {
99 print OUT "\tNo EC50 data";
100 }
101 else {
102 print OUT "\t", $ec50data;
103 }
104 }
105 print OUT "\n";
106 }
107 close OUT;
108  
109 open (SORT, ">$outdir/sdrs.sorted_probes.out") ||
110 die "can not open sorted probeset output file: $!\n";
111 open (PVAL, ">$outdir/sdrs.pval_FDR.out") ||
112 die "can not open p value output file: $!\n";
113  
114 foreach my $dose ($sdrs->score_doses) {
115 print SORT "$dose\t", join("\t", $sdrs->sorted_assays_by_dose($dose)), "\n";
116 print PVAL "$dose\t", join("\t", $sdrs->pvalues_by_dose($dose)), "\n";
117 }
118  
119 close SORT;
120 close PVAL;
121  
122 =head1 NAME
123  
124 sdrs.pl - Command line script to use Bio::SDRS to run a Signmoidal Dose Response Search.
125  
126 =head1 SYNOPSIS
127  
128 sdrs.pl -multiple=1.05 \
129 -step=20 \
130 -ldose=0.4 \
131 -hdose=25000 \
132 -trim=0 \
133 -significance=0.05 \
134 -outdir=results \
135 data/OVCAR4_HCS_avg.txt
136  
137 =head1 OPTIONS
138  
139 =over
140
141 =item -multiple=<float>
142  
143 Specifies the multiplicity factor for increasing the dose during the
144 search. It must be greater than one.
145  
146 =item -ldose=<float>
147  
148 Specifies the minimum dose for the search. Must be greater than zero.
149  
150 =item -hdose=<float>
151  
152 Specifies the maximum dose for the search. Must be greater than the C<ldose> above.
153  
154 =item -step=<float>
155  
156 This value specifies the maximum change in doses in the
157 search. In the search process, this module starts at the ldose
158 value. It tries multiplying the current dose by the C<multiple> value,
159 but it will only increase the dose by no more than the C<step> value
160 specified here. It must be positive.
161  
162 =item -maxproc=<integer>
163  
164 Specifies the maximum number of processes to be used in the search.
165  
166 =item -trim=<float>
167  
168 This value specifies the proportion of assays to be omitted in the analysis.
169  
170 First, the maximal response across the doses is calculated for every
171 assay. Then, assays with lower response will be removed from the
172 analysis by this factor. Must be a real number between zero and one,
173 where a value of zero (default) means all assays will be analyzed, and
174 one means none.
175  
176 This factor is useful when the SDRS result will be fed into a multiple
177 test correction procedure such as a false discovery rate (FDR)
178 algorithm. For example, for genome-scale transcriptional dose response
179 data, a non-zero value is suggested to remove non-expressed
180 transcripts, which not only speeds up the process, but also improves
181 the FDR output.
182  
183 =item -significance=<float>
184  
185 This value specifies the minimum permitted
186 significance value for the F score cutoff. It must be between zero and
187 1.
188  
189 =item -outdir=<directory>
190  
191 Specifies the directory where the results are written. If this
192 directory does not exist, it is created.
193  
194 =item -[no]debug
195  
196 Controls display of debugging information. Normally should be left off.
197  
198 =back
199  
200 =head1 DESCRIPTION
201  
202 This program provides a simple command line interface to the C<Bio::SDRS> Perl module.
203  
204 =head1 INPUT FILE
205  
206 There is only one input file to this script which is meant to provide
207 the data for a number of assays. The file provides the doses of compound
208 used in the experiment, and it provides the measurements for each dose
209 for every assay. The file uses Tab Separated Value (TSV) format,
210 with each value separated from each other using the Tab character
211 (ASCII code 9).
212  
213 The first line of the input file must contain the doses as floating
214 point numbers, with a comment word as the first word. For example, the
215 following line would describe a eight dose experiment.
216  
217 Dose 0.42 1.27 3.81 11.43 34.29 102.88 308.64 925.92
218  
219 The succeeding lines of the input file are the measured responses for
220 each assay, with no limit to the number of assays. The
221 first word in each line is the assay name, and the remaining
222 lines are the responses for each dose as specified in the dose line at
223 the top of the file, and in the same order. Here is an example
224 response line consistent with the dose example above:
225  
226 Caspase3 2.1 1.695 1.675 1.735 1.56 1.77 2.34 2.595
227  
228 =head1 OUTPUT FILES
229  
230 The output files are written to the directory specified by the C<outdir> option above. The names are composed in part from the options:
231  
232 =head2 sdrs.C<multiple>.C<step>.out
233  
234 This file contains the best (local) fitting model at every search dose
235 for every assay. Each line is a tab separated value containing the
236 assay name, search dose, F-score for the best fit at the dose and
237 corresponding A, B, and D values.
238  
239 =head2 sdrs.C<multiple>.C<step>.EC50.out
240  
241 This file contains the estimated EC50 data for each assay in the input file as a
242 tab separated record. The columns are as follows:
243  
244 1 assay name
245 2 MAX Maximum F score
246 3 MIN Minimum F score
247 4 LOW Lower bound of 95% confidence interval for the estimated EC50.
248 5 HIGH Upper bound of 95% confidence interval for the estimated EC50.
249 6 EC50 estimated EC50.
250 7 PVALUE P value of the best fitting model
251 8 EC50RANGE range of 95% confidence interval for the estimated EC50.
252 9 PEAK Number of peaks in the F scores at search doses across experimental dose range.
253 10 A estimated value for A in the best model.
254 11 B estimated value for B in the best model.
255 12 D estimated value for D in the best model.
256 13 FOLD Ratio of B/A or 99999.0 if a == 0. Positive if D < 0, negative otherwise.
257  
258 =head2 sdrs.sorted_probes.out
259  
260 For every calculated dose in the search, list the assays in order
261 of F score. Each line in this file is a TSV record where the first
262 field is the calculated dose, and the remaining fields are the
263 assay names.
264  
265 =head2 sdrs.pval_FDR.out
266  
267 For every calculated dose in the search, list the P Values for fit for
268 the assays in order of F score exactly in the same order as the
269 sdrs.sorted_probes.out file. Each line in this file is a TSV record
270 where the first field is the calculated dose, and the remaining fields
271 are the assay names. This file is meant to be used in conjunction
272 with the sdrs.sorted_probes.out file.
273  
274 =head1 SEE ALSO
275  
276 Bio::SDRS.
277  
278 =head1 AUTHORS
279  
280 Ruiru Ji <ruiruji@gmail.com>
281 Nathan O. Siemers <nathan.siemers@bms.com>
282 Lei Ming <lei.ming@bms.com>
283 Liang Schweizer <liang.schweizer@bms.com>
284 Robert Bruccoleri <bruc@acm.org>
285  
286 =cut
287