JohnLucania
Programmer
Code:
while ( my @rids = $fac->each_rid ) {
die "No record found\n" unless @rids;
foreach my $rid ( @rids ) {
my $result = $fac->retrieve_blast( $rid );
if( ref( $result )) {
my $output = $result->next_result();
my $filename = $output->query_name().".out";
$filename =~ s/.*?\|(\w*).*/$1.out/;
$fac->save_output( $filename );
$fac->remove_rid( $rid );
}
elsif( $result < 0 ) {
$fac->remove_rid( $rid );
}
else {
sleep 5;
}
}
}
The output from my $filename = $output->query_name().".out"; generates one big file. I like to break it down to multiple files.
>ref|XP_449030.1|
.......
>ref|XP_456080.1|
.......
>emb|CAG86374.1|
.......
The output always starts with '>' and then a word and then | (pipe).
I want multiple files like:
XP_449030.out
XP_456080.out
CAG86374.out
etc
I tried $filename =~ s/.*?\|(\w*).*/$1.out/;
but not working.
How do you generate multiple files on the fly?
jl