I have to blast a zip file including hundreds of protein fasta files. Since it is impossible to blast them one by one, I plan to use perl to blast in a local database. I am new to perl and look for models online. My question is how to unite a unzip perl with a blast perl.
- Is $name in unzip.pl the result of unzipped fasta? what should I do at # Do something here ?
- $f in BlastList.pl is the query. How could I change it to connect result of unzip.pl.
- Is any other solution better than this one? Thank you
my $zipfile = "fasta.zip";
my $u = new IO::Uncompress::Unzip $zipfile
or die "Cannot open $zipfile: $UnzipError";
my $status;
for ($status = 1; $status > 0; $status = $u->nextStream())
{
my $name = $u->getHeaderInfo()->{Name};
warn "Processing member $name\n" ;
my $buff;
while (($status = $u->read($buff)) > 0) {
**# Do something here**
}
last if $status < 0;
}
die "Error processing $zipfile: $!\n"
if $status < 0 ;
Here is the blast model using local database: BlastList.pl.
$DBNAME = "mydb";
$dirtoget="C:/Blast";
opendir(IMD, $dirtoget) || die("Cannot open directory");
# delete the old "DosBlast.bat"
$dosfile = "DosBlast.bat";
unlink($dosfile);
# Get the list of the new sequence files to blast
@thefiles= readdir(IMD);
closedir(IMD);
# Create a new file "DosBlast.bat"
open(OUT,">DosBlast.bat") || die "cannot open file for writing: $!";
foreach $f ...