Devide psiblast

From Bioinformatikpedia devides Psi-BLAST output file according to iterations. For example, if the original output file psiblast-big-2iter has results from two iterations, if will be split into two files psiblast-big-2iter_1 (first iteration) and psiblast-big-2iter_2 (second iterations). The files will be written into the same directory.


perl <psiblast output file>


<source lang="perl">

  1. !/usr/bin/perl -w
  2. Devides a Psi-BLAST output file into separate files with the results of each iteration.

use strict;

my $out_p = $ARGV[0];

my $lines = ""; my @dev_lines = ();

open (READ, "$out_p") or die "could not open $out_p"; for my $line (<READ>) {

 $lines .= $line;

} @dev_lines = split(/Searching\.{50}/, $lines); close READ;

my $iter = $#dev_lines; my $header = $dev_lines[0]; for my $i (1..$iter){

 open (WRITE, ">" . $out_p . "_" . $i) or die "could not open $out_p" . "_" . "$i for writing";
 print WRITE $header . $dev_lines[$i];
 close WRITE;


  1. $i==1: header + first iteration results ... $i==$iter: header + last iteration results + footer