Gentoo Archives: gentoo-commits

From: Martin Mokrejs <mmokrejs@×××××××××××××××.cz>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-biology/est2uni/files/, sci-biology/est2uni/
Date: Thu, 24 Feb 2011 13:42:50
Message-Id: 7f799f63edfc0dcebd06005b4e086ad467f619d2.mmokrejs@gentoo
1 commit: 7f799f63edfc0dcebd06005b4e086ad467f619d2
2 Author: Martin Mokrejs <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
3 AuthorDate: Thu Feb 24 13:42:21 2011 +0000
4 Commit: Martin Mokrejs <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz>
5 CommitDate: Thu Feb 24 13:42:21 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=7f799f63
7
8 sci-biology/est2uni: working EST annotation package
9
10 ---
11 sci-biology/est2uni/est2uni-0.27.ebuild | 35 +-
12 sci-biology/est2uni/files/est_annot.pm.patch | 456 +++++++++
13 sci-biology/est2uni/files/est_annot_go.pm.patch | 136 +++
14 sci-biology/est2uni/files/est_annot_psnp.pm.patch | 11 +
15 .../files/est_annot_reciprocal_blast.pm.patch | 14 +
16 sci-biology/est2uni/files/est_clustering.pm.patch | 383 ++++++++
17 sci-biology/est2uni/files/est_prepro.pm.patch | 85 ++
18 .../files/installation_est2uni_perl.txt.patch | 85 ++
19 sci-biology/est2uni/files/mysql_fixes.sql | 3 +
20 sci-biology/est2uni/files/pipe_db.pm.patch | 972 ++++++++++++++++++++
21 sci-biology/est2uni/files/tables.sql.patch | 23 +
22 11 files changed, 2194 insertions(+), 9 deletions(-)
23
24 diff --git a/sci-biology/est2uni/est2uni-0.27.ebuild b/sci-biology/est2uni/est2uni-0.27.ebuild
25 index 2e62216..45eaf42 100644
26 --- a/sci-biology/est2uni/est2uni-0.27.ebuild
27 +++ b/sci-biology/est2uni/est2uni-0.27.ebuild
28 @@ -8,7 +8,11 @@ inherit webapp eutils perl-module
29
30 DESCRIPTION="EST assembly+annotation: a perl-based analysis pipeline including php-based web interface"
31 HOMEPAGE="http://cichlid.umd.edu/est2uni/download.php"
32 -SRC_URI="http://cichlid.umd.edu/est2uni/est2uni_0.27.tar.gz"
33 +SRC_URI="http://cichlid.umd.edu/est2uni/est2uni_0.27.tar.gz
34 + ftp://ftp.ncbi.nih.gov/pub/UniVec/UniVec
35 + ftp://ftp.ncbi.nih.gov/pub/UniVec/UniVec_Core
36 + http://www.geneontology.org/ontology/gene_ontology.obo
37 + http://www.geneontology.org/doc/GO.terms_and_ids"
38
39 LICENSE="GPL-3"
40 KEYWORDS="~amd64 ~x86"
41 @@ -19,7 +23,7 @@ RDEPEND="${DEPEND}
42 sci-biology/lucy
43 sci-biology/cap3-bin
44 sci-biology/estscan
45 - sci-biology/hmmer
46 + <sci-biology/hmmer-3
47 sci-biology/phred
48 sci-biology/seqclean
49 sci-biology/repeatmasker
50 @@ -29,32 +33,45 @@ RDEPEND="${DEPEND}
51 sci-biology/exonerate
52 perl-gcpan/go-perl
53 www-servers/apache
54 - dev-db/mysql
55 + >=dev-db/mysql-4.1
56 <dev-lang/php-5.3"
57
58 S="${WORKDIR}"/est2uni
59
60 +src_prepare(){
61 + for f in "${FILESDIR}"/*.pm.patch "${FILESDIR}"/tgicl_files.patch; do
62 + cd perl; epatch $f || die "Failed to patch $f"
63 + done
64 +}
65 +
66 src_compile(){
67 "$(tc-getCC)" external_software/sputnik/sputnik.c -o external_software/sputnik/sputnik
68 }
69
70 src_install(){
71 - dobin external_software/sputnik/sputnik || die
72 - mkdir -p "${D}"/opt/est2uni || die
73 - mv perl "${D}"/opt/est2uni || die
74 - doenvd "${FILESDIR}"/est2uni || die
75 + mkdir -p "${D}"/opt/est2uni
76 + mv external_software/sputnik/sputnik "${D}"/opt/est2uni || die
77 +
78 + chmod a+rx perl/*.pl perl/*.pm || die
79 + mv perl/* "${D}"/opt/est2uni || die
80 +
81 + doenvd "${FILESDIR}"/99est2uni || die
82
83 mkdir -p "${D}"/usr/share/webapps/"${PN}"/"${PV}"/htdocs
84 cp -r php/* "${D}"/usr/share/webapps/"${PN}"/"${PV}"/htdocs || die
85
86 - mkdir -p "${D}"/usr/share/"${PN}" || die
87 - mv test_data "${D}"/usr/share/"${PN}" || die
88 + mkdir -p "${D}"/opt/est2uni/test_data || die
89 + mv test_data/* "${D}"/opt/est2uni/test_data || die
90 + # mkdir -p "${D}"/usr/share/"${PN}" || die
91 + # mv test_data "${D}"/usr/share/"${PN}" || die
92 perl-module_src_install || die
93
94 webapp_src_preinst
95 webapp_postinst_txt en "${S}"/README
96 webapp_src_install
97
98 + # cp "${DISTDIR}"/UniVec_Core "${DISTDIR}"/UniVec "${D}"/usr/share/ncbi/data/ || die
99 +
100 einfo "Please follow the pipeline installation and web configuration docs at"
101 einfo "http://cichlid.umd.edu/est2uni/install.php"
102 einfo "BEWARE the software is not maintained anymore by upstream but I do not"
103
104 diff --git a/sci-biology/est2uni/files/est_annot.pm.patch b/sci-biology/est2uni/files/est_annot.pm.patch
105 new file mode 100644
106 index 0000000..3a5b804
107 --- /dev/null
108 +++ b/sci-biology/est2uni/files/est_annot.pm.patch
109 @@ -0,0 +1,456 @@
110 +--- est_annot.pm.ori 2011-02-21 17:19:51.000000000 +0100
111 ++++ est_annot.pm 2011-02-23 00:06:03.000000000 +0100
112 +@@ -37,7 +37,7 @@
113 + sub store_blast_report($$$); #stores a blast report into the mysql database
114 + sub annotate_unigenes_from_db($); #adds to the unigenes table the best hits from the blast reports
115 + sub do_blast_annotation (\@$); #annotates a unigene acording to the blast results obtained for a single database
116 +-sub hit_is_not_annoymous ($$); #checks if a hit has one of the annonymous tags
117 ++sub hit_is_not_anonymous ($$); #checks if a hit has one of the annonymous tags
118 + sub store_estscan_orfs($); #Stores the ESTScan results
119 + sub run_hmmer_for_unigenes ($); #runs hmmer for all the unigenes
120 + sub parse_and_store_hmmer($); #parses the hmmer result and stores it in the mysql database
121 +@@ -208,10 +208,10 @@
122 +
123 + my $dbh=open_db($db) or return 0;
124 + my $st="INSERT INTO $table VALUES (?,?,?,?,?,?);";
125 +- my $sth=$dbh->prepare($st);
126 ++ my $sth=$dbh->prepare($st) or die localtime().": Error preparing INSERT INTO $table VALUES (?,?,?,?,?,?): $DBI::errstr\n";
127 +
128 + my $num_micros=0;
129 +- open IN, "<$in_file";
130 ++ open IN, "<$in_file" or die ocaltime().": Error opening input file $in_file: $!\n";
131 + my $seq_name;
132 + my $num_micros_seq=0;
133 + while (my $line=<IN>){
134 +@@ -279,7 +279,7 @@
135 + my $cmd="$bin -u $max_unit_length -v $min_unit_length -L $min_length_of_ssr $in_file > $out_file";
136 + not (system ($cmd)) or (
137 + print localtime().": Something went wrong running Sputnik to find microsatellites\n" and
138 +- print localtime().": Command was: $cmd\n" and
139 ++ print localtime().": Command was: $cmd: $!\n" and
140 + return 0
141 + );
142 + return 1;
143 +@@ -322,7 +322,7 @@
144 + my $sth=prepare_st($dbh,$st) or return 0;
145 + execute_st($sth) or return 0;
146 + open OUT,">$outf" or (
147 +- print localtime().": There was a problem opening the file $outf as output\n" and
148 ++ print localtime().": There was a problem opening the file $outf as output: $!\n" and
149 + return 0
150 + );
151 + while (my @field = $sth->fetchrow_array){
152 +@@ -371,8 +371,9 @@
153 + }
154 + my $table=read_config($config,'hmmer_table','');
155 + my $dbh=open_db($db) or return 0;
156 +- my $st="INSERT INTO $table VALUES ('',?,?,?,?,?,?,?,'');";
157 +- my $sth=$dbh->prepare($st);
158 ++ my $st="INSERT INTO $table VALUES (NULL,?,?,?,?,?,?,?,NULL);";
159 ++ print localtime().": Trying to prepare \"$st\" for db=$db and table=$table\n";
160 ++ my $sth=$dbh->prepare($st) or print localtime().": Error preparing $st statement: $DBI::errstr\n";
161 +
162 +
163 + my $ok=1;
164 +@@ -427,7 +428,7 @@
165 + my $out=read_config($config,'hmmer_res','');
166 + my $micros=read_config($config,'micros','');
167 + unless ($bin and $db and $out and $micros){
168 +- print localtime().": Some of the parameters needed by HMMER are missing\n";
169 ++ print localtime().": Some of the parameters needed by HMMER are missing: $bin, $db, $out, $micros\n";
170 + return 0;
171 + }
172 +
173 +@@ -439,7 +440,7 @@
174 + $cmd="$pvmd_bin $host_file &";
175 + print localtime().": Launching pvm: $cmd\n";
176 + not (system($cmd)) or (
177 +- print localtime().": There was a problem launching the pvm environment\n" and
178 ++ print localtime().": There was a problem launching the pvm environment: $!\n" and
179 + return 0
180 + );
181 + $cmd="$bin --cpu $micros --pvm $db $in > $out";
182 +@@ -452,7 +453,7 @@
183 + stop_pvm($config);
184 + }
185 + if ($not_ok){
186 +- print localtime().": There was a problem running HMMER\n";
187 ++ print localtime().": There was a problem running HMMER: $!\n";
188 + return 0;
189 + }
190 +
191 +@@ -510,8 +511,8 @@
192 + #begin_orf mediumint unsigned not null,
193 + #end_orf mediumint unsigned not null,
194 + #reverse tinyint(1) not null
195 +- my $st="INSERT INTO $table VALUES ('',?,?,?,?,?,?);";
196 +- my $sth=$dbh->prepare($st);
197 ++ my $st="INSERT INTO $table VALUES (NULL,?,?,?,?,?,?);";
198 ++ my $sth=$dbh->prepare($st) or die localtime().": Error preparing $st statement: $DBI::errstr\n";
199 +
200 + my $no_exit=1;
201 + my $ok=1;
202 +@@ -544,7 +545,7 @@
203 + }
204 + $sth->execute() or $ok=0;
205 + unless ($ok){
206 +- print localtime().": There was a problem executing the statement $st\n";
207 ++ print localtime().": There was a problem executing the statement: $st: $DBI::errstr\n";
208 + return 0;
209 + }
210 + }else{
211 +@@ -583,7 +584,7 @@
212 + my $cmd="$bin $seq_file -M $matrix -t $out_pep -o $out_dna\n";
213 + not(system($cmd)) or (
214 + print localtime().": There has been a problem running ESTScan.\n" and
215 +- print localtime().": Command was:\n$cmd\n" and
216 ++ print localtime().": Command was:\n$cmd: $!\n" and
217 + return 0
218 + );
219 +
220 +@@ -698,7 +699,7 @@
221 + if (not ($putative_e_value) or ($e_value < $putative_e_value)){
222 + #we evaluate if this is a good hit
223 + #is greater than the $inf_limit
224 +- if (($e_value<$inf_limit) and hit_is_not_annoymous($hit,$config)){
225 ++ if (($e_value<$inf_limit) and hit_is_not_anonymous($hit,$config)){
226 + #this is a good hit, we should annotate the unigene
227 + $putative_e_value=$e_value;
228 + #we remove the first word and the trailing information of the hit
229 +@@ -718,7 +719,7 @@
230 + return $putative_annot;
231 + }
232 +
233 +-sub hit_is_not_annoymous ($$){
234 ++sub hit_is_not_anonymous ($$){
235 + my $hit=shift;
236 + my $config=shift;
237 + my $ok=1;
238 +@@ -730,7 +731,7 @@
239 + if ($hit =~ /$tag/i) {return 0}
240 + }
241 +
242 +- # hit is also annonymous if it has no description
243 ++ # hit is also anonymous if it has no description
244 + # JF, 2007-01-10
245 + if ($hit =~ /^\t$/) {return 0}
246 +
247 +@@ -747,7 +748,7 @@
248 + my $table=read_config($config,'unigenes_table2','') or return 0;
249 + my $st="UPDATE $table SET annotation=NULL;";
250 + my $dbh=open_db($db) or (
251 +- print localtime().": Unable to open database $db\n" and
252 ++ print localtime().": Unable to open database $db: $DBI::errstr\n" and
253 + return 0
254 + );
255 + my $sth=prepare_st($dbh,$st) or return 0;
256 +@@ -776,7 +777,7 @@
257 + my $cmd="cp $seq_file $blast_dir".$db_name;
258 + my $fail=system($cmd);
259 + if ($fail){
260 +- print localtime().": There was a problem with the command: $cmd\n";
261 ++ print localtime().": There was a problem with the command: $cmd: $!\n";
262 + return 0;
263 + }
264 + #format the database
265 +@@ -792,7 +793,7 @@
266 + }
267 + $fail=system($cmd); #now the database is formatted
268 + if ($fail){
269 +- print localtime().": There was a problem with the command: $cmd\n";
270 ++ print localtime().": There was a problem with the command: $cmd: $!\n";
271 + print localtime().": Logfile is $log\n";
272 + return 0;
273 + }
274 +@@ -986,7 +987,7 @@
275 + my $in = new Bio::SearchIO(-format => 'blast',-file => $in_file);
276 + open OUT,">$out_file" or $ok=0;
277 + unless ($ok) {
278 +- print localtime().": The out file: $out_file could not be opened.\n";
279 ++ print localtime().": The out file: $out_file could not be opened: $!\n";
280 + return 0;
281 + }
282 +
283 +@@ -1092,7 +1093,7 @@
284 +
285 + #prints a wellcome message
286 + sub wellcome_annot () {
287 +- print localtime().": Wellcome to the EST annotation pipe, have a pleasant jouney.\n\n";
288 ++ print localtime().": Welcome to the EST annotation pipe, have a pleasant journey.\n\n";
289 + }
290 +
291 +
292 +@@ -1112,6 +1113,7 @@
293 + my $dbh=open_db($db) or return 0;
294 + #if the database is superunigenes previous blast superunigenes should be removed
295 + if ($blast_db =~ /superunigenes$/){
296 ++ print localtime().": Deleting previous BLAST results: DELETE FROM blast_result WHERE db='superunigenes'\n";
297 + my $st="DELETE FROM blast_result WHERE db='superunigenes'";
298 + my $sth=$dbh->prepare($st) or return 0;
299 + execute_st($sth) or return 0;
300 +@@ -1129,18 +1131,19 @@
301 + if ($ext){$temp_in.=$separator.$ext}
302 +
303 + #we create a new in file with the sequences that still has no blast stored in the database
304 +- #if the blast is alredy done, there is no need to repeat it
305 ++ #if the blast is already done, there is no need to repeat it
306 + my $st;
307 + if (read_config($config,'mysql_compress','')){
308 + $st="SELECT UNCOMPRESS(blast_result) FROM blast_result WHERE query_seq=? AND db='$blast_db'";
309 + }else{
310 + $st="SELECT blast_result FROM blast_result WHERE query_seq=? AND db='$blast_db'";
311 + }
312 ++ print localtime().": Extracting from $in_file those FASTA entries which have no rows matching in blast_result.query_seq using Bio::SeqIO into $temp_in\n";
313 + my $sth=$dbh->prepare($st) or return 0;
314 + my $num_blast_todo=0;
315 + my $in_seq = Bio::SeqIO->new('-file' => "<$in_file",'-format' => "fasta") or return 0;
316 + my $out_seq = Bio::SeqIO->new('-file' => ">$temp_in",'-format' => "fasta") or return 0;
317 +- open OUT, ">$blast_file_from_db";
318 ++ open OUT, ">$blast_file_from_db" or print localtime().": Cannot write to $blast_file_from_db file: $!\n";
319 + while (my $seq=$in_seq->next_seq){
320 + my $seq_name=$seq->id;
321 + $sth->bind_param(1,$seq_name);
322 +@@ -1162,10 +1165,11 @@
323 + #we run the blast
324 + #we need to check for every blast if this blast has already been done to avoid repeating blast from different modules
325 + if (!$num_blast_todo){
326 +- print localtime().": All BLASTs are already on the database\n";
327 ++ print localtime().": All BLASTs are already in the database: \$num_blast_todo=$num_blast_todo\n";
328 + my $cmd="mv $blast_file_from_db $out_file";
329 + !system ($cmd) or return 0;
330 +- return 1
331 ++ print localtime().": Renamed $blast_file_from_db to $out_file\n";
332 ++ return 1;
333 + }
334 + run_local_blast($temp_in,$in_type,$blast_file_from_blast,$blast_db,$config) or return 0;
335 + $dbh=open_db($db) or return 0;
336 +@@ -1173,14 +1177,18 @@
337 + #we split the result and we store it on the database
338 + #we should do a minimal parsing but we don't use bioperl to speed up the process
339 + #we just asume that every blast begins with ^BLAST and that the query is ^Query= xxxxxxxx
340 +- open IN,"<$blast_file_from_blast" or return 0;
341 ++ if (! -r $blast_file_from_blast) {
342 ++ print localtime().": File $blast_file_from_blast is not readable: $!\n";
343 ++ return 0;
344 ++ }
345 ++ open IN,"<$blast_file_from_blast" or die localtime().": Cannot open $blast_file_from_blast file: $!\n";
346 + my $more=1;
347 + my $blast_result="";
348 + my $query="";
349 + if (read_config($config,'mysql_compress','')){
350 +- $st="INSERT INTO blast_result (query_seq,db,blast_result) VALUES (?,?,COMPRESS(?))";
351 ++ $st="INSERT DELAYED INTO blast_result (query_seq,db,blast_result) VALUES (?,?,COMPRESS(?))";
352 + }else{
353 +- $st="INSERT INTO blast_result (query_seq,db,blast_result) VALUES (?,?,?)";
354 ++ $st="INSERT DELAYED INTO blast_result (query_seq,db,blast_result) VALUES (?,?,?)";
355 + }
356 + $sth=$dbh->prepare($st) or return 0;
357 + while ($more){
358 +@@ -1211,6 +1219,7 @@
359 + #now we have two files with blast results, the one generated by the blast and the one made by stored blast
360 + #we should merge them to obtain the output file
361 + my $cmd="cat $blast_file_from_blast $blast_file_from_db > $out_file";
362 ++ print localtime().": Merging computed blast output with the one already in database: 'cat $blast_file_from_blast $blast_file_from_db > $out_file'\n";
363 + !system ($cmd) or return 0;
364 +
365 + return 1;
366 +@@ -1241,7 +1250,7 @@
367 + print localtime().": There was a problem executing the statement:\n" and
368 + print localtime().": Query: $query\n" and
369 + print localtime().": Blast db: $blast_db\n" and
370 +- print localtime().": $st\n" and
371 ++ print localtime().": $st: $DBI::errstr\n" and
372 + return 0
373 + );
374 + return 1;
375 +@@ -1267,25 +1276,55 @@
376 +
377 + my $db;my $db_type; my $env_blastdir; my $program;
378 + if (not($db_name =~ /unigenes\.*\d*/) and $db_name ne 'superunigenes'){
379 ++ print localtime().": BLAST database $db_name does not match REGEXP with /unigenes\.*\\d*/ nor =='superunigenes',\n\t\t\tfetching its location from table db (sourced from databases.csv)\n";
380 + $db=${$$db_info{$db_name}}{'local_blast_name'};
381 + $db_type=${$$db_info{$db_name}}{'kind'};
382 ++ print localtime().": Inferred $db_type datatype from table db (sourced from databases.csv)\n";
383 + }else{
384 ++ # unigenes and superunigenes are DNA datasets generated from this EST dataset
385 ++ # albeit it is ugly these files were written into BLASTDB directory where typically site-wide, public databases exist
386 + if ($ENV{'BLASTDB'}) { #if blastdb enviroment is set
387 ++ print localtime().": BLAST database $db_name will be looked up via BLASTDB=".$ENV{'BLASTDB'}."\n";
388 + #$env_blastdir = $ENV{'BLASTDB'};
389 + #$ENV{'BLASTDB'} = '';
390 + $db=$db_name; #db is just db name
391 + }else{ #otherwise
392 ++ print localtime().": Getting rid of the trailing '_dna' if possible\n";
393 + $db_name =~ s/_dna$//; # get rid of '_dna' in db name
394 + $db=read_config($config,'blast_dir','').$db_name; #we should add the path to the database
395 ++ print localtime().": BLAST database $db was looked up via est_pipe.conf variable \$blast_dir\n";
396 + }
397 + $db_type='dna';
398 ++ print localtime().": Forced 'dna' datatype because unigenes and superunigenes are DNA datasets generated from this EST dataset.\n\t\t\t However, it is ugly that these files were written into BLASTDB defined directory where typically site-wide, public databases exist.\n";
399 + }
400 + unless (check_blastdb($ENV{'BLASTDB'},$db)) {
401 + print localtime().": BLAST database $db cannot be found at $ENV{'BLASTDB'}\n";
402 ++ } else {
403 ++ if (-r $ENV{'BLASTDB'}."/".$db) {
404 ++ print localtime().": BLAST database $db exists in $ENV{'BLASTDB'}\n";
405 ++ if ($db_type eq 'dna') {
406 ++ if (! -r $ENV{'BLASTDB'}."/".$db.".nin") {
407 ++ system("cd $ENV{'BLASTDB'} && formatdb -p F -i $db") or die "Failed to formatdb -p F -i $db\n";
408 ++ } else {
409 ++ print localtime().": BLAST database ".$ENV{'BLASTDB'}."/".$db." already formatted, good\n";
410 ++ }
411 ++ } elsif ($db_type eq 'pep') {
412 ++ if (! -r $ENV{'BLASTDB'}."/".$db.".pin") {
413 ++ system("cd $ENV{'BLASTDB'} && formatdb -p T -i $db") or die "Failed to formatdb -p T -i $db\n";
414 ++ } else {
415 ++ print localtime().": BLAST database ".$ENV{'BLASTDB'}."/".$db." already formatted, good\n";
416 ++ }
417 ++ } else {
418 ++ print localtime().": Do not know whether $db is a pep/dna database, not checking whether it is formatted by formatdb, it is your job\n";
419 ++ }
420 ++ } else {
421 ++ print localtime().": Cannot find BLAST database ".$ENV{'BLASTDB'}."/".$db."\n";
422 ++ return 0;
423 ++ }
424 + }
425 +
426 + if (!$db_type){
427 +- print localtime().": Database type (dna or pep) not defined for database $db_name\n";
428 ++ print localtime().": Database type (dna or pep) not defined for database $db_name in databases.csv and subsequently in table db.\n";
429 + return 0;
430 + }
431 + $program = ${$$db_info{$db_name}}{'blast_program'};
432 +@@ -1294,6 +1333,7 @@
433 + elsif ($in_type eq 'pep' and $db_type eq 'dna'){$program='tblastn'}
434 + elsif ($in_type eq 'dna' and $db_type eq 'pep'){$program='blastx'}
435 + elsif ($in_type eq 'pep' and $db_type eq 'pep'){$program='blastp'}
436 ++ else { print localtime().": Wrong combination of input data type=$in_type and db.kind=$in_type, do not know which of blastn/tblastn/blastx/blastp to use\n"; return 0; }
437 + }elsif($program ne'blastn' and $program ne'tblastn' and $program ne'blastx' and $program ne'blastp' and $program ne'tblastx'){
438 + print localtime().": BLAST program called $program is not allowed\n";
439 + return 0;
440 +@@ -1330,7 +1370,7 @@
441 + $ok=not (system("rm $out_file"));
442 + unless ($ok){
443 + print localtime().": The BLAST output file: $out_file\n";
444 +- print localtime().": exists and can not be removed\n";
445 ++ print localtime().": exists and can not be removed: $!\n";
446 + return 0;
447 + };
448 + }
449 +@@ -1346,7 +1386,7 @@
450 + my $fail=system($cmd);
451 + if ($fail){
452 + print localtime().": Something wen't wrong with the mpiBLAST\n";
453 +- print localtime().": Command was: $cmd\n";
454 ++ print localtime().": Command was: $cmd: $!\n";
455 + return 0;
456 + }
457 + } else {
458 +@@ -1357,7 +1397,7 @@
459 + my $fail=system($cmd);
460 + if ($fail){
461 + print localtime().": Something wen't wrong with the BLAST\n";
462 +- print localtime().": Command was: $cmd\n";
463 ++ print localtime().": Command was: $cmd: $!\n";
464 + return 0;
465 + }
466 + }else{
467 +@@ -1371,7 +1411,7 @@
468 + #we create the input stream
469 + my $in = Bio::SeqIO->new(-file => $in_file , -format => 'Fasta') or $ok=0;
470 + unless ($ok){
471 +- print localtime().": There was a problem opening the file $in_file\n";
472 ++ print localtime().": There was a problem opening the file $in_file: $!\n";
473 + }
474 + my $seq; my $blast_report;
475 + while ($seq=$in->next_seq()) {
476 +@@ -1380,13 +1420,13 @@
477 + #input file there could be some memory trouble
478 + $blast_report= $factory->blastall($seq);
479 + unless ($blast_report) {
480 +- print localtime().": There was a problem running the BLAST search\n";
481 ++ print localtime().": There was a problem running the BLAST search: $!\n";
482 + return 0;
483 + }
484 +- system("cat $temp_file >> $out_file")
485 ++ system("cat $temp_file >> $out_file") or die "Cannot append to $out_file: $!\n";
486 + }
487 +- #we remove the temporal file
488 +- system("rm $temp_file");
489 ++ #we remove the temporary file
490 ++ system("rm $temp_file") or die "Cannot remove temporary file $temp_file: $!\n";
491 + #my $blast_report = $factory->blastall($in_file);
492 + }
493 + }
494 +@@ -1425,7 +1465,7 @@
495 + my $blast_dbs=read_config($config,'blast_dbs','');
496 + my @blast_dbs=split(/,/,$blast_dbs);
497 + unless (@blast_dbs) {
498 +- print localtime().": There are no BLAST databases defined in the config file\n";
499 ++ print localtime().": There are no BLAST databases defined in the config file under \$blast_dbs\n";
500 + return 0;
501 + }
502 + #how are the report files named?
503 +@@ -1441,7 +1481,7 @@
504 + }
505 + my $db=read_config($config,'db_path',''); #complete path to the mysql db
506 + unless (check_table($db,$table)){
507 +- print localtime().": Table $table for store the BLAST reports is not in database $db\n";
508 ++ print localtime().": Table $table to store the BLAST reports is not in created in the database $db\n";
509 + return 0;
510 + }
511 +
512 +@@ -1461,7 +1501,7 @@
513 + my $config=shift;
514 + my $blast_db=shift;
515 + my $in_file=shift;
516 +- print localtime().": Storing BLAST report: $in_file into the database\n";
517 ++ print localtime().": Storing BLAST report from $in_file into the database\n";
518 + my $table=read_config($config,'blast_reports_table','');
519 + my $db=read_config($config,'db_path',''); #complete path to the mysql db
520 +
521 +@@ -1477,13 +1517,13 @@
522 + #| identity | float | | | 0 | |
523 + #| similarity | float | | | 0 | |
524 + #| e_value
525 +- my $st="INSERT INTO $table (blast_result_id,subj_acc,description,location_begin_query,location_end_query,location_query,location_begin_subj,location_end_subj,location_subj,identity,similarity,e_value) VALUES (?,?,?,?,?,?,?,?,?,?,?,?);";
526 ++ my $st="INSERT DELAYED INTO $table (blast_result_id,subj_acc,description,location_begin_query,location_end_query,location_query,location_begin_subj,location_end_subj,location_subj,identity,similarity,e_value) VALUES (?,?,?,?,?,?,?,?,?,?,?,?);";
527 + my $sth=$dbh->prepare($st) or return 0;
528 + my $st_blast_result="SELECT blast_result_id FROM blast_result WHERE query_seq=? AND db=?";
529 + my $sth_blast_result=$dbh->prepare($st_blast_result) or return 0;
530 + unless ($sth){
531 + print localtime().": There was a problem preparing statement:\n";
532 +- print localtime().": $st\n";
533 ++ print localtime().": $st: $DBI::errstr\n";
534 + close_db($dbh);
535 + return 0;
536 + }
537 +@@ -1493,8 +1533,10 @@
538 + }
539 + open IN, "<$in_file" or $ok=0;
540 + unless ($ok) {
541 +- print localtime()." There was a problem opening file $in_file\n";
542 ++ print localtime()." There was a problem opening file $in_file: $!\n";
543 + return 0;
544 ++ } else {
545 ++ print localtime().": Parsing $in_file with BLAST plaintext output\n";
546 + }
547 + my $line;my $query;my $hit;
548 + while ($ok){
549 +@@ -1513,7 +1555,7 @@
550 + if ($array[0]){
551 + $blast_result_id=$array[0]
552 + }else{
553 +- print localtime().": BLAST result ID has not been found in the database\n";
554 ++ print localtime().": BLAST result blast_result_id has not been found in the database using query_seq=$query AND db=$blast_db\n";
555 + return 0;
556 + }
557 +
558 +@@ -1558,6 +1600,7 @@
559 + print localtime().": query: $query\n";
560 + print localtime().": blast_db: $blast_db\n";
561 + print localtime().": hit: $hit\n";
562 ++ print localtime().": The error was: $DBI::errstr\n";
563 + return 0;
564 + }
565 + }
566
567 diff --git a/sci-biology/est2uni/files/est_annot_go.pm.patch b/sci-biology/est2uni/files/est_annot_go.pm.patch
568 new file mode 100644
569 index 0000000..bdda596
570 --- /dev/null
571 +++ b/sci-biology/est2uni/files/est_annot_go.pm.patch
572 @@ -0,0 +1,136 @@
573 +--- est_annot_go.pm.ori 2011-02-22 15:33:33.000000000 +0100
574 ++++ est_annot_go.pm 2011-02-23 00:12:48.000000000 +0100
575 +@@ -213,13 +213,13 @@
576 + sub annotate_go_from_blast($$){
577 + my $config=shift;
578 + my $db_info=shift;
579 +- print localtime().": Annotating the sequences with GO terms looking at the BLAST results.\n";
580 ++ print localtime().": Annotating the sequences with GO terms from ".read_config($config,'go_assoc_table','')." looking at the BLAST results in ".read_config($config,'go_db_path','').".\n";
581 +
582 + #the go-blast_db association is stored in a table on a database
583 + my $go_db_path=read_config($config,'go_db_path','');
584 + my $assoc_table=read_config($config,'go_assoc_table','');
585 + my $go_dbh=open_db($go_db_path) or (
586 +- print localtime().": There was a problem opening the database $go_db_path\n" and
587 ++ print localtime().": There was a problem opening the database $go_db_path: $DBI::errstr\n" and
588 + return 0
589 + );
590 +
591 +@@ -227,13 +227,13 @@
592 + my $result_table=read_config($config,'go_table','');
593 + my $est_db_path=read_config($config,'db_path','');
594 + my $est_dbh=open_db($est_db_path) or (
595 +- print localtime().": There was a problem opening the database $est_db_path\n" and
596 ++ print localtime().": There was a problem opening the database $est_db_path: $DBI::errstr\n" and
597 + return 0
598 + );
599 + #we use ignore because we're interested just in the first annotation for the combined seq_go_slim, it could be more but they're not important
600 + my $est_st="INSERT IGNORE INTO $result_table (db,db_symbol,qualifier,go_id,ori_evidence,evidence,aspect,taxon_id,e_value,is_slim,seq_id) VALUES (?,?,?,?,?,?,?,?,?,?,?);";
601 + my $est_sth=prepare_st($est_dbh,$est_st) or (
602 +- print localtime().": There was a problem executing the statement $est_st\n" and
603 ++ print localtime().": There was a problem executing the statement $est_st: $DBI::errstr\n" and
604 + return 0
605 + );
606 +
607 +@@ -255,7 +255,7 @@
608 + my $real_table=$assoc_table.$go_db;
609 + my $go_st="SELECT db,db_symbol,qualifier,go_id,evidence,aspect,taxon_id,is_slim FROM $real_table WHERE db_symbol=? ;";
610 + my $go_sth=prepare_st($go_dbh,$go_st) or (
611 +- print localtime().": There was a problem executing the statement $go_st\n" and
612 ++ print localtime().": There was a problem executing the statement $go_st: $DBI::errstr\n" and
613 + return 0
614 + );
615 + unless ($go_db){
616 +@@ -264,7 +264,7 @@
617 + }
618 + #we go through the blast files using the bioperl blast parser
619 + my $in = new Bio::SearchIO(-format => 'blast',-file => $blast_file) or(
620 +- print localtime().": There was a problem creating a bioperl handler for the BLAST file $blast_file\n" and
621 ++ print localtime().": There was a problem creating a bioperl handler for the BLAST file $blast_file: $!\n" and
622 + return 0
623 + );
624 +
625 +@@ -277,9 +277,12 @@
626 + my $significative_hit=0;
627 + my $query=$result->query_name;
628 + my $hit=$result->next_hit;
629 +- unless ($hit){$done=1;last}; #if there isn't more hits we're finnished
630 ++ unless ($hit){$done=1;last}; #if there isn't more hits we're finished
631 + my $acc=$hit->name;
632 +- #the arabidopsis project puts an .number in the hit name that should be removed
633 ++ if (! $acc ) {
634 ++ print localtime().": No \$acc value parsed from \$hit->name\n";
635 ++ }
636 ++ #the arabidopsis project puts a .number in the hit name that should be removed
637 + if (${$$db_info{$go_db}}{'orthologues_arabi_hack'}){
638 + $acc =~ s/\.\d$//;
639 + }
640 +@@ -299,7 +302,7 @@
641 + #is there go terms associated with this acc?
642 + $go_sth->bind_param(1,$acc);
643 + $go_sth->execute or (
644 +- print localtime().": There was a problem executing the statement $go_st with accession $acc\n" and
645 ++ print localtime().": There was a problem executing the statement $go_st with accession $acc: $DBI::errstr\n" and
646 + return 0
647 + );
648 + my $there_is_go=0;
649 +@@ -319,7 +322,7 @@
650 + $est_sth->bind_param(10,$$go[7]); #is this a slim term?
651 + $est_sth->bind_param(11,$query); #annotated sequence
652 + $est_sth->execute or (
653 +- print localtime().": There was a problem executing the statement $est_st\n" and
654 ++ print localtime().": There was a problem executing the statement $est_st: $DBI::errstr\n" and
655 + return 0
656 + );
657 + $done=1; #we do not need any more hits
658 +@@ -333,11 +336,12 @@
659 + $i_uni++;
660 + }
661 + close_st ($go_sth);
662 ++ print localtime().": $i_uni BLAST unigenes processed from $blast_file, $i_uni_with_go with GO annotations, and $i_go_assoc GO terms associated\n";
663 + }
664 + close_st ($est_sth);
665 + close_db ($go_dbh);
666 + close_db ($est_dbh);
667 +- print localtime().": $i_uni BLAST unigenes processed, $i_uni_with_go with GO annotations, and $i_go_assoc GO terms associated\n";
668 ++ print localtime().": $i_uni BLAST unigenes processed from $blast_file_base and "."@go_dbs\n".", $i_uni_with_go with GO annotations, and $i_go_assoc GO terms associated\n";
669 + return 1;
670 + }
671 +
672 +@@ -367,7 +371,7 @@
673 + my $assoc_file=${$$db_info{$db}}{'local_go_assoc_file'};
674 + my $cmd="$bin $slim_file $go_def_file $assoc_file -o $temp_dir$base_out_file".$sep."$db";
675 + not (system $cmd) or (
676 +- print localtime().": There was a problem executing: $cmd\n" and
677 ++ print localtime().": There was a problem executing $cmd: $!\n" and
678 + return 0
679 + );
680 + $i++;
681 +@@ -447,7 +451,8 @@
682 + my $table=read_config($config,'go_assoc_table','');
683 + #now it's time to fill the table with the data
684 + my $real_table=$table.$go_db;
685 +- my $st="INSERT INTO $real_table (db,db_symbol,qualifier,go_id,evidence,aspect,taxon_id,is_slim) VALUES (?,?,?,?,?,?,?,?);";
686 ++ # this is a wastefull insert inserting qualifier, taxon_id, is_slim equal to NULL
687 ++ my $st="INSERT DELAYED INTO $real_table (db,db_symbol,qualifier,go_id,evidence,aspect,taxon_id,is_slim) VALUES (?,?,?,?,?,?,?,?);";
688 + my $dbh=open_db($db_path) or (
689 + print localtime().": There was a problem opening the database $db_path\n" and
690 + return 0
691 +@@ -491,7 +496,7 @@
692 + $sth->bind_param(5,$items[6]); #evidence
693 + $sth->bind_param(6,$items[8]); #aspect
694 + $sth->bind_param(7,$items[12]); #taxon_id
695 +- $sth->bind_param(8,$is_slim);
696 ++ $sth->bind_param(8,$is_slim); #is_slim
697 + }else{
698 + print localtime().": Gene-GO association file has no defined format in $config go_assoc_file_format\n";
699 + print localtime().": Or the format is not supported. Supported formats are goa and tair\n";
700 +@@ -542,7 +547,7 @@
701 + my $db=read_config($config,'db_path','');
702 +
703 + open IN,"<$file" or (
704 +- print localtime().": Imposible to open file: $file\n" and
705 ++ print localtime().": Error opening file $file: $!\n" and
706 + return 0
707 + );
708 +
709
710 diff --git a/sci-biology/est2uni/files/est_annot_psnp.pm.patch b/sci-biology/est2uni/files/est_annot_psnp.pm.patch
711 new file mode 100644
712 index 0000000..996d625
713 --- /dev/null
714 +++ b/sci-biology/est2uni/files/est_annot_psnp.pm.patch
715 @@ -0,0 +1,11 @@
716 +--- est_annot_psnp.pm.ori 2011-02-22 20:12:25.000000000 +0100
717 ++++ est_annot_psnp.pm 2011-02-22 20:12:46.000000000 +0100
718 +@@ -773,7 +773,7 @@
719 + }
720 +
721 + my $dbh=open_db($db) or return 0;
722 +- my $st_psnp="INSERT INTO $table_psnp (psnp_id,unigene,location,is_snp,is_indel,score,enzymes) VALUES (?,?,?,?,?,?,'');";
723 ++ my $st_psnp="INSERT INTO $table_psnp (psnp_id,unigene,location,is_snp,is_indel,score,enzymes) VALUES (?,?,?,?,?,?,NULL);";
724 + my $sth_psnp=$dbh->prepare($st_psnp);
725 + my $st_seq="INSERT INTO $table_seq (psnp_id,nucleotide,est,accession) VALUES (?,?,?,?);";
726 + my $sth_seq=$dbh->prepare($st_seq);
727
728 diff --git a/sci-biology/est2uni/files/est_annot_reciprocal_blast.pm.patch b/sci-biology/est2uni/files/est_annot_reciprocal_blast.pm.patch
729 new file mode 100644
730 index 0000000..e887f7e
731 --- /dev/null
732 +++ b/sci-biology/est2uni/files/est_annot_reciprocal_blast.pm.patch
733 @@ -0,0 +1,14 @@
734 +--- est_annot_reciprocal_blast.pm.ori 2011-02-22 01:19:43.000000000 +0100
735 ++++ est_annot_reciprocal_blast.pm 2011-02-22 01:39:37.000000000 +0100
736 +@@ -106,8 +106,9 @@
737 + my @dbs=split (',',read_config($config,'reci_dbs',''));
738 + foreach my $db (@dbs){
739 + if (!$$db_info{$db}){
740 +- print localtime().": Database $db is not defined in db table on the databases\n";
741 +- return 0;
742 ++ print localtime().": Database $db included in \$reci_dbs is not described in table db, skipping.\n";
743 ++ #return 0;
744 ++ next;
745 + }
746 + my $in_file=$unigenes_seq_file;
747 + my $outf=$in_file.$separator.$db.$separator."blast";
748
749 diff --git a/sci-biology/est2uni/files/est_clustering.pm.patch b/sci-biology/est2uni/files/est_clustering.pm.patch
750 new file mode 100644
751 index 0000000..a6e553a
752 --- /dev/null
753 +++ b/sci-biology/est2uni/files/est_clustering.pm.patch
754 @@ -0,0 +1,383 @@
755 +--- est_clustering.pm.ori 2011-02-21 13:12:39.000000000 +0100
756 ++++ est_clustering.pm 2011-02-22 20:23:16.000000000 +0100
757 +@@ -76,7 +76,7 @@
758 + }
759 +
760 + sub contig_image ($) {
761 +- print localtime().": Creating contig images\n";
762 ++ print localtime().": Creating contig images using contigimage.pl\n";
763 + my $config = shift;
764 + my $bin = read_config($config,'contigimage_bin','contigimage.pl');
765 + my $ace = read_config($config,'ace_file','');
766 +@@ -94,6 +94,8 @@
767 + my $qual_file=read_config($config,'seqclean_masked_qual',''); #output file for the qualities
768 + my $db=read_config($config,'db_path',''); #path to the database in the format dbi:$dbi_driver:$db_name:$host
769 + my @libraries=split(/,/,read_config($config,'libraries','')); #libraries to be retrieved
770 ++ # if populate_clone_table=0 then the clone table is empty, therefore the SELECT would return empty results
771 ++ my $populate_clone_table=read_config($config,'populate_clone_table','');
772 + my $ok=1;
773 + print localtime().": Fetching processed ESTs from the database\n";
774 +
775 +@@ -108,20 +110,36 @@
776 + #we create the handler for the database
777 + my $dbh; my $sth; #database and statements handlers
778 + if ($ok){$dbh=open_db($db) or $ok=0}; #we open the database
779 +- my $st="SELECT sequence.name,sequence.sequence,sequence.quality FROM sequence,est,clone WHERE ( ";
780 ++
781 ++ my $st="";
782 ++ if ($populate_clone_table) {
783 ++ $st="SELECT sequence.name,sequence.sequence,sequence.quality FROM sequence,est,clone WHERE ( ";
784 + foreach (@libraries) {
785 + $st.="clone.library = '$_' OR "
786 + }
787 + $_=$st; s/ OR $//;$st=$_; #this removes the trailing OR
788 + $st.=" ) ";
789 ++ } else {
790 ++ $st="SELECT sequence.name,sequence.sequence,sequence.quality FROM sequence,est WHERE ";
791 ++ }
792 ++
793 ++ # if populate_clone_table=0 then the clone table is empty, therefore the SELECT would return empty results
794 ++ # mysql> SELECT sequence.name,sequence.sequence,sequence.quality FROM sequence,est,clone WHERE
795 ++ # ( clone.library = 'sgn' OR clone.library = 'fake' OR clone.library = 'tigr' )
796 ++ # AND clone.name=est.clone AND est.processed_seq=sequence.name;
797 ++ # Empty set (0.00 sec)
798 ++ if ($populate_clone_table) {
799 + $st.= "AND clone.name=est.clone AND est.processed_seq=sequence.name";
800 ++ } else {
801 ++ $st.= "est.processed_seq=sequence.name";
802 ++ }
803 +
804 + if ($ok) {$sth=$dbh->prepare($st) or $ok=0}
805 + #we execute the statement
806 + if ($ok) {
807 + $sth->execute() or $ok=0;
808 + unless ($ok) {
809 +- print localtime().": There was an error executing the SELECT statement\n";
810 ++ print localtime().": There was an error executing the SELECT statement: $DBI::errstr\n";
811 + }
812 + }
813 + #now all the results are written in the output files
814 +@@ -138,6 +156,7 @@
815 + $seq_stream->write_seq($seq);
816 + $qual_stream->write_seq($seq->qual_obj());
817 + }
818 ++ print localtime().": Fetched ".$sth->rows()." from the database.\n";
819 + close_st($sth);
820 + close_db($dbh);
821 + return $ok;
822 +@@ -159,11 +178,11 @@
823 + );
824 + my $st="DELETE FROM $table WHERE object_type='contig' OR object_type='singleton';";
825 + my $sth=prepare_st($dbh,$st) or (
826 +- print localtime().": Unable to prepare the statement $st\n" and
827 ++ print localtime().": Unable to prepare the statement $st: $DBI::errstr\n" and
828 + return 0
829 + );
830 + $sth->execute or (
831 +- print localtime().": Unable to execute the statement $st\n" and
832 ++ print localtime().": Unable to execute the statement $st: $DBI::errstr\n" and
833 + return 0
834 + );
835 + close_st($sth);
836 +@@ -172,11 +191,11 @@
837 +
838 + $st="UPDATE $table SET unigene=NULL, location_begin=NULL, location_end=NULL, orientation_fwd=NULL, r_begin_in=NULL, r_end_in=NULL, inserts=NULL;";
839 + $sth=prepare_st($dbh,$st) or (
840 +- print localtime().": Unable to prepare the statement $st\n" and
841 ++ print localtime().": Unable to prepare the statement $st: $DBI::errstr\n" and
842 + return 0
843 + );
844 + $sth->execute or (
845 +- print localtime().": Unable to execute the statement $st\n" and
846 ++ print localtime().": Unable to execute the statement $st: $DBI::errstr\n" and
847 + return 0
848 + );
849 + close_st($sth);
850 +@@ -227,7 +246,7 @@
851 +
852 + # First we run tgicl
853 + chdir($temp_dir);
854 +- $command="$bin_tgicl ".$in_seq." -q ".$in_qual;
855 ++ $command="$bin_tgicl -F ".$in_seq." -q ".$in_qual;
856 + if ($tgicl_opt) {
857 + $command .= " $tgicl_opt";
858 + }
859 +@@ -247,19 +266,25 @@
860 + unless ($tgicl_success)
861 + {
862 + print localtime().": There was a problem running tgicl. The command was:\n";
863 +- print "$command\n";
864 ++ print "$command: $!\n";
865 + return $tgicl_success;
866 + }
867 +
868 + # Now we save the results on the results dir
869 + # file with the reads that form every contig
870 + print localtime().": Saving the tgicl contigs results\n";
871 ++ if (-r $in_seq.$contigs_ext) {
872 ++ # files from older tgicl are *_clusters
873 + $command="mv ".$in_seq.$contigs_ext." ".$contigs_file;
874 ++ } elsif (-r $in_seq."_cl".$contigs_ext) {
875 ++ # files from newer tgicl are *_cl_clusters
876 ++ $command="mv ".$in_seq."_cl".$contigs_ext." ".$contigs_file;
877 ++ }
878 + $tgicl_success= not(system($command));
879 + unless ($tgicl_success)
880 + {
881 + print localtime().": There was a problem moving the tgicl result. The command was:\n";
882 +- print "$command\n";
883 ++ print "$command: $!\n";
884 + return $tgicl_success;
885 + }
886 +
887 +@@ -270,7 +295,7 @@
888 + unless ($tgicl_success)
889 + {
890 + print localtime().": There was a problem running tgicl. The command was:\n";
891 +- print "$command\n";
892 ++ print "$command: $!\n";
893 + return $tgicl_success;
894 + }
895 +
896 +@@ -286,7 +311,7 @@
897 + unless ($tgicl_success)
898 + {
899 + print localtime().": There was a problem running tgicl. The command was:\n";
900 +- print "$command\n";
901 ++ print "$command: $!\n";
902 + return $tgicl_success;
903 + }
904 +
905 +@@ -302,7 +327,7 @@
906 + unless ($tgicl_success)
907 + {
908 + print localtime().": There was a problem running tgicl. The command was:\n";
909 +- print "$command\n";
910 ++ print "$command: $!\n";
911 + return $tgicl_success;
912 + }
913 +
914 +@@ -313,7 +338,7 @@
915 + $tgicl_success=not(system($command));
916 + unless ($tgicl_success)
917 + {
918 +- print localtime().": There was a problem running cdbyank\n";
919 ++ print localtime().": There was a problem running $command: $!\n";
920 + return $tgicl_success;
921 + }
922 +
923 +@@ -353,7 +378,7 @@
924 + $ok=not(system($command));
925 + unless ($ok) {
926 + print localtime().": There was a problem running cap3. The command was:\n";
927 +- print "$command\n";
928 ++ print "$command: $!\n";
929 + return $ok;
930 + }
931 + my $qual_file=$seq_file.".qual";
932 +@@ -361,7 +386,7 @@
933 + system($command);
934 + unless ($ok) {
935 + print localtime().": There was a problem running cap3. The command was:\n";
936 +- print "$command\n";
937 ++ print "$command: $!\n";
938 + return $ok;
939 + }
940 +
941 +@@ -390,7 +415,7 @@
942 + unless ($ok)
943 + {
944 + print localtime().": There was a problem running cap3. The command was:\n";
945 +- print "$command\n";
946 ++ print "$command: $!\n";
947 + return $ok;
948 + }
949 +
950 +@@ -402,7 +427,7 @@
951 + unless ($ok)
952 + {
953 + print localtime().": There was a problem running cap3. The command was:\n";
954 +- print "$command\n";
955 ++ print "$command: $!\n";
956 + return $ok;
957 + }
958 +
959 +@@ -412,7 +437,7 @@
960 + unless ($ok)
961 + {
962 + print localtime().": There was a problem running tgicl. The command was:\n";
963 +- print "$command\n";
964 ++ print "$command: $!\n";
965 + return $ok;
966 + }
967 +
968 +@@ -423,7 +448,7 @@
969 + unless ($ok)
970 + {
971 + print localtime().": There was a problem running tgicl. The command was:\n";
972 +- print "$command\n";
973 ++ print "$command: $!\n";
974 + return $ok;
975 + }
976 +
977 +@@ -442,17 +467,19 @@
978 + #we should keep the original singletons names
979 + my $single_file=read_config($config,'singletons_list','');
980 + my $ori_single_file=read_config($config,'original_singletons_list','');
981 ++
982 ++ my $prefix=read_config($config,'prefix','');
983 ++ my $postfix=read_config($config,'postfix','');
984 ++ # doh, but the routine update_est_table_with_singletons() anyways looks for the unchanged original file
985 + my $cmd="cp $single_file $ori_single_file";
986 + my $not_ok=system ($cmd);
987 + if ($not_ok){
988 +- print localtime()."; There was a problem with the command $cmd\n";
989 ++ print localtime()."; There was a problem with the command $cmd: $!\n";
990 + return 0;
991 + }
992 +- my $prefix=read_config($config,'prefix','');
993 +- my $postfix=read_config($config,'postfix','');
994 + unless ($prefix or $postfix){
995 +- print localtime().": WARNING, there are no prefix or postfix to change unigene name\n";
996 +- print localtime().": WARNING, it won't be any name change\n";
997 ++ print localtime().": WARNING, there are no prefix or postfix defined to change unigene name\n";
998 ++ print localtime().": WARNING, there won't be any name change\n";
999 + return 1;
1000 + }
1001 + change_seq_names_in_file($contigs_file,$config,'') or return 0;
1002 +@@ -470,8 +497,8 @@
1003 + my $postfix=read_config($config,'singleton_seq_tag','');
1004 +
1005 + my $temp_file=select_temp_file($config);
1006 +- open IN, "<$file";
1007 +- open OUT, ">$temp_file\n";
1008 ++ open IN, "<$file" or die "Error: failed to open $file: $!\n";
1009 ++ open OUT, ">$temp_file" or die "Error: failed to write $temp_file: $!\n";
1010 + while (my $line = <IN>){
1011 + #for fasta files
1012 + if ($line =~ /^>/){
1013 +@@ -586,7 +613,7 @@
1014 + my $ok=1;
1015 + open OUT,">$outf" or $ok= 0;
1016 + unless ($ok){
1017 +- print localtime().": There was a problem opening the file: $outf\n";
1018 ++ print localtime().": There was a problem opening the file: $outf: $!\n";
1019 + return 0;
1020 + }
1021 +
1022 +@@ -629,7 +656,7 @@
1023 + my $ok=1;
1024 + open IN, "<$dnaf" or $ok=0;
1025 + unless ($ok){
1026 +- print localtime().": ESTScan result file $dnaf couldn't be opened\n";
1027 ++ print localtime().": ESTScan result file $dnaf couldn't be opened: $!\n";
1028 + return 0;
1029 + }
1030 + while (<IN>){
1031 +@@ -653,18 +680,18 @@
1032 + my $backf=$revf.".bak";
1033 + my $not_ok=system ("cp $revf $backf");
1034 + if ($not_ok){
1035 +- print localtime().": There was a problem when trying to do a copy of $revf to $backf\n";
1036 ++ print localtime().": There was a problem when trying to do a copy of $revf to $backf: $!\n";
1037 + return 0;
1038 + }
1039 +
1040 + open OUT, ">$revf" or $ok=0;
1041 + unless ($ok){
1042 +- print localtime().": Reverse file $revf couldn't be opened for output\n";
1043 ++ print localtime().": Reverse file $revf couldn't be opened for output: $!\n";
1044 + return 0;
1045 + }
1046 + open IN, "<$backf" or $ok=0;
1047 + unless ($ok){
1048 +- print localtime().": Reverse file $backf couldn't be opened for input\n";
1049 ++ print localtime().": Reverse file $backf couldn't be opened for input: $!\n";
1050 + return 0;
1051 + }
1052 + while (<IN>){
1053 +@@ -711,20 +738,20 @@
1054 +
1055 + open ACE, "<$ace_file" or $ok=0;
1056 + unless ($ok) {
1057 +- print localtime().": There has been a problem opening the file $ace_file\n";
1058 ++ print localtime().": There has been a problem opening the file $ace_file: $!\n";
1059 + print localtime().": Maybe is not in the correct tgicl_ace format.\n";
1060 + return 0;
1061 + }
1062 +
1063 + my $dbh=open_db($db);
1064 + unless ($dbh) {
1065 +- print localtime().": Database $dbh is not reachable\n";
1066 ++ print localtime().": Database $dbh is not reachable: $DBI::errstr\n";
1067 + return 0;
1068 + }
1069 + my $st= write_insert_st ($table,@fields);
1070 + my $sth=prepare_st($dbh,$st);
1071 + unless ($sth) {
1072 +- print localtime().": There has been a problem preparing the statement: $st\n";
1073 ++ print localtime().": There has been a problem preparing the statement: $st: $DBI::errstr\n";
1074 + close_db($dbh);
1075 + return 0;
1076 + }
1077 +@@ -839,6 +866,10 @@
1078 + push(@$orientation,$1);
1079 + }
1080 + $contig =~ s/^\n+//;
1081 ++ while ($contig =~ s/^BS\s+?\d+\s+?\d+\s+?([^\s]+)\s*\n//){
1082 ++ print localtime().": Skipping BS line in the ACE output due to newer cap3: https://listas.upv.es/pipermail/est2uni/2008-October/000191.html\n";
1083 ++ }
1084 ++ $contig =~ s/^\n+//;
1085 + my $read_len=[]; my $seq_names=[];
1086 + my $r_begin_in_read=[];
1087 + my $r_end_in_read=[];
1088 +@@ -955,7 +986,7 @@
1089 + $table=read_config($config,'est_table','');
1090 + $st="UPDATE $table SET unigene=?,orientation_fwd=?,location_begin=?,location_end=?,r_begin_in=?,r_end_in=?,inserts=? WHERE processed_seq=?";
1091 + $sth=prepare_st($dbh,$st) or (
1092 +- print localtime().": There was a problem preparing the statement $st\n" and
1093 ++ print localtime().": There was a problem preparing the statement: $st: $DBI::errstr\n" and
1094 + return 0
1095 + );
1096 + foreach my $contig_info (@contig_est_info){
1097 +@@ -981,7 +1012,7 @@
1098 + $sth->bind_param(7,$insertion);
1099 + $sth->bind_param(8,$seq_name);
1100 + $sth->execute or (
1101 +- print localtime().": There was a problem executing the statement $st\n" and
1102 ++ print localtime().": There was a problem executing the statement: $st: $DBI::errstr\n" and
1103 + return 0
1104 + );
1105 + unless (@{${$contig_info}[1]} and @{${$contig_info}[2]} and @{${$contig_info}[3]}){
1106 +@@ -1042,19 +1073,19 @@
1107 + my $db=read_config($config,'db_path','');
1108 + my $dbh=open_db($db);
1109 + unless ($dbh) {
1110 +- print localtime().": Database $dbh is not reachable\n";
1111 ++ print localtime().": Database $dbh is not reachable: $DBI::errstr\n";
1112 + return 0;
1113 + }
1114 + my $st="UPDATE $est_table SET unigene=?,orientation_fwd=1,location_begin=1,location_end=?,r_begin_in=1,r_end_in=? WHERE processed_seq=?";
1115 + my $sth=prepare_st($dbh,$st) or (
1116 +- print localtime().": There was a problem preparing the statement $st\n" and
1117 ++ print localtime().": There was a problem preparing the statement: $st: $DBI::errstr\n" and
1118 + return 0
1119 + );
1120 +
1121 + my $singletons_file=read_config($config,'seq_singletons_file',''); #singletons fasta file
1122 + my $ori_singletons_file=read_config($config,'original_singletons_list',''); #singletons list file without the name change this is in fact the name of the est sequences that correspond to every singleton
1123 + open ORI, "<$ori_singletons_file" or (
1124 +- print localtime().": There was a problem opening file: $ori_singletons_file\n" and
1125 ++ print localtime().": There was a problem opening file: $ori_singletons_file: $!\n" and
1126 + return 0
1127 + );
1128 +
1129 +@@ -1070,7 +1101,7 @@
1130 + $sth->bind_param(3,$len);
1131 + $sth->bind_param(4,$ori_line);
1132 + $sth->execute or (
1133 +- print localtime().": There was a problem executing the statement $st\n" and
1134 ++ print localtime().": There was a problem executing the statement: $st: $DBI::errstr\n" and
1135 + return 0
1136 + );
1137 + }
1138
1139 diff --git a/sci-biology/est2uni/files/est_prepro.pm.patch b/sci-biology/est2uni/files/est_prepro.pm.patch
1140 new file mode 100644
1141 index 0000000..7efcbe8
1142 --- /dev/null
1143 +++ b/sci-biology/est2uni/files/est_prepro.pm.patch
1144 @@ -0,0 +1,85 @@
1145 +--- est_prepro.pm.ori 2011-02-21 11:37:20.000000000 +0100
1146 ++++ est_prepro.pm 2011-02-22 00:46:57.000000000 +0100
1147 +@@ -478,7 +478,7 @@
1148 + }
1149 + else {
1150 + print localtime()." There is a problem with the length in sequence ".$temp_seq->id."\n";
1151 +- print localtime()." from file: $seq_file\n. Quality and sequence length don't match.\n";
1152 ++ print localtime()." from file: $seq_file. Quality $temp_qual->length and sequence $temp_seq->length length don't match.\n";
1153 + #print $temp_seq->desc."\n";
1154 + return 0;
1155 + }
1156 +@@ -973,7 +973,7 @@
1157 + #check that $assignments_file exist
1158 + if (not(-r $assi_file)){
1159 + print localtime().": ######################################################################\n";
1160 +- print localtime().": WARNING: Assignment file for lucy is not found or not defined\n";
1161 ++ print localtime().": WARNING: Assignment file $assi_file for lucy is not found or not defined\n";
1162 + print localtime().": Lucy will not be used in the preprocessing\n";
1163 + print localtime().": ######################################################################\n";
1164 + }else{
1165 +@@ -1062,7 +1062,7 @@
1166 + my $tag=read_config($config,'assignment_tag','');
1167 + $command="echo $tag".$library.">> $temp_log";
1168 + chdir ($temp_dir); #we change the directory becouse lucy write some stuff in the working directory
1169 +- system($command);
1170 ++ system($command) or die print localtime().": $command failed: $!\n";
1171 + chdir ($actual_dir);
1172 + # Options used:
1173 + # $in_seq fasta sequences generated by phred
1174 +@@ -1086,9 +1086,9 @@
1175 +
1176 + # lucy log is moved to the results directory
1177 + $command="cat $temp_log >> $log";
1178 +- system($command);
1179 ++ system($command) or die print localtime().": failed to append $temp_log contents to $log\n";
1180 + $command="rm $temp_log";
1181 +- system($command);
1182 ++ system($command) or die print localtime().": failed to delete $temp_log\n";
1183 +
1184 + if ($success)
1185 + {
1186 +@@ -1112,8 +1112,8 @@
1187 + print localtime().": Parsing the lucy output\n";
1188 + # now we check that the input file is in place
1189 + unless (check_file($lucy_log_file,"lucy log file")){
1190 +- print localtime().": WARNING there is no lucy log file\n";
1191 +- print localtime().": Maybe lucy has not been used by any library\n";
1192 ++ print localtime().": WARNING there is no lucy log file $lucy_log_file\n";
1193 ++ print localtime().": Maybe lucy has not been used by any library?\n";
1194 + return 1;
1195 + }
1196 +
1197 +@@ -1490,7 +1490,7 @@
1198 + sub run_seqclean($$$$$$$$$$$$)
1199 + {
1200 + my $config=shift;
1201 +- my $library=shift; # informational porpouse only
1202 ++ my $library=shift; # informational purpose only
1203 + my $trimmed_fasta_file=shift; # name for the trimmed sequences file
1204 + my $trimmed_qual_file=shift; # name for the trimmed quality file
1205 + my $seqclean_report_file=shift; # report file with the masked area
1206 +@@ -1518,7 +1518,13 @@
1207 + #The file with the vector (univec recommended)
1208 + my $vec_file=read_config($config,'seqclean_vec_dat','');
1209 + unless (check_file($vec_file,"vector database")){return 0};
1210 +-
1211 ++ if (! -r $vec_file.".nin") {
1212 ++ print localtime().": Formatting database with formatdb -p F -i $vec_file\n";
1213 ++ system("cd `dirname $vec_file` && formatdb -p F -i $vec_file");
1214 ++ if (! -r $vec_file.".nin") {
1215 ++ die "Failed to formatdb $vec_file: $!\n";
1216 ++ }
1217 ++ }
1218 + my $seqclean_success=1; # control variable
1219 + my $command;
1220 + my $temp;
1221 +@@ -1749,7 +1755,7 @@
1222 + sub seqclean_masking_assignments ($$$$$$)
1223 + {
1224 + my $config=shift;
1225 +- print localtime().": Masking the sequences following seqclean's recomendations\n";
1226 ++ print localtime().": Masking the sequences following seqclean's recommendations\n";
1227 + my @libraries=split(',',read_config($config,'libraries','')); # libraries names
1228 + my $report=read_config($config,'seqclean_report',''); # base name for the report generated by seqclean, this is the file with the instruccions for masking the sequences
1229 + my $in_seq=shift; # base name for the trimmed sequences file generated by lucy
1230
1231 diff --git a/sci-biology/est2uni/files/installation_est2uni_perl.txt.patch b/sci-biology/est2uni/files/installation_est2uni_perl.txt.patch
1232 new file mode 100644
1233 index 0000000..a4d2413
1234 --- /dev/null
1235 +++ b/sci-biology/est2uni/files/installation_est2uni_perl.txt.patch
1236 @@ -0,0 +1,85 @@
1237 +--- installation_est2uni_perl.txt.ori 2011-02-21 11:52:15.000000000 +0100
1238 ++++ installation_est2uni_perl.txt 2011-02-21 22:58:23.000000000 +0100
1239 +@@ -84,8 +84,12 @@
1240 + .qual.
1241 +
1242 + There are some library examples on the 'test_data' directory of the EST2uni
1243 +-distribution. You could just copy that libraries to check the software. Be
1244 +-aware that the sgn chromatograms could need a modification in the phredpar.dat file
1245 ++distribution. You could just copy that libraries to check the software.
1246 ++
1247 ++ > cp /usr/local/est2uni/test_data/libraries/* ./libraries
1248 ++ > cp -r /usr/local/est2uni/test_data/data .
1249 ++
1250 ++Be aware that the sgn chromatograms could need a modification in the phredpar.dat file
1251 + (see installation instructions for phred in docs/installation_external_software.txt).
1252 +
1253 + 4.- Copy the estpipe.conf.example file from the installation directory into
1254 +@@ -205,7 +209,7 @@
1255 + Although the clustering software could consider that two unigenes are not similar
1256 + enough to be merged, it is useful to know which are these similar clusters of unigenes.
1257 + Accordingly, EST2uni does a clustering of the unigenes, and these clusters are named
1258 +-'superunigenes'. This analysis is done thorough a BLAST search, followed by
1259 ++'superunigenes'. This analysis is done through a BLAST search, followed by
1260 + parsing the results. Unigenes with a similarity high enough (above user-defined threshold
1261 + parameters) are then clustered in a superunigene.
1262 +
1263 +@@ -219,15 +223,17 @@
1264 +
1265 + In EST2uni a database can have several aspects like the blast indexed files, the fasta
1266 + sequence files or the related GO files. This information should be placed in the file
1267 +-referenced by the parameter databases_dat. This file should be uploaded to the database
1268 +-setting the parameters populate_database_table and do_prior_data_population to 1.
1269 ++referenced by the parameter databases_dat, usually named databases.csv.
1270 ++Contents of this file will be uploaded into the database when the parameters
1271 ++populate_database_table and do_prior_data_population are set to 1.
1272 +
1273 + In that file, the name of the database is defined in the field "name" and could be different
1274 + than the BLAST name. For instance the database name could be "arabidopsis" and the local
1275 +-BLAST name could be "tair6". When a BLAST against database "arabidopsis" is
1276 +-asked, EST2uni will look for the local BLAST name in the database. In this example the blast should
1277 +-be asked for the database "arabidopsis", not against "tair6", despite the fact that the
1278 +-local blast database is named "tair6".
1279 ++BLAST filename could be "tair6". When a BLAST against database "arabidopsis" is
1280 ++asked, EST2uni will look for the local BLAST-formatted filenames tair6.* in the BLASTDB
1281 ++of $blast_dir directory. In this example the blast should be asked for the database
1282 ++"arabidopsis", not against "tair6", despite the fact that the local blast database is
1283 ++named "tair6".
1284 +
1285 +
1286 + BLAST ANNOTATION
1287 +@@ -243,7 +249,8 @@
1288 + this example the arabidopsis database should be defined in the databases_dat file. On that
1289 + file the field local_blast_name should be the name given to that database on the local blast
1290 + installation. For instance it could be named tair6. That means that the name in the blast_dbs
1291 +-parameter and the name of the database in the local blast installation could be different.
1292 ++parameter and the name of the database in the local blast installation could be different
1293 ++(they are mapped via the databases.csv trick).
1294 +
1295 + Other important field in the databases file is "kind", which should be set to dna or pep.
1296 +
1297 +@@ -357,7 +364,7 @@
1298 + same database. The paths for these files should be specified in the local_go_assoc_file and
1299 + local_go_slim_obo_file of the databases information file. The GO association file for the
1300 + arabidopsis database can be downloaded from the www.arabidopsis.org site. At the time of
1301 +- this writting the file is located in:
1302 ++ this writing the file is located in:
1303 + ftp://ftp.arabidopsis.org/home/tair/Ontologies/Gene_Ontology/ATH_GO_GOSLIM.20061021.txt
1304 + The GO slim obo file for arabidopsis and goa is on the Gene Ontology ftp:
1305 + ftp://ftp.geneontology.org/pub/go/GO_slims/go_slim_plant.obo
1306 +@@ -376,7 +383,7 @@
1307 + ----------------
1308 +
1309 + You just need to set the parameter do_hmmer_annot to 1 and to set the name
1310 +-of the HMMER database on the parameter pfam_db.
1311 ++of the HMMER database on the parameter pfam_db with a full path.
1312 +
1313 + HMMER uses the ORFs as a starting point, so it is necessary to have the annotated
1314 + ORF already in the database or to ask for the do_estscan_annot.
1315 +@@ -400,5 +407,5 @@
1316 + ---------------------------
1317 +
1318 + Every researcher can be associated with several ESTs using the csv file defined in the working_on_dat
1319 +-parameter. Those relationships will get loaded when the parameters populate_workin_on_table and
1320 ++parameter. Those relationships will get loaded when the parameters populate_working_on_table and
1321 + do_prior_data_population are set to 1.
1322
1323 diff --git a/sci-biology/est2uni/files/mysql_fixes.sql b/sci-biology/est2uni/files/mysql_fixes.sql
1324 new file mode 100644
1325 index 0000000..ee3ec93
1326 --- /dev/null
1327 +++ b/sci-biology/est2uni/files/mysql_fixes.sql
1328 @@ -0,0 +1,3 @@
1329 +alter table db change kind kind enum('dna','pep') default null;
1330 +alter table db change blast_program blast_program enum('blastn', 'blastp', 'blastx', 'tblastn', 'tblastx') default null;
1331 +alter table db change rec_sim_type rec_sim_type enum('orthologue', 'synonymous') default null;
1332
1333 diff --git a/sci-biology/est2uni/files/pipe_db.pm.patch b/sci-biology/est2uni/files/pipe_db.pm.patch
1334 new file mode 100644
1335 index 0000000..139cf56
1336 --- /dev/null
1337 +++ b/sci-biology/est2uni/files/pipe_db.pm.patch
1338 @@ -0,0 +1,972 @@
1339 +--- pipe_db.pm.ori 2011-02-22 18:08:58.000000000 +0100
1340 ++++ pipe_db.pm 2011-02-22 14:48:03.000000000 +0100
1341 +@@ -90,29 +90,29 @@
1342 +
1343 + my $db=read_config($config,'db_path',''); #database in the form dbi:$dbi_driver:$db_name:$host
1344 + my $dbh=open_db($db) or (
1345 +- print localtime().": There was a problem opening the database $db: $DBI::errstr\n" and
1346 ++ print localtime().": There was a problem opening the database $db\n" and
1347 + return 0
1348 + ); #we open the database
1349 +
1350 + #the location statistics
1351 + my $st="INSERT INTO pssr_location_view SELECT CASE ((ssr_end<orf_begin)*1+(ssr_begin>orf_end)*2+(ssr_begin>orf_begin && ssr_end<orf_end)*3) WHEN 0 THEN 'other' WHEN 1 THEN '5_utr' WHEN 2 THEN '3_utr' WHEN 3 THEN 'in_orf' END AS location,count(*) AS count FROM ESTScan_orf,sputnik_ssr WHERE sputnik_ssr.seq_name=ESTScan_orf.seq_name GROUP BY (ssr_end<orf_begin)*1+(ssr_begin>orf_end)*2+(ssr_begin>orf_begin && ssr_end<orf_end)*3";
1352 + my $sth=prepare_st($dbh,$st) or (
1353 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1354 ++ print localtime().": There was a problem preparing the statement $st" and
1355 + return 0
1356 + );
1357 + execute_st($sth) or (
1358 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1359 ++ print localtime().": There was a problem executing the statement $st" and
1360 + return 0
1361 + );
1362 + close_st($sth);
1363 + #the unit kind statistics
1364 + $st="INSERT INTO pssr_kind_view SELECT unit,count(*) AS count FROM sputnik_ssr GROUP BY unit";
1365 + $sth=prepare_st($dbh,$st) or (
1366 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1367 ++ print localtime().": There was a problem preparing the statement $st" and
1368 + return 0
1369 + );
1370 + execute_st($sth) or (
1371 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1372 ++ print localtime().": There was a problem executing the statement $st" and
1373 + return 0
1374 + );
1375 + close_st($sth);
1376 +@@ -128,18 +128,18 @@
1377 +
1378 + my $db=read_config($config,'db_path',''); #database in the form dbi:$dbi_driver:$db_name:$host
1379 + my $dbh=open_db($db) or (
1380 +- print localtime().": There was a problem opening the database $db: $DBI::errstr\n" and
1381 ++ print localtime().": There was a problem opening the database $db\n" and
1382 + return 0
1383 + ); #we open the database
1384 +
1385 + #we calculate the min, max and average unigene length
1386 + my $st="SELECT MIN(length) AS min_seq_len, MAX(length) AS max_seq_len, AVG(length) AS avg_seq_len FROM sequence WHERE object_type='contig' OR object_type='singleton'";
1387 + my $sth=prepare_st($dbh,$st) or (
1388 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1389 ++ print localtime().": There was a problem preparing the statement $st" and
1390 + return 0
1391 + );
1392 + execute_st($sth) or (
1393 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1394 ++ print localtime().": There was a problem executing the statement $st" and
1395 + return 0
1396 + );
1397 + my $min;my $max;my $avg;
1398 +@@ -154,11 +154,11 @@
1399 + }
1400 + $st="INSERT unigene_structure_annotation_view (min_seq_len,max_seq_len,avg_seq_len) VALUES ($min,$max,$avg)";
1401 + $sth=prepare_st($dbh,$st) or (
1402 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1403 ++ print localtime().": There was a problem preparing the statement $st" and
1404 + return 0
1405 + );
1406 + execute_st($sth) or (
1407 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1408 ++ print localtime().": There was a problem executing the statement $st" and
1409 + return 0
1410 + );
1411 + close_st($sth);
1412 +@@ -173,20 +173,20 @@
1413 + #we calculate the min, max and average num ESTs per unigene
1414 + $st='CREATE TEMPORARY TABLE est_per_unigene SELECT count(*) AS num_est,unigene FROM est WHERE unigene IS NOT NULL GROUP BY unigene';
1415 + $sth=prepare_st($dbh,$st) or (
1416 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1417 ++ print localtime().": There was a problem preparing the statement $st" and
1418 + return 0
1419 + );
1420 + execute_st($sth) or (
1421 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1422 ++ print localtime().": There was a problem executing the statement $st" and
1423 + return 0
1424 + );
1425 + my $st='SELECT MAX(num_est) AS max_num_est, AVG(num_est) AS avg_num_est FROM est_per_unigene';
1426 + $sth=prepare_st($dbh,$st) or (
1427 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1428 ++ print localtime().": There was a problem preparing the statement $st" and
1429 + return 0
1430 + );
1431 + execute_st($sth) or (
1432 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1433 ++ print localtime().": There was a problem executing the statement $st" and
1434 + return 0
1435 + );
1436 + while (my @record=$sth->fetchrow_array){
1437 +@@ -196,11 +196,11 @@
1438 + close_st($sth);
1439 + $st="UPDATE unigene_structure_annotation_view SET max_est=$max,avg_est=$avg";
1440 + $sth=prepare_st($dbh,$st) or (
1441 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1442 ++ print localtime().": There was a problem preparing the statement $st" and
1443 + return 0
1444 + );
1445 + execute_st($sth) or (
1446 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1447 ++ print localtime().": There was a problem executing the statement $st" and
1448 + return 0
1449 + );
1450 + close_st($sth);
1451 +@@ -213,11 +213,11 @@
1452 + #now the annotated unigenes
1453 + my $st="SELECT COUNT(*) FROM sequence WHERE annotation IS NOT NULL AND (object_type='contig' OR object_type='singleton')";
1454 + $sth=prepare_st($dbh,$st) or (
1455 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1456 ++ print localtime().": There was a problem preparing the statement $st" and
1457 + return 0
1458 + );
1459 + execute_st($sth) or (
1460 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1461 ++ print localtime().": There was a problem executing the statement $st" and
1462 + return 0
1463 + );
1464 + my @record=$sth->fetchrow_array;
1465 +@@ -225,22 +225,22 @@
1466 + close_st($sth);
1467 + $st="UPDATE unigene_structure_annotation_view SET n_uni_with_annot=$n_annot";
1468 + $sth=prepare_st($dbh,$st) or (
1469 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1470 ++ print localtime().": There was a problem preparing the statement $st" and
1471 + return 0
1472 + );
1473 + execute_st($sth) or (
1474 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1475 ++ print localtime().": There was a problem executing the statement $st" and
1476 + return 0
1477 + );
1478 + close_st($sth);
1479 + #now the full len
1480 + my $st="SELECT COUNT(*) FROM sequence WHERE full_length IS NOT NULL AND (object_type='contig' OR object_type='singleton')";
1481 + $sth=prepare_st($dbh,$st) or (
1482 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1483 ++ print localtime().": There was a problem preparing the statement $st" and
1484 + return 0
1485 + );
1486 + execute_st($sth) or (
1487 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1488 ++ print localtime().": There was a problem executing the statement $st" and
1489 + return 0
1490 + );
1491 + @record=$sth->fetchrow_array;
1492 +@@ -248,11 +248,11 @@
1493 + close_st($sth);
1494 + $st="UPDATE unigene_structure_annotation_view SET n_uni_with_full_len=$n_annot";
1495 + $sth=prepare_st($dbh,$st) or (
1496 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1497 ++ print localtime().": There was a problem preparing the statement $st" and
1498 + return 0
1499 + );
1500 + execute_st($sth) or (
1501 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1502 ++ print localtime().": There was a problem executing the statement $st" and
1503 + return 0
1504 + );
1505 + close_st($sth);
1506 +@@ -263,14 +263,14 @@
1507 + my $dbh=shift;
1508 + my $values=shift;
1509 + my $sth=prepare_st($dbh,$st) or (
1510 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1511 ++ print localtime().": There was a problem preparing the statement $st" and
1512 + return 0
1513 + );
1514 + my $i=1;
1515 + foreach my $value (@$values){
1516 + $sth->bind_param($i,$value);
1517 + execute_st($sth) or (
1518 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1519 ++ print localtime().": There was a problem executing the statement $st" and
1520 + return 0
1521 + );
1522 + $i++;
1523 +@@ -282,7 +282,7 @@
1524 + my $dbh=shift;
1525 + my $intervals=shift;
1526 + my $sth=prepare_st($dbh,$st) or (
1527 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1528 ++ print localtime().": There was a problem preparing the statement $st" and
1529 + return 0
1530 + );
1531 + my $bottom;
1532 +@@ -293,7 +293,7 @@
1533 + $sth->bind_param(1,$bottom);
1534 + $sth->bind_param(2,$top);
1535 + execute_st($sth) or (
1536 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1537 ++ print localtime().": There was a problem executing the statement $st" and
1538 + return 0
1539 + );
1540 + my @record=$sth->fetchrow_array;
1541 +@@ -329,16 +329,16 @@
1542 +
1543 + my $db=read_config($config,'db_path',''); #database in the form dbi:$dbi_driver:$db_name:$host
1544 + my $dbh=open_db($db) or (
1545 +- print localtime().": There was a problem opening the database $db: $DBI::errstr\n" and
1546 ++ print localtime().": There was a problem opening the database $db\n" and
1547 + return 0
1548 + ); #we open the database
1549 + my $st="INSERT psnp_accessions_view (accession) SELECT DISTINCT accession FROM putative_snp_seq";
1550 + my $sth=prepare_st($dbh,$st) or (
1551 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1552 ++ print localtime().": There was a problem preparing the statement $st" and
1553 + return 0
1554 + );
1555 + execute_st($sth) or (
1556 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1557 ++ print localtime().": There was a problem executing the statement $st" and
1558 + return 0
1559 + );
1560 + close_st($sth);
1561 +@@ -354,26 +354,26 @@
1562 +
1563 + my $db=read_config($config,'db_path',''); #database in the form dbi:$dbi_driver:$db_name:$host
1564 + my $dbh=open_db($db) or (
1565 +- print localtime().": There was a problem opening the database $db: $DBI::errstr\n" and
1566 ++ print localtime().": There was a problem opening the database $db\n" and
1567 + return 0
1568 + ); #we open the database
1569 + my $st="CREATE TEMPORARY TABLE psnp_mutations_temp (nucleotides CHAR(10),is_snp BOOL,INDEX(nucleotides,is_snp)) SELECT GROUP_CONCAT(DISTINCT(putative_snp_seq.nucleotide) ORDER BY putative_snp_seq.nucleotide) AS nucleotides,putative_snp.is_snp FROM putative_snp_seq,putative_snp WHERE putative_snp_seq.psnp_id=putative_snp.psnp_id AND putative_snp_seq.nucleotide!='*' AND putative_snp.is_indel=0 GROUP BY putative_snp_seq.psnp_id";
1570 + my $sth=prepare_st($dbh,$st) or (
1571 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1572 ++ print localtime().": There was a problem preparing the statement $st" and
1573 + return 0
1574 + );
1575 + execute_st($sth) or (
1576 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1577 ++ print localtime().": There was a problem executing the statement $st" and
1578 + return 0
1579 + );
1580 + close_st($sth);
1581 + $st="INSERT INTO psnp_mutations_view (mutations,is_snp,count) SELECT nucleotides,is_snp,COUNT(*) AS count FROM psnp_mutations_temp WHERE LENGTH(nucleotides)=3 GROUP BY nucleotides,is_snp";
1582 + $sth=prepare_st($dbh,$st) or (
1583 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1584 ++ print localtime().": There was a problem preparing the statement $st" and
1585 + return 0
1586 + );
1587 + execute_st($sth) or (
1588 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1589 ++ print localtime().": There was a problem executing the statement $st" and
1590 + return 0
1591 + );
1592 + close_st($sth);
1593 +@@ -389,16 +389,16 @@
1594 +
1595 + my $db=read_config($config,'db_path',''); #database in the form dbi:$dbi_driver:$db_name:$host
1596 + my $dbh=open_db($db) or (
1597 +- print localtime().": There was a problem opening the database $db: $DBI::errstr\n" and
1598 ++ print localtime().": There was a problem opening the database $db\n" and
1599 + return 0
1600 + ); #we open the database
1601 + my $st="INSERT reciprocal_species_view (species,type) SELECT species,type FROM reciprocal_similar_sequences GROUP BY species";
1602 + my $sth=prepare_st($dbh,$st) or (
1603 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1604 ++ print localtime().": There was a problem preparing the statement $st" and
1605 + return 0
1606 + );
1607 + execute_st($sth) or (
1608 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1609 ++ print localtime().": There was a problem executing the statement $st" and
1610 + return 0
1611 + );
1612 + close_st($sth);
1613 +@@ -416,46 +416,46 @@
1614 +
1615 + my $db=read_config($config,'db_path',''); #database in the form dbi:$dbi_driver:$db_name:$host
1616 + my $dbh=open_db($db) or (
1617 +- print localtime().": There was a problem opening the database $db: $DBI::errstr\n" and
1618 ++ print localtime().": There was a problem opening the database $db\n" and
1619 + return 0
1620 + ); #we open the database
1621 + my $st="INSERT INTO go_uni_aspect_view (db,aspect,num_unigenes,word) SELECT go.db,go.aspect,count(DISTINCT go.seq_id) AS num_unigenes, CONCAT(go.aspect,go.db) AS word FROM clone,go,est WHERE est.clone=clone.name AND go.seq_id=est.unigene AND go.is_slim=1 GROUP BY word";
1622 + my $sth=prepare_st($dbh,$st) or (
1623 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1624 ++ print localtime().": There was a problem preparing the statement $st" and
1625 + return 0
1626 + );
1627 + execute_st($sth) or (
1628 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1629 ++ print localtime().": There was a problem executing the statement $st" and
1630 + return 0
1631 + );
1632 + close_st($sth);
1633 + $st="INSERT INTO go_uni_aspect_library_view (db,aspect,library,num_unigenes,word) SELECT go.db,go.aspect,clone.library,count(DISTINCT go.seq_id) AS num_unigenes, CONCAT(go.aspect,go.db,clone.library) AS word FROM clone,go,est WHERE est.clone=clone.name AND go.seq_id=est.unigene AND go.is_slim=1 GROUP BY word";
1634 + $sth=prepare_st($dbh,$st) or (
1635 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1636 ++ print localtime().": There was a problem preparing the statement $st" and
1637 + return 0
1638 + );
1639 + execute_st($sth) or (
1640 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1641 ++ print localtime().": There was a problem executing the statement $st" and
1642 + return 0
1643 + );
1644 + close_st($sth);
1645 + $st="INSERT INTO go_term_aspect_view (db,aspect,go_id,definition,num_go,word) SELECT db,go.aspect,go.go_id,definition,count(DISTINCT go.seq_id) AS num_go, CONCAT(go.go_id,go.aspect,db) AS word FROM go,go_def WHERE is_slim=1 AND go_def.go_id=go.go_id GROUP BY word";
1646 + $sth=prepare_st($dbh,$st) or (
1647 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1648 ++ print localtime().": There was a problem preparing the statement $st" and
1649 + return 0
1650 + );
1651 + execute_st($sth) or (
1652 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1653 ++ print localtime().": There was a problem executing the statement $st" and
1654 + return 0
1655 + );
1656 + close_st($sth);
1657 + $st="INSERT INTO go_term_aspect_library_view (db,aspect,go_id,definition,library,num_go,word) SELECT db,go.aspect,go.go_id,definition,clone.library,count(DISTINCT go.seq_id) AS num_go, CONCAT(go.go_id,go.aspect,db,clone.library) AS word FROM go,go_def,est,clone WHERE is_slim=1 AND go_def.go_id=go.go_id AND go.seq_id=est.unigene AND est.clone=clone.name GROUP BY word";
1658 + $sth=prepare_st($dbh,$st) or (
1659 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1660 ++ print localtime().": There was a problem preparing the statement $st" and
1661 + return 0
1662 + );
1663 + execute_st($sth) or (
1664 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1665 ++ print localtime().": There was a problem executing the statement $st" and
1666 + return 0
1667 + );
1668 + close_st($sth);
1669 +@@ -473,27 +473,27 @@
1670 +
1671 + my $db=read_config($config,'db_path',''); #database in the form dbi:$dbi_driver:$db_name:$host
1672 + my $dbh=open_db($db) or (
1673 +- print localtime().": There was a problem opening the database $db: $DBI::errstr\n" and
1674 ++ print localtime().": There was a problem opening the database $db\n" and
1675 + return 0
1676 + ); #we open the database
1677 + my $st="CREATE TEMPORARY TABLE super_count (INDEX(type)) SELECT superunigene,count(*)>1 AS type FROM superunigene GROUP BY superunigene";
1678 + my $sth=prepare_st($dbh,$st) or (
1679 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1680 ++ print localtime().": There was a problem preparing the statement $st" and
1681 + return 0
1682 + );
1683 + execute_st($sth) or (
1684 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1685 ++ print localtime().": There was a problem executing the statement $st" and
1686 + return 0
1687 + );
1688 + close_st($sth);
1689 +
1690 + $st="INSERT INTO superunigene_view (type,num_superunigenes) SELECT type,count(*) AS num_superunigenes FROM super_count GROUP BY type";
1691 + $sth=prepare_st($dbh,$st) or (
1692 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1693 ++ print localtime().": There was a problem preparing the statement $st" and
1694 + return 0
1695 + );
1696 + execute_st($sth) or (
1697 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1698 ++ print localtime().": There was a problem executing the statement $st" and
1699 + return 0
1700 + );
1701 + close_st($sth);
1702 +@@ -510,17 +510,17 @@
1703 +
1704 + my $db=read_config($config,'db_path',''); #database in the form dbi:$dbi_driver:$db_name:$host
1705 + my $dbh=open_db($db) or (
1706 +- print localtime().": There was a problem opening the database $db: $DBI::errstr\n" and
1707 ++ print localtime().": There was a problem opening the database $db\n" and
1708 + return 0
1709 + ); #we open the database
1710 +
1711 + my $st="INSERT INTO unigene_view (type,num_unigenes) SELECT object_type,count(*) AS num_unigenes FROM sequence WHERE object_type='contig' OR object_type='singleton' GROUP BY object_type";
1712 + my $sth=prepare_st($dbh,$st) or (
1713 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1714 ++ print localtime().": There was a problem preparing the statement $st" and
1715 + return 0
1716 + );
1717 + execute_st($sth) or (
1718 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1719 ++ print localtime().": There was a problem executing the statement $st" and
1720 + return 0
1721 + );
1722 + close_st($sth);
1723 +@@ -539,7 +539,7 @@
1724 + clean_tables($config,@table) or return 0;
1725 + my $db=read_config($config,'db_path',''); #database in the form dbi:$dbi_driver:$db_name:$host
1726 + my $dbh=open_db($db) or (
1727 +- print localtime().": There was a problem opening the database $db: $DBI::errstr\n" and
1728 ++ print localtime().": There was a problem opening the database $db\n" and
1729 + return 0
1730 + ); #we open the database
1731 +
1732 +@@ -547,11 +547,11 @@
1733 + #clones per library
1734 + my $st="SELECT clone.library,COUNT(distinct clone.name) AS num_clones FROM clone GROUP BY clone.library";
1735 + my $sth=prepare_st($dbh,$st) or (
1736 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1737 ++ print localtime().": There was a problem preparing the statement $st" and
1738 + return 0
1739 + );
1740 + execute_st($sth) or (
1741 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1742 ++ print localtime().": There was a problem executing the statement $st" and
1743 + return 0
1744 + );
1745 + my %clones;
1746 +@@ -563,11 +563,11 @@
1747 + #raw_est per library
1748 + $st="SELECT clone.library,COUNT(*) AS num_raw_est FROM est,clone WHERE est.clone=clone.name AND raw_seq IS NOT NULL GROUP BY clone.library";
1749 + $sth=prepare_st($dbh,$st) or (
1750 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1751 ++ print localtime().": There was a problem preparing the statement $st" and
1752 + return 0
1753 + );
1754 + execute_st($sth) or (
1755 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1756 ++ print localtime().": There was a problem executing the statement $st" and
1757 + return 0
1758 + );
1759 + my %raw_est;
1760 +@@ -579,11 +579,11 @@
1761 + #clean_est per library
1762 + $st='SELECT clone.library,COUNT(*) AS num_clean_est,AVG(sequence.length) AS mean_length,STD(sequence.length) AS std_dev FROM est,sequence,clone WHERE est.processed_seq=sequence.name AND est.clone=clone.name GROUP BY clone.library;';
1763 + $sth=prepare_st($dbh,$st) or (
1764 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1765 ++ print localtime().": There was a problem preparing the statement $st" and
1766 + return 0
1767 + );
1768 + execute_st($sth) or (
1769 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1770 ++ print localtime().": There was a problem executing the statement $st" and
1771 + return 0
1772 + );
1773 + my %clean_est;
1774 +@@ -599,11 +599,11 @@
1775 + #singletons per library
1776 + $st="SELECT clone.library,COUNT(distinct sequence.name) AS num_singletons FROM clone,sequence,est WHERE sequence.name=est.unigene AND est.clone=clone.name AND sequence.object_type='singleton' GROUP BY clone.library";
1777 + $sth=prepare_st($dbh,$st) or (
1778 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1779 ++ print localtime().": There was a problem preparing the statement $st" and
1780 + return 0
1781 + );
1782 + execute_st($sth) or (
1783 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1784 ++ print localtime().": There was a problem executing the statement $st" and
1785 + return 0
1786 + );
1787 + my %singletons;
1788 +@@ -615,11 +615,11 @@
1789 + #contigs per library
1790 + $st="SELECT clone.library,COUNT(distinct sequence.name) AS num_contigs FROM clone,sequence,est WHERE sequence.name=est.unigene AND est.clone=clone.name AND sequence.object_type='contig' GROUP BY clone.library";
1791 + $sth=prepare_st($dbh,$st) or (
1792 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1793 ++ print localtime().": There was a problem preparing the statement $st" and
1794 + return 0
1795 + );
1796 + execute_st($sth) or (
1797 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1798 ++ print localtime().": There was a problem executing the statement $st" and
1799 + return 0
1800 + );
1801 + my %contigs;
1802 +@@ -631,11 +631,11 @@
1803 + #unigenes per library
1804 + $st="SELECT clone.library,COUNT(distinct unigene) AS num_unigenes FROM est,clone WHERE est.clone=clone.name GROUP BY clone.library";
1805 + $sth=prepare_st($dbh,$st) or (
1806 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1807 ++ print localtime().": There was a problem preparing the statement $st" and
1808 + return 0
1809 + );
1810 + execute_st($sth) or (
1811 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1812 ++ print localtime().": There was a problem executing the statement $st" and
1813 + return 0
1814 + );
1815 + my %unigenes;
1816 +@@ -647,11 +647,11 @@
1817 + #full length per library
1818 + $st="SELECT clone.library,COUNT(distinct sequence.name) AS num_full_len FROM clone,sequence,est WHERE sequence.name=est.unigene AND est.clone=clone.name AND sequence.full_length IS NOT NULL GROUP BY clone.library";
1819 + $sth=prepare_st($dbh,$st) or (
1820 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1821 ++ print localtime().": There was a problem preparing the statement $st" and
1822 + return 0
1823 + );
1824 + execute_st($sth) or (
1825 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1826 ++ print localtime().": There was a problem executing the statement $st" and
1827 + return 0
1828 + );
1829 + my %full_len;
1830 +@@ -663,21 +663,21 @@
1831 + #spec unigenes length per library
1832 + $st="CREATE TEMPORARY TABLE uni_library_count (PRIMARY KEY(name), INDEX (num_lib))SELECT sequence.name, COUNT(DISTINCT clone.library) AS num_lib, clone.library AS lib_concat FROM sequence,est,clone WHERE sequence.name=est.unigene AND est.clone=clone.name GROUP BY sequence.name";
1833 + $sth=prepare_st($dbh,$st) or (
1834 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1835 ++ print localtime().": There was a problem preparing the statement $st" and
1836 + return 0
1837 + );
1838 + execute_st($sth) or (
1839 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1840 ++ print localtime().": There was a problem executing the statement $st" and
1841 + return 0
1842 + );
1843 + close_st($sth);
1844 + $st="SELECT lib_concat as library,COUNT(*) AS num_unigenes_ex FROM uni_library_count WHERE num_lib=1 GROUP BY lib_concat";
1845 + $sth=prepare_st($dbh,$st) or (
1846 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1847 ++ print localtime().": There was a problem preparing the statement $st" and
1848 + return 0
1849 + );
1850 + execute_st($sth) or (
1851 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1852 ++ print localtime().": There was a problem executing the statement $st" and
1853 + return 0
1854 + );
1855 + my %spec_unigenes;
1856 +@@ -689,21 +689,21 @@
1857 + #spec contigs per library
1858 + $st="CREATE TEMPORARY TABLE contig_library_count (PRIMARY KEY(name), INDEX (num_lib))SELECT sequence.name, COUNT(DISTINCT clone.library) AS num_lib, clone.library AS lib_concat FROM sequence,est,clone WHERE sequence.name=est.unigene AND est.clone=clone.name AND sequence.object_type='contig' GROUP BY sequence.name";
1859 + $sth=prepare_st($dbh,$st) or (
1860 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1861 ++ print localtime().": There was a problem preparing the statement $st" and
1862 + return 0
1863 + );
1864 + execute_st($sth) or (
1865 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1866 ++ print localtime().": There was a problem executing the statement $st" and
1867 + return 0
1868 + );
1869 + close_st($sth);
1870 + $st="SELECT lib_concat as library,COUNT(*) AS num_contigs_ex FROM contig_library_count WHERE num_lib=1 GROUP BY lib_concat";
1871 + $sth=prepare_st($dbh,$st) or (
1872 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1873 ++ print localtime().": There was a problem preparing the statement $st" and
1874 + return 0
1875 + );
1876 + execute_st($sth) or (
1877 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1878 ++ print localtime().": There was a problem executing the statement $st" and
1879 + return 0
1880 + );
1881 + my %spec_contigs;
1882 +@@ -715,21 +715,21 @@
1883 + #spec singletons per library
1884 + $st="CREATE TEMPORARY TABLE singleton_library_count (PRIMARY KEY(name), INDEX (num_lib))SELECT sequence.name, COUNT(DISTINCT clone.library) AS num_lib, clone.library AS lib_concat FROM sequence,est,clone WHERE sequence.name=est.unigene AND est.clone=clone.name AND sequence.object_type='singleton' GROUP BY sequence.name";
1885 + $sth=prepare_st($dbh,$st) or (
1886 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1887 ++ print localtime().": There was a problem preparing the statement $st" and
1888 + return 0
1889 + );
1890 + execute_st($sth) or (
1891 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1892 ++ print localtime().": There was a problem executing the statement $st" and
1893 + return 0
1894 + );
1895 + close_st($sth);
1896 + $st="SELECT lib_concat as library,COUNT(*) AS num_singletons_ex FROM singleton_library_count WHERE num_lib=1 GROUP BY lib_concat";
1897 + $sth=prepare_st($dbh,$st) or (
1898 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1899 ++ print localtime().": There was a problem preparing the statement $st" and
1900 + return 0
1901 + );
1902 + execute_st($sth) or (
1903 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1904 ++ print localtime().": There was a problem executing the statement $st" and
1905 + return 0
1906 + );
1907 + my %spec_singletons;
1908 +@@ -742,7 +742,7 @@
1909 + #now we have all the data and we should store it in the view
1910 + $st="INSERT INTO library_view (library, num_clones, num_raw_est, num_clean_est, num_singletons, num_contigs, num_unigenes, num_full_len, num_spec_singletons, num_spec_contigs, num_spec_unigenes,avg_est_len,std_est_len) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
1911 + $sth=prepare_st($dbh,$st) or (
1912 +- print localtime().": There was a problem preparing the statement $st: $DBI::errstr\n" and
1913 ++ print localtime().": There was a problem preparing the statement $st" and
1914 + return 0
1915 + );
1916 + foreach my $lib (keys(%libraries)){
1917 +@@ -760,7 +760,7 @@
1918 + $sth->bind_param(12,$avg_est_len{$lib});
1919 + $sth->bind_param(13,$std_est_len{$lib});
1920 + execute_st($sth) or (
1921 +- print localtime().": There was a problem executing the statement $st: $DBI::errstr\n" and
1922 ++ print localtime().": There was a problem executing the statement $st" and
1923 + return 0
1924 + );
1925 + }
1926 +@@ -776,12 +776,12 @@
1927 + my $config=shift;
1928 + my $dir = $$config{'chromat_dir'};
1929 + opendir DIR,$dir or (
1930 +- print localtime().": It was not possible to open the chromat directory $dir: $!\n" and
1931 ++ print localtime().": It was not possible to open the chromat directory: $dir\n" and
1932 + return 0
1933 + );
1934 + my @libraries = grep {/^[^\.]/} readdir(DIR);
1935 + if (!$libraries[0]){
1936 +- print localtime().": No libraries found in the libraries directory $dir: $!\n";
1937 ++ print localtime().": No libraries found in the libraries directory: $dir\n";
1938 + return 0;
1939 + }
1940 + close DIR;
1941 +@@ -791,18 +791,18 @@
1942 + my $db=read_config($config,'db_path','');
1943 + my $dbh=open_db($db);
1944 + unless ($dbh) {
1945 +- print localtime().": Database $dbh is not reachable: $DBI::errstr\n";
1946 ++ print localtime().": Database $dbh is not reachable\n";
1947 + return 0;
1948 + }
1949 + my $sth=prepare_st($dbh,$st) or (
1950 +- print localtime().": Unable to prepare statement: $st: $DBI::errstr\n" and
1951 ++ print localtime().": Unable to prepare statement: $st\n" and
1952 + return 0
1953 + );
1954 + foreach my $lib (@libraries){
1955 + $sth->bind_param(1,$lib);
1956 + $sth->execute() or (
1957 + print localtime().": There was a problem executing the statement:\n" and
1958 +- print localtime().": $st: : $DBI::errstr\n" and
1959 ++ print localtime().": $st:\n" and
1960 + print localtime().": with the library $lib:\n" and
1961 + return 0
1962 + );
1963 +@@ -818,7 +818,7 @@
1964 + my $db=read_config($config,'db_path','');
1965 + my $dbh; my $sth; #database and statements handlers
1966 + $dbh=open_db($db) or (
1967 +- print localtime().": There was a problem opening the database $db: $DBI::errstr\n" and
1968 ++ print localtime().": There was a problem opening the database $db\n" and
1969 + return 0
1970 + ); #we open the database
1971 + my $st="SELECT UNCOMPRESS(COMPRESS('holacaracola'))='holacaracola'";
1972 +@@ -841,7 +841,7 @@
1973 + if ($version){return $version}
1974 + my $dbh; my $sth; #database and statements handlers
1975 + $dbh=open_db($db) or (
1976 +- print localtime().": There was a problem opening the database $db: $DBI::errstr\n" and
1977 ++ print localtime().": There was a problem opening the database $db\n" and
1978 + return 0
1979 + ); #we open the database
1980 + $version=$dbh->get_info(18);
1981 +@@ -924,11 +924,11 @@
1982 + if (!$only_clean){ #nothing more to do because we just should clean
1983 + if (-r $file){
1984 + put_csv_into_db($config,$file,$table) or (
1985 +- print localtime().": There was a problem populating the table $table with file $file\n" and
1986 ++ print localtime().": There was a problem populating the table $table with file $file: $!\n" and
1987 + return 0
1988 + );
1989 + }else{
1990 +- print localtime().": WARNING no database file found, it should be $file\n";
1991 ++ print localtime().": WARNING no database file found, it should be $file: $!\n";
1992 + return 0;
1993 + }
1994 + }
1995 +@@ -945,11 +945,11 @@
1996 + if (!$only_clean){ #nothing more to do because we just should clean
1997 + if (-r $file){
1998 + put_csv_into_db($config,$file,$table) or (
1999 +- print localtime().": There was a problem populating the table $table with file $file\n" and
2000 ++ print localtime().": There was a problem populating the table $table with file $file: $!\n" and
2001 + return 0
2002 + );
2003 + }else{
2004 +- print localtime().": WARNING no working on file found, it should be $file\n";
2005 ++ print localtime().": WARNING no working_on_dat file found, it should be $file: $!\n";
2006 + return 0;
2007 + }
2008 + }
2009 +@@ -966,11 +966,11 @@
2010 + if (!$only_clean){ #nothing more to do because we just should clean
2011 + if (-r $file){
2012 + put_csv_into_db($config,$file,$table) or (
2013 +- print localtime().": There was a problem populating the table $table with file $file\n" and
2014 ++ print localtime().": There was a problem populating the table $table with file $file: $!\n" and
2015 + return 0
2016 + );
2017 + }else{
2018 +- print localtime().": WARNING no researcher file found, it should be $file\n";
2019 ++ print localtime().": WARNING no researcher file found, it should be $file: $!\n";
2020 + return 0;
2021 + }
2022 + }
2023 +@@ -987,11 +987,11 @@
2024 + if (!$only_clean){ #nothing more to do because we just should clean
2025 + if (-r $file){
2026 + put_csv_into_db($config,$file,$table) or (
2027 +- print localtime().": There was a problem populating the table $table with file $file\n" and
2028 ++ print localtime().": There was a problem populating the table $table with file $file: $!\n" and
2029 + return 0
2030 + );
2031 + }else{
2032 +- print localtime().": WARNING no marker-EST file found, it should be $file\n";
2033 ++ print localtime().": WARNING no marker-EST file found, it should be $file: $!\n";
2034 + return 0;
2035 + }
2036 + }
2037 +@@ -1026,11 +1026,11 @@
2038 + my $table = 'microarray_extract';
2039 + if (-r $file){
2040 + put_csv_into_db($config,$file,$table) or (
2041 +- print localtime().": There was a problem populating the table $table with file $file\n" and
2042 ++ print localtime().": There was a problem populating the table $table with file $file: $!\n" and
2043 + return 0
2044 + );
2045 + }else{
2046 +- print localtime().": WARNING no extracts file found, it should be $file\n";
2047 ++ print localtime().": WARNING no extracts file found, it should be $file: $!\n";
2048 + return 0;
2049 + }
2050 + #loading extract mixes
2051 +@@ -1038,11 +1038,11 @@
2052 + my $table = 'microarray_extract_mix';
2053 + if (-r $file){
2054 + put_csv_into_db($config,$file,$table) or (
2055 +- print localtime().": There was a problem populating the table $table with file $file\n" and
2056 ++ print localtime().": There was a problem populating the table $table with file $file: $!\n" and
2057 + return 0
2058 + );
2059 + }else{
2060 +- print localtime().": WARNING no extract mixes file found, it should be $file\n";
2061 ++ print localtime().": WARNING no extract mixes file found, it should be $file: $!\n";
2062 + return 0;
2063 + }
2064 + #loading the hybridizations
2065 +@@ -1050,18 +1050,18 @@
2066 + my $table = 'microarray_hybridization';
2067 + if (-r $file){
2068 + put_csv_into_db($config,$file,$table) or (
2069 +- print localtime().": There was a problem populating the table $table with file $file\n" and
2070 ++ print localtime().": There was a problem populating the table $table with file $file: $!\n" and
2071 + return 0
2072 + );
2073 + }else{
2074 +- print localtime().": WARNING no hybridizations file found, it should be $file\n";
2075 ++ print localtime().": WARNING no hybridizations file found, it should be $file: $!\n";
2076 + return 0;
2077 + }
2078 + my $file = read_config($config,'microarray_normalized_dat','');
2079 + my $table = 'microarray_normalized_expression';
2080 + if (-r $file){
2081 + open IN,"<$file" or (
2082 +- print localtime().": Imposible to open file: $file\n" and
2083 ++ print localtime().": Imposible to open file: $file: $!\n" and
2084 + return 0
2085 + );
2086 +
2087 +@@ -1099,15 +1099,15 @@
2088 + $sth->bind_param(4,$cv);
2089 + $i_hyb++;
2090 + $sth->execute or (
2091 +- print localtime().": Unable to execute stament: $st: $DBI::errstr\n" and
2092 +- print localtime().": With line: $line\n" and
2093 ++ print localtime().": Unable to execute stament: $st\n" and
2094 ++ print localtime().": With line: $line: $DBI::errstr\n" and
2095 + return 0
2096 + );
2097 + }
2098 + }
2099 + close IN;
2100 + }else{
2101 +- print localtime().": WARNING no normalized expression file found, it should be $file\n";
2102 ++ print localtime().": WARNING no normalized expression file found, it should be $file: $!\n";
2103 + return 0;
2104 + }
2105 +
2106 +@@ -1179,7 +1179,7 @@
2107 + #print $contents{$table},"\n";
2108 + create_table($db,$table,$contents{$table}) or $ok=0;
2109 + unless ($ok){
2110 +- print localtime().": Annotation table: $table from $db can't be created\n";
2111 ++ print localtime().": Annotation table: $table from $db can't be created: $DBI::errstr\n";
2112 + }
2113 + }
2114 + }
2115 +@@ -1200,7 +1200,7 @@
2116 + #if the table exist is removed
2117 + if (check_table($db,$table)) {drop_table($db,$table) or $ok=0}
2118 + unless ($ok){
2119 +- print localtime().": Annotation table: $table from $db can't be dropped\n";
2120 ++ print localtime().": Annotation table: $table from $db can't be dropped: $DBI::errstr\n";
2121 + }
2122 + }
2123 + }
2124 +@@ -1220,7 +1220,7 @@
2125 + my $db=read_config($config,'db_path','');
2126 +
2127 + open IN,"<$file" or (
2128 +- print localtime().": Imposible to open file $file: $!\n" and
2129 ++ print localtime().": Imposible to open file: $file: $!\n" and
2130 + return 0
2131 + );
2132 +
2133 +@@ -1235,10 +1235,13 @@
2134 + return 0;
2135 + }
2136 + my $sth=prepare_st($dbh,$st) or (
2137 +- print localtime().": Unable to prepare statement $st: $DBI::errstr\n" and
2138 ++ print localtime().": Unable to prepare statement: $st: $DBI::errstr\n" and
2139 + return 0
2140 + );
2141 + while ($line = <IN>){
2142 ++ if ($line =~ /^#/) {
2143 ++ next;
2144 ++ }
2145 + chomp ($line);
2146 + $line =~ s/"//g;
2147 + my @fields=split (',',$line);
2148 +@@ -1248,8 +1251,8 @@
2149 + $i++;
2150 + }
2151 + $sth->execute or (
2152 +- print localtime().": Unable to execute stament $st: $DBI::errstr\n" and
2153 +- print localtime().": With line: $line\n" and
2154 ++ print localtime().": Unable to execute stament: $st\n" and
2155 ++ print localtime().": With line: $line: $DBI::errstr\n" and
2156 + return 0
2157 + );
2158 + }
2159 +@@ -1312,7 +1315,7 @@
2160 + #here we read all the db structure, the table fields and contigs
2161 + my %db_structure=read_db_structure ($db_structure_file,$config);
2162 + unless (%db_structure) {
2163 +- print localtime().": There was a problem reading the database definition from file $db_structure_file: $!\n";
2164 ++ print localtime().": There was a problem reading the database definition from file: $db_structure_file";
2165 + return 0;
2166 + }
2167 + #the table is regenerated
2168 +@@ -1351,12 +1354,14 @@
2169 + #Here we check that the database is reachable and has all the necesary tables
2170 + $ok=check_db_structure($db_path,%db_structure);
2171 + }
2172 +- #print_db_structure(%db_structure);
2173 ++ if (!$ok) {
2174 ++ print_db_structure(%db_structure);
2175 ++ }
2176 + return $ok;
2177 + }
2178 +
2179 + #Here we check that the database is reachable and has all the necesary tables
2180 +-#this is not enough becouse fields should be checked too, so TODO
2181 ++#this is not enough because fields should be checked too, so TODO
2182 + #(although not a very important thing anyway)
2183 + sub check_db_structure($\%) {
2184 + my $db=shift;
2185 +@@ -1375,6 +1380,8 @@
2186 + }
2187 + }
2188 + }
2189 ++ } else {
2190 ++ $ok=0;
2191 + }
2192 + if ($ok) {
2193 + print localtime().": Database structure seems ok\n";
2194 +@@ -1422,7 +1429,7 @@
2195 + print localtime().": Connection to the database server $db_path_no_name has failed: $DBI::errstr\n";
2196 + return 0;
2197 + }
2198 +- #Now we check if db exists and if does is dropped
2199 ++ #Now we check if db exists and if it does it is dropped
2200 + if(db_ok($db_path)){
2201 + #database exits, we should remove it
2202 + if(drop_db($db_path,$db_name)) {
2203 +@@ -1458,13 +1465,23 @@
2204 + sub populate_db ($\%) {
2205 + my $db=shift;
2206 + my $tables=shift;
2207 ++ my %t = %$tables;
2208 + my $ok=1;
2209 +
2210 ++ print "populate_db called with db=$db, tables=$tables\n";
2211 ++ #foreach my $table(keys(%t)) {
2212 ++ # print "table=$table, $t{$table}\n";
2213 ++ #}
2214 ++
2215 + my $table;
2216 + foreach $table(keys %$tables) {
2217 + if ($ok) {
2218 +- $ok=create_table($db,$table,${%{$tables}}{$table});
2219 ++ $ok=create_table($db,$table,$t{$table}); # avoid Can't use string ("38/64") as a HASH ref while "strict refs" in use at /opt/est2uni/pipe_db.pm line 1477.
2220 ++ if ($ok) {
2221 + print localtime().": Table $table created\n";
2222 ++ } else {
2223 ++ print localtime().": Table $table could not be created under dsn=$db: $DBI::errstr\n";
2224 ++ }
2225 + }
2226 + }
2227 + return $ok;
2228 +@@ -1476,7 +1493,7 @@
2229 + my $db=shift;
2230 + my $table_name=shift;
2231 + my $table_content=shift; #table content in sql format
2232 +- #first we check that the database is avaliable
2233 ++ #first we check that the database is available
2234 + my $ok=1;
2235 + unless (db_ok($db)) {
2236 + print localtime().": Something went wrong checking database: $db\n";
2237 +@@ -1488,9 +1505,13 @@
2238 + my $st="CREATE TABLE $table_name ($table_content);";
2239 + if($ok) {
2240 + $sth=prepare_st($dbh,$st) or $ok=0;
2241 ++ } else {
2242 ++ print localtime().": There was a problem preparing a statement: $DBI::errstr\n";
2243 + }
2244 + if ($ok) {
2245 + execute_st($sth) or $ok=0;
2246 ++ } else {
2247 ++ print localtime().": There was a problem executing a statement: $DBI::errstr\n";
2248 + }
2249 + #print $table;
2250 + $sth->finish();
2251 +@@ -1533,17 +1554,13 @@
2252 + #needs a db handler
2253 + sub close_db ($) {
2254 + my $dbh=shift;
2255 +- if ($dbh){
2256 +- $dbh->disconnect() or print localtime().": Cannot disconnect from database: $DBI::errstr\n";
2257 +- }
2258 ++ if ($dbh){$dbh->disconnect();}
2259 + }
2260 +
2261 + #needs a statement handler
2262 + sub close_st ($) {
2263 + my $sth=shift;
2264 +- if ($sth){
2265 +- $sth->finish() or print localtime().": Cannot finish execution over database: $DBI::errstr\n";
2266 +- }
2267 ++ if ($sth){$sth->finish();}
2268 + }
2269 +
2270 +
2271 +@@ -1563,9 +1580,7 @@
2272 + }
2273 + }
2274 +
2275 +- if ($dbh){
2276 +- $dbh->disconnect() or print localtime().": Cannot disconnect from database: $DBI::errstr\n";
2277 +- }
2278 ++ if ($dbh){$dbh->disconnect();}
2279 + return $ok;
2280 + }
2281 +
2282 +@@ -1581,9 +1596,7 @@
2283 + else {
2284 + $ok=0;
2285 + }
2286 +- if ($dbh){
2287 +- $dbh->disconnect() or print localtime().": Cannot disconnect from database: $DBI::errstr\n";
2288 +- }
2289 ++ if ($dbh){$dbh->disconnect();}
2290 + return $ok;
2291 + }
2292 +
2293 +@@ -1594,7 +1607,7 @@
2294 + my $ok=1;
2295 + #is the database to remove ok?
2296 + unless (db_ok($db)) {
2297 +- print localtime().": Something went wrong checking database $db: $DBI::errstr\n";
2298 ++ print localtime().": Something went wrong checking database: $db: $DBI::errstr\n";
2299 + $ok=0;
2300 + }
2301 + #we should open it
2302 +@@ -1619,7 +1632,7 @@
2303 + }
2304 + }
2305 + if ($ok) {$sth->finish();}
2306 +- if ($dbh){$dbh->disconnect() or print localtime().": Cannot disconnect from database: $DBI::errstr\n";}
2307 ++ if ($dbh){$dbh->disconnect();}
2308 + return $ok;
2309 + }
2310 +
2311
2312 diff --git a/sci-biology/est2uni/files/tables.sql.patch b/sci-biology/est2uni/files/tables.sql.patch
2313 new file mode 100644
2314 index 0000000..3a83de8
2315 --- /dev/null
2316 +++ b/sci-biology/est2uni/files/tables.sql.patch
2317 @@ -0,0 +1,23 @@
2318 +--- tables.sql.ori 2011-02-22 10:53:26.000000000 +0100
2319 ++++ tables.sql 2011-02-22 16:15:11.000000000 +0100
2320 +@@ -576,15 +576,15 @@
2321 + long_name CHAR(100),
2322 + version CHAR(40),
2323 + local_blast_name CHAR(100),
2324 +- blast_program CHAR(7),
2325 +- repository CHAR(100),
2326 +- web_site CHAR(100),
2327 +- kind CHAR(40),
2328 ++ blast_program ENUM('blastn', 'blastp', 'blastx', 'tblastn', 'tblastx'),
2329 ++ repository CHAR(255),
2330 ++ web_site CHAR(255),
2331 ++ kind ENUM('dna','pep'),
2332 + go_annot_format CHAR(40),
2333 + link_pre CHAR(200),
2334 + link_post CHAR(200),
2335 + local_hmmer_name CHAR(40),
2336 +- rec_sim_type CHAR(40),
2337 ++ rec_sim_type ENUM('', 'orthologue', 'synonymous'),
2338 + rec_sim_evalue CHAR(40),
2339 + orthologues_arabi_hack CHAR(1),
2340 + local_go_assoc_file CHAR(200),