script/sdrs.pl untested

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