[Bioperl-l] reducing time
KHOUEIRY pierre
khoueiry at ibsm.cnrs-mrs.fr
Tue Jan 27 08:12:37 EST 2004
Hi all,
In my script, I make a treatment on a big number of fasta files *(same
size)*. The problem is (with my exstimations) the total time will be at
about 26 hours . In fact it tooks 951 seconds for 10 files.
Is there any way to reduce time waist... Or is there a probleme in my
code. I add that the script goes faster for the first 20 or 30 files
then it slow down but still fix (tested on a big number of files without
samll loop on sequences). The output file still empty at the begining
till a number of files is being studied and then it stills like that
until another series of files is treated. I think it's a buffer problem...!
_Her's a bit of the code i use:_
while(my $file = readdir DH)
{
next if ($file =~ /^\./);
my $stream = Bio::SeqIO->new(-file =>
"</home/Perl/proteome/Output/$file", -format => 'fasta');
while(my $one_seq = $stream->next_seq())
{
$heatcount = 0;
$nbhotspot = 0;
$aacount = 0;
$maxaacount = 0;
$nbaamotif = 0;
$aanb= 0;
my $seq = $one_seq->seq();
/a for loop over each sequence goes here (a heavy one)/
$HSPercernt = $nbhotprot/$nbprot;
print "$file\t\t\t"."$nbhotprot\t".substr(($HSPercernt*100),0,4)."\n";
print OUT
"$file\t\t\t"."$nbhotprot\t\t\t".substr(($HSPercernt*100),0,4)."\n";
$nbprotanalysed ++;
$HSPercernt = 0;
$nbhotprot = 0;
$i++;
if($i%10==5){
my $endtime = time();
my $totaltime = $endtime-$inittime;
print "the procedure took ---->", $totaltime,"seconds\n";
}
}#End of reading directory while loop
More information about the Bioperl-l
mailing list