Commit f7fe4373 authored by Roy Storey's avatar Roy Storey
Browse files

always write the sequence to the current seqio - fix for creating lots of empty output files

parent c0381e5c
......@@ -129,12 +129,12 @@ sub write_output {
my $chunk_seqio = Bio::SeqIO->new(-file => '>'.$chunk_name, -format => 'fasta');
while (my $seq_object = $input_seqio->next_seq) {
if((my $seq_length = $seq_object->length()) + $chunk_length <= $max_chunk_length) {
# add to the current chunk:
$chunk_seqio->write_seq( $seq_object );
if((my $seq_length = $seq_object->length()) + $chunk_length <= $max_chunk_length) {
$chunk_length += $seq_length;
$chunk_size += 1;
} else {
# dataflow the current chunk:
......@@ -162,6 +162,8 @@ sub write_output {
'chunk_length' => $chunk_length,
'chunk_size' => $chunk_size
}, 2);
} else {
unlink $chunk_name unless (stat($chunk_name))[7];
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment