#!/usr/bin/perl -w #Markus Westphal 25.01.2006 ###################################################### # Markus Westphal auswblast4blocks.pl # ###################################################### use strict; my($pf,$j,$i,$datei,$erg,$record,@record,$eval,$round,$notf,@notf,$leer,$count,$idoben,$idunten); $i = 1; #globale Variabeln füllen $datei = "pax6.psiblast"; $i = 0; $round = 1; $count = 0; #EINLESEN Dateinamen Blastergebnis for($j = -1; $j < $#ARGV; $j++) { if($ARGV[$j] =~ /^datei/) { ($pf, $datei) = split("=", $ARGV[$j]); } } #AUSGABEDATEI open(TF, ">psiblasteval_1.txt") || die ("Die Ausgabedatei 1 kann nicht erstellt werden!\n"); open(TF2, ">psiblasteval_2.txt") || die ("Die Ausgabedatei 2 kann nicht erstellt werden!\n"); open(NF, ">psiblastnfc.txt") || die ("Die Ausgabedatei 3 kann nicht erstellt werden!\n"); #EINLESEN open(DT,"<$datei") || die ("$datei kann nicht geoeffnet werden!"); $/ = "Results from round"; while(
) { if($_ =~ /^ \d+/) { &check($_); } } close(DT); #FUNKTIONEN sub check() { my($record) = @_; $count = 0; if($round == 1) { $record =~ /\s+\d+.*\(bits\) Value\n\n(.*)\n\n/s; $erg = $1; } else { $record =~ /\s+\d+.*Sequences used in model and found again:\n\n(.*)\n\nSequences not found previously or not previously below threshold:\n\n(.*)\n\n/s; $erg = $1; $notf = $2; if($notf =~ /CONVERGED!/im) { print NF "$round 0\n"; } else { @notf = split("\n", $notf); $count = $#notf+1; print NF "$round $count\n"; } } @record = split("\n",$erg); if($round == 1) { $record[0] =~ /(\w+).*\s+\d+\s+.*/; $idoben = $1; $record[$#record/2] =~ /(\w+).*\s+\d+\s+.*/; $idunten = $1; } foreach(@record) { if($_ =~ /^$idoben/i) { $_ =~ /\w+.*\s+\d+\s+(.*)/; $_ = $1; print TF "$round $_\n"; } elsif($_ =~ /^$idunten/i) { $_ =~ /\w+.*\s+\d+\s+(.*)/; $_ = $1; print TF2 "$round $_\n"; } } $round++; } close(TF); close(TF2); close(NF);