annotate galaxy-tools/tools/rdock/bin/sdreport @ 0:4eb3f9cb2a51 draft

Uploaded
author dzesikah
date Fri, 26 Aug 2016 09:53:37 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
1 #!/usr/bin/perl
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
2 # Produces text summaries of SD records *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
3 # *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
4 # Usage: sdreport [-l] [-t] [-s<DataField>] [sdFiles] *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
5 # *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
6 # -l output data fields for each record as processed *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
7 # -t tabulate Rbt.Score.* fields for each record as processed *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
8 # -s summarise data fields for all records *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
9 # -s<DataField> summarise data fields for each unique value *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
10 # of <DataField> *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
11 # *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
12 # Note: If -l or -t are combined with -s, the listing/table is output *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
13 # within each ligand summary *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
14 # If sdFiles not given, reads from standard input *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
15 # Output is to standard output *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
16 # Default is equivalent to sdfilter -l *
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
17 #*******************************************************************************
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
18 use lib "$ENV{'RBT_ROOT'}/lib";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
19
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
20 use SDRecord;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
21
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
22 # Default field names and headings for rDock v4.00 scores
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
23 my @defaultFields = ('SCORE','SCORE.INTER','SCORE.INTRA','SCORE.RESTR','SCORE.INTER.VDW');
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
24 my @defaultHeadings = ('TOTAL','INTER','INTRA','RESTR','VDW');
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
25
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
26 # Default field names and headings for normalised scores (score / #ligand heavy atoms)
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
27 my @defaultNormFields = ('SCORE.norm','SCORE.INTER.norm','SCORE.INTRA.norm','SCORE.RESTR.norm','SCORE.heavy');
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
28 my @defaultNormHeadings = ('TOTALn','INTERn','INTRAn','RESTRn','#heavy');
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
29
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
30 # Default field names and headings for rDock v3.00 scores
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
31 my @defaultOldFields = ('Rbt.Score.Corrected','Rbt.Score.Inter','Rbt.Score.Intra','Rbt.Score.IntraMin','Rbt.Score.Restraint');
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
32 my @defaultOldHeadings = ('TOTAL','INTER','INTRA','INTRAMIN','RESTR');
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
33
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
34 my $listFormat = 0;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
35 my $summaryFormat = 0;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
36 my $tableFormat = 0;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
37 my $supplierFormat = 0;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
38 my $csvFormat = 0;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
39 my $summaryKey = "_TITLE1";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
40 my $oldFields = 0;#If true, use old default field names for component scores
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
41 my $headings = 1;#DM 21 Nov 2000, If false, don't output headings
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
42 my @outputFields;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
43 my @outputHeadings;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
44
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
45 #Print help if no command line arguments
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
46 printHelpAndExit() if (scalar(@ARGV) == 0);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
47
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
48 #Parse command line arguments
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
49 my $nArgs = scalar(@ARGV);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
50
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
51 while (scalar(@ARGV)) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
52 my $arg = shift @ARGV;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
53 printHelpAndExit() if ($arg eq '-h');
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
54 if (index($arg,'-l')==0) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
55 $listFormat = 1;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
56 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
57 elsif (index($arg,'-o')==0) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
58 $oldFields = 1;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
59 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
60 # 7 Feb 2005 (DM) Option to report normalised aggregate scores
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
61 elsif (index($arg,'-norm')==0) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
62 $oldFields = 2;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
63 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
64 elsif (index($arg,'-sup')==0) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
65 $supplierFormat = 1;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
66 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
67 elsif (index($arg,'-s')==0) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
68 $summaryFormat = 1;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
69 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
70 elsif (index($arg,'-id')==0) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
71 $summaryKey = substr($arg,3);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
72 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
73 elsif (index($arg,'-nh')==0) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
74 $headings = 0;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
75 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
76 elsif (index($arg,'-t')==0) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
77 $tableFormat = 1;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
78 push @outputFields, split(',',substr($arg,2));
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
79 push @outputHeadings, @outputFields;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
80 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
81 elsif (index($arg,'-c')==0) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
82 $csvFormat = 1;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
83 push @outputFields, split(',',substr($arg,2));
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
84 push @outputHeadings, @outputFields;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
85 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
86 else {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
87 push @files,$arg;#must be a filename
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
88 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
89 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
90 push @ARGV,@files;#put the filenames back in the arg list
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
91
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
92 #use -l if neither table format is specified
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
93 $listFormat = (!$tableFormat && !$csvFormat && !$supplierFormat);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
94
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
95 #If no output fields defined for -t or -c use the defaults (old or new)
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
96 if (scalar(@outputFields)==0) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
97 if ($oldFields == 1) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
98 @outputFields = @defaultOldFields;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
99 @outputHeadings = @defaultOldHeadings;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
100 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
101 elsif ($oldFields == 2) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
102 @outputFields = @defaultNormFields;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
103 @outputHeadings = @defaultNormHeadings;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
104 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
105 else {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
106 @outputFields = @defaultFields;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
107 @outputHeadings = @defaultHeadings;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
108 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
109 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
110
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
111 my $sdRec = new SDRecord;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
112 my %summary;#hash of SDRecord lists, indexed by user-defined summary key
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
113 my %indexByName;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
114 my %indexByNum;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
115 my $idx = 0;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
116 my $nRec = 0;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
117
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
118 #Column headings for tab and csv format
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
119 #DM 21 Nov 2000 - if $headings is false, then don't output the column headings
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
120 if ($tableFormat && !$summaryFormat && $headings) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
121 tabHeadings($summaryKey,@outputHeadings);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
122 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
123 if ($csvFormat && !$summaryFormat && $headings) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
124 csvHeadings($summaryKey,@outputHeadings);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
125 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
126
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
127 #read records
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
128 while ($sdRec->readRec('LINES'=>1,'DATA'=>1)) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
129 $sdRec->addData('_REC' => ++$nRec);#add record# as temp data field
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
130 if ($listFormat && !$summaryFormat) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
131 print "\n\nRECORD #$nRec\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
132 $sdRec->writeData();
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
133 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
134 if ($tableFormat && !$summaryFormat) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
135 @recList = ($sdRec);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
136 tabScores(\@recList,$summaryKey,@outputFields);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
137 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
138 elsif ($csvFormat && !$summaryFormat) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
139 @recList = ($sdRec);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
140 csvScores(\@recList,$summaryKey,@outputFields);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
141 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
142 elsif ($supplierFormat && !$summaryFormat) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
143 @recList = ($sdRec);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
144 tabulateSuppliers(\@recList,$summaryKey);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
145 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
146 #add record to summary, indexed by user field value
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
147 #keep a separate index of unique values of user field values,
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
148 #indexed by number in the order the values first appear
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
149 #In this way we can maintain the sorted order of ligands
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
150 #when we come to print out the summary
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
151 if ($summaryFormat) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
152 my $summaryValue = $sdRec->{'DATA'}->{$summaryKey};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
153 #New data field value encountered
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
154 if (!defined $indexByName{$summaryValue}) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
155 $idx++;#incr the number of unique values
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
156 #keep cross-referenced indexes (field value <-> number)
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
157 $indexByName{$summaryValue} = $idx;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
158 $indexByNum{$idx} = $summaryValue;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
159 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
160 push @{$summary{$summaryValue}},$sdRec->copy('DATA'=>1);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
161 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
162 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
163
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
164 #Print summary if required
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
165 if ($summaryFormat) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
166 print "\n===============================================================\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
167 print "SUMMARY BY $summaryKey\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
168 foreach $idx (sort {$a<=>$b} keys %indexByNum) {#numberic sort of index numbers
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
169 my $key = $indexByNum{$idx};#look up corresponding data field value
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
170 print "\n===============================================================\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
171 print "$summaryKey = $key (#$idx)\n\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
172 writeSummary($summary{$key});
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
173 if ($listFormat) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
174 print "\nIndividual records:\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
175 foreach $rec (@{$summary{$key}}) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
176 print "\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
177 $rec->writeData();
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
178 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
179 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
180 if ($tableFormat) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
181 print "\nScores:\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
182 tabHeadings($summaryKey,@outputHeadings);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
183 tabScores($summary{$key},$summaryKey,@outputFields);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
184 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
185 if ($csvFormat) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
186 print "\nScores:\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
187 csvHeadings($summaryKey,@outputHeadings);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
188 csvScores($summary{$key},$summaryKey,@outputFields);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
189 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
190 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
191 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
192
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
193 ##############################################################
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
194 # writes a summary to STDOUT for a list of SDRecords
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
195 # Input is a reference to an array of SDRecords
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
196 sub writeSummary {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
197 my $recListRef = shift;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
198
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
199 #Extract the list of data values for each fieldname into a hash array
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
200 #(key=fieldname, value=array ref)
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
201 my %fields;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
202 foreach $rec (@{$recListRef}) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
203 my ($key,$value);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
204 while ( ($key,$value) = each %{$rec->{'DATA'}}) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
205 push @{$fields{$key}},$value;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
206 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
207 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
208
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
209 #Look for constant fields and store separately
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
210 my %constFields;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
211 foreach $key (keys %fields) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
212 my @values = sort @{$fields{$key}};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
213 my $nVal = scalar(@values);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
214 if ($values[0] eq $values[$nVal -1]) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
215 $constFields{$key} = $values[0];#store the field name and the constant value
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
216 delete $fields{$key};#remove from (non-const) array
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
217 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
218 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
219
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
220 #Print constant fields
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
221 print "\nConstant fields:\n\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
222 foreach $key (sort keys %constFields) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
223 printf "%-40s%s\n",$key,$constFields{$key};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
224 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
225 #Print min and max value for non-const fields
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
226 print "\nVariable fields:\n\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
227 foreach $key (sort keys %fields) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
228 my @values = @{$fields{$key}};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
229 #Look at first value to decide whether to do text or numeric sort
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
230 if (isNaN($values[0])) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
231 @values = sort @values;#text sort
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
232 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
233 else {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
234 @values = sort {$a <=> $b} @values;#numeric sort
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
235 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
236 my $nVal = scalar(@values);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
237 printf "%-40s",$key;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
238 print "Min = $values[0]\tMax = $values[$nVal-1]\t(N = $nVal)\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
239 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
240 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
241
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
242 ##############################################################
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
243 # function isNaN equivalent to the C++, java, javascript isNaN
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
244 # From P Vaglio, ~intranet/lib/rbt_func.pl
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
245 sub isNaN {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
246 local($_) = @_;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
247 s/\s+//g; # strip white space
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
248 # match +or- beginning of line 0 or 1 time
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
249 # then any numeric 0 or more
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
250 # then a decimal point
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
251 # then any numeric 0 or more after decimal point
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
252 # then possibly an e or E then + or - then any numreci at least once
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
253 if (/^([+-]?)(\d*)(\.(\d*))?([Ee]([+-]?\d+))?$/ && (defined $2 || defined $4)) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
254 return 0;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
255 } else {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
256 return 1;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
257 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
258 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
259
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
260 ##############################################################
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
261 # output corresponding headings for use with tabScores
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
262 sub tabHeadings {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
263 my $summaryKey = shift;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
264 my @fieldNames = @_;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
265 printf("%-10s%-30s","REC",$summaryKey);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
266 foreach $field (@fieldNames) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
267 printf("%10s",$field);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
268 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
269 print "\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
270 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
271
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
272 ##############################################################
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
273 # tab-delimited output of named data field values
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
274 sub tabScores {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
275 my $recListRef = shift;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
276 my $summaryKey = shift;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
277 my @fieldNames = @_;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
278 foreach $rec (@{$recListRef}) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
279 printf("%03d\t%-30.30s",$rec->{'DATA'}->{'_REC'},$rec->{'DATA'}->{$summaryKey});
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
280 foreach $field (@fieldNames) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
281 my $val = $rec->{'DATA'}->{$field};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
282 if (isNaN($val)) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
283 printf("%-10.12s",$val);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
284 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
285 else {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
286 printf("%10.3f",$val);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
287 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
288 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
289 print "\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
290 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
291 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
292
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
293 ##############################################################
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
294 # output corresponding headings for use with csvScores
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
295 sub csvHeadings {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
296 my $summaryKey = shift;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
297 my @fieldNames = @_;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
298 printf("%s,%s","REC",$summaryKey);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
299 foreach $field (@fieldNames) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
300 printf(",%s",$field);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
301 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
302 print "\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
303 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
304
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
305 ##############################################################
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
306 # comma-delimited output of named data field values
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
307 sub csvScores {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
308 my $recListRef = shift;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
309 my $summaryKey = shift;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
310 my @fieldNames = @_;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
311 foreach $rec (@{$recListRef}) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
312 printf("%d,%s",$rec->{'DATA'}->{'_REC'},$rec->{'DATA'}->{$summaryKey});
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
313 foreach $field (@fieldNames) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
314 my $val = $rec->{'DATA'}->{$field};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
315 if (isNaN($val)) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
316 printf(",%s",$val);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
317 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
318 else {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
319 printf(",%.3f",$val);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
320 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
321 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
322 print "\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
323 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
324 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
325
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
326
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
327 ##############################################################
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
328 # standardised output of Catalyst supplier field
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
329 # Input is a reference to an array of SDRecords
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
330 # and a ligand identifier field to output in column 1 (def=Name)
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
331 sub tabulateSuppliers {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
332 my $recListRef = shift;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
333 my $summaryKey = shift || 'Name';
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
334 foreach $rec (@{$recListRef}) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
335 my $suppBase = $rec->{'DATAREF'}->{'Supplier'}+1;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
336 my $linesRef = $rec->{'LINES'};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
337 my $name = $rec->{'DATA'}->{$summaryKey};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
338
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
339 #Output some useful compound info
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
340 my $name = $rec->{'DATA'}->{$summaryKey};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
341 my $molFormula = $rec->{'DATA'}->{'MolFormula'};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
342 my $molWt = $rec->{'DATA'}->{'MolWt'};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
343 my $casNum = $rec->{'DATA'}->{'CAS_num'};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
344 my $mdlNum = $rec->{'DATA'}->{'MDLNUMBER'};
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
345 print "\n\n====================================================================================================\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
346 printf("%-10.10s%s\n","Name:",$name);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
347 printf("%-10.10s%s\n","Formula:",$molFormula);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
348 printf("%-10.10s%s\n","Mol.wt:",$molWt);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
349 printf("%-10.10s%s\n","CAS #:",$casNum);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
350 printf("%-10.10s%s\n","MDL #:",$mdlNum);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
351
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
352 #Get all the supplier record lines into a list
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
353 #Record is terminated by blank line
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
354 my @lines;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
355 my $nLines = 0;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
356 for (; $$linesRef[$suppBase+$nLines] ne ""; $nLines++) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
357 push @lines,$$linesRef[$suppBase+$nLines];
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
358 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
359
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
360 #Column headings
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
361 printf("\n%-20.20s%-40.40s%-40.40s\n",
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
362 "Supplier",
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
363 "Comment",
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
364 "Price"
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
365 );
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
366 print "----------------------------------------------------------------------------------------------------\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
367
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
368 #Loop over each supplier
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
369 my $iLine = 0;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
370 for (; $iLine < $nLines; $iLine++) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
371 #collect supplier info lines
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
372 my @supplierInfo = ();
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
373 for (; $lines[$iLine] ne "." && $iLine < $nLines; $iLine++) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
374 push @supplierInfo,$lines[$iLine];
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
375 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
376 #Check for incomplete record
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
377 if ($iLine == $nLines) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
378 print "** INCOMPLETE RECORD **\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
379 last;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
380 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
381 my $nSupplierInfo = scalar(@supplierInfo);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
382 my $supplier = $supplierInfo[0];
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
383 #loop over each grade
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
384 for ($iLine++; ($lines[$iLine] ne "........................") && ($iLine < $nLines); $iLine++) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
385 #collect grade info lines
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
386 my @gradeInfo = ();
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
387 for (; index($lines[$iLine],"_") ne 0 && $iLine < $nLines; $iLine++) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
388 push @gradeInfo,$lines[$iLine];
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
389 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
390 #Check for incomplete record
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
391 if ($iLine == $nLines) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
392 print "** INCOMPLETE RECORD **\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
393 last;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
394 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
395 my $grade = $gradeInfo[0];
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
396 #loop over each price info line
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
397 for (; index($lines[$iLine],".") ne 0 && $iLine < $nLines; $iLine++) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
398 my @priceInfo = split(" ",$lines[$iLine]);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
399 my $price = join(" ",@priceInfo);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
400 printf("%-20.20s%-40.39s%-40.40s\n",
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
401 $supplier,
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
402 $grade,
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
403 $price);
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
404 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
405 #Check for incomplete record
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
406 if ($iLine == $nLines) {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
407 print "** INCOMPLETE RECORD **\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
408 last;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
409 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
410 last if $lines[$iLine] eq "........................";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
411 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
412 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
413 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
414 }
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
415
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
416
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
417 #######################################################################
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
418 sub printHelpAndExit {
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
419 print "\nProduces text summaries of SD records\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
420 print "\nUsage:\tsdreport [-l] [-t[<FieldName,FieldName...>]] [-c<FieldName,FieldName...>] [-id<IDField>] [-nh] [-o] [-s] [-sup] [sdFiles]\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
421 print "\n\t-l (list format) output all data fields for each record as processed\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
422 print "\t-t (tab format) tabulate selected fields for each record as processed\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
423 print "\t-c (csv format) comma delimited output of selected fields for each record as processed\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
424 print "\t-s (summary format) output summary statistics for each unique value of ligand ID\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
425 print "\t-sup (supplier format) tabulate supplier details (from Catalyst)\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
426 print "\t-id<IDField> data field to use as ligand ID\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
427 print "\t-nh don't output column headings in -t and -c formats\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
428 print "\t-o use old (v3.00) score field names as default columns in -t and -c formats, else use v4.00 field names\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
429 print "\t-norm use normalised score field names as default columns in -t and -c formats (normalised = score / #ligand heavy atoms)\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
430 print "\nNote:\tIf -l, -t or -c are combined with -s, the listing/table is output within each ligand summary\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
431 print "\t-sup should not be combined with other options\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
432 print "\tDefault field names for -t and -c are rDock score field names\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
433 print "\tDefault ID field name is Name\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
434 print "\n\tIf sdFiles not given, reads from standard input\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
435 print "\tOutput is to standard output\n\n";
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
436 exit;
4eb3f9cb2a51 Uploaded
dzesikah
parents:
diff changeset
437 }