Hi,

I am trying to right a tool that will generate 2 ouptuts, 1 .txt and .gz.
Before the tools runs I don't know how many fasta files will be in the .gz file.

I have managed to have the perl script writing files like follow : 

$seqio_obj = Bio::SeqIO->new(-file => $seq_library_name, -format => "fasta" );
while ($seq_obj = $seqio_obj->next_seq)
{   
$seq_ID = $seq_obj -> display_id;
$seq = $seq_obj -> seq;
#print $seq_ID."\n";
#print $MID_id_ref{$seq_ID}."\n";
if (defined($combination{$seq_ID}))
{
open(OUT,">>/my/own/path/on/my/server/which /is/not/good/".$combination{$seq_ID}."_library.fasta")||die"Pb ouverture du fichier3";
print OUT ">".$seq_ID."\n".$seq."\n";
#open(OUT,">>".$output_name2)||die"Pb ouverture du fichier3";
#print OUT ">".$seq_ID."\n".$seq."\n";
}
else
{
open(OUT,">>/my/own/path/on/my/server/which /is/not/good/unsorted_library.fasta")||die"Pb ouverture du fichier3";
print OUT ">".$seq_ID."\n".$seq."\n";
#open(OUT,">>".$output_name2)||die"Pb ouverture du fichier3";
#print OUT ">".$seq_ID."\n".$seq."\n";

$nb_unsorted_seq++;
}
$nb_total_seq++;
}

I then use a command line to zip as follow :

system('cd $work_dir');
system('tar -zcPf '.$output_name2.' /my/own/path/on/my/server/which /is/not/good/');

If one of you have encounter the same problem or if you can point me to a tool which is doing some similar stuff.

Thanks,
Philippe