Commit bbf0ef5765e6cc205108b61dd2dfbf0d0a0e6137

Authored by Luis Arturo Medrano-Soto
1 parent 68b41f16a3
Exists in master

Added the ability to generate a tsv file as output for easy parsing

Showing 1 changed file with 13 additions and 3 deletions Side-by-side Diff

alignSeqsFiles.pl View file @ bbf0ef5
... ... @@ -157,8 +157,10 @@
157 157  
158 158 #Prepare output files
159 159 my $htmlFile = "$outdir/report.html";
  160 + my $tsvFile = "$outdir/report.tsv";
160 161 my $plotsFile = "$outdir/plots.html";
161 162  
  163 + my $tsvHeader = "#Query\tSubject\tQlen\tSlen\tE-value\tIdentity\tQstart\tQend\tQcov\tSstart\tSend\tScov\tQseq\tSseq\n";
162 164  
163 165 my $htmlHeader = <<HEADER;
164 166 <!DOCTYPE html>
... ... @@ -231,6 +233,9 @@
231 233 HEADER
232 234  
233 235  
  236 + open (my $tsvh, ">", $tsvFile) || die $!;
  237 + print $tsvh $tsvHeader;
  238 +
234 239 open (my $outh, ">", $htmlFile) || die $!;
235 240 print $outh $htmlHeader;
236 241  
... ... @@ -299,6 +304,7 @@
299 304  
300 305 print $outh $alnHit;
301 306  
  307 + print $tsvh "$qacc\t$sacc\t$qlen\t$slen\t$eval\t$id\t$qstart\t$qend\t$qcov\t$sstart\t$send\t$scov\t$qseq\t$sseq\n";
302 308  
303 309 #Generate the hydropathy plots
304 310 my $good = run_quod($qacc, $sacc, $qstart, $qend, $sstart, $send, $qseq, $sseq);
... ... @@ -355,6 +361,7 @@
355 361 print $outh $closeRep;
356 362  
357 363 close $outh;
  364 + close $tsvh;
358 365 }
359 366  
360 367  
361 368  
362 369  
... ... @@ -471,10 +478,13 @@
471 478 print $sfh ">$s alignment\n$sseq\n";
472 479 close $sfh;
473 480  
  481 + my $labelsStr = "--axis-font 18.0 --tick-font 15.0 --title-font 20.0 --xlabel Residues --ylabel Hydropathy --width 15 --xticks 25";
  482 + my $ylimStr = "--ylim -3 3";
474 483  
  484 +
475 485 #Note alnquod requires to add the extension to the image name
476 486 my $alnFig = "$plotsDir/${q}_vs_${s}_qs${qs}_qe${qe}_ss${ss}_se${se}.png";
477   - my $cmd1 = qq(quod.py -q -l "$q (red) and $s (blue)" -o $alnFig --xticks 25 --width 15 --edgecolor +0:red +1:blue --facecolor +0:orange +1:cyan --multi frag -- $qalnFile $seqDir/${q}.faa $salnFile $seqDir/${s}.faa);
  487 + my $cmd1 = qq(quod.py -q $labelsStr -l "$q (red) and $s (blue)" -o $alnFig $ylimStr --edgecolor +0:red +1:blue --facecolor +0:orange +1:cyan --multi frag -- $qalnFile $seqDir/${q}.faa $salnFile $seqDir/${s}.faa);
478 488 # print "$cmd1\n\n";
479 489 # exit;
480 490 system $cmd1 unless (-f "${alnFig}");
... ... @@ -496,7 +506,7 @@
496 506 #Plot query hydropathy
497 507 my $qPfam = get_pfam_coords_for_quod($q, "red");
498 508 my $qName = "$plotsDir/${q}_vs_${s}_qaln_qs${qs}_qe${qe}.png";
499   - my $cmd2 = qq(quod.py -q -l "$q" -o $qName --width 15 --edgecolor red --xticks 25 -w ${qs}-${qe}:+2.7:+:Alignment --no-tms +0 $qTMS $qPfam -- $seqDir/${q}.faa);
  509 + my $cmd2 = qq(quod.py -q $labelsStr -l "$q" -o $qName --edgecolor red $ylimStr -w ${qs}-${qe}:+2.7:+:Alignment --no-tms +0 $qTMS $qPfam -- $seqDir/${q}.faa);
500 510 # print "$cmd2\n\n";
501 511 # exit;
502 512 system $cmd2 unless (-f $qName);
... ... @@ -514,7 +524,7 @@
514 524 #Plot Subject hydropaty
515 525 my $sPfam = get_pfam_coords_for_quod($s, "blue");
516 526 my $sName = "$plotsDir/${q}_vs_${s}_saln_ss${ss}_se${se}.png";
517   - my $cmd3 = qq(quod.py -q -l "$s" -o $sName --width 15 --edgecolor blue --xticks 25 -w ${ss}-${se}:+2.7:+:Alignment --no-tms +0 $sTMS $sPfam -- $seqDir/${s}.faa);
  527 + my $cmd3 = qq(quod.py -q $labelsStr -l "$s" -o $sName --edgecolor blue $ylimStr -w ${ss}-${se}:+2.7:+:Alignment --no-tms +0 $sTMS $sPfam -- $seqDir/${s}.faa);
518 528 # print "$cmd3\n\n";
519 529 # exit;
520 530 system $cmd3 unless (-f $sName);