Skip to content

Commit

Permalink
don't split in the middle of a read for trio inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
skoren committed Jul 18, 2024
1 parent 8a09ff5 commit 1449b1a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/pipelines/canu/HaplotypeReads.pm
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ sub haplotypeSplitReads ($$%) {
# If looks like FASTA or FASTQ name, make new sequence
if ((m/^\@/) ||
(m/^>/)) {
# check if we're out of size on the file, only check when we're at the start of a sequence
if ($fileLength > $fileLengthMax) {
close(OUT);
stashFile("$path/reads-$haplotype/reads-$haplotype-$fileNumber.fasta.gz");

$fileNumber++;
$fileLength = 0;

print STDERR "-- --> '$path/reads-$haplotype/reads-$haplotype-$fileNumber.fasta.gz'.\n";
open(OUT, "| gzip -1c > $path/reads-$haplotype/reads-$haplotype-$fileNumber.fasta.gz");
}
print OUT ">\n";
next;
}
Expand All @@ -163,17 +174,6 @@ sub haplotypeSplitReads ($$%) {
print OUT $_;

$fileLength += length($_) - 1;

if ($fileLength > $fileLengthMax) {
close(OUT);
stashFile("$path/reads-$haplotype/reads-$haplotype-$fileNumber.fasta.gz");

$fileNumber++;
$fileLength = 0;

print STDERR "-- --> '$path/reads-$haplotype/reads-$haplotype-$fileNumber.fasta.gz'.\n";
open(OUT, "| gzip -1c > $path/reads-$haplotype/reads-$haplotype-$fileNumber.fasta.gz");
}
}

close(INP);
Expand Down

0 comments on commit 1449b1a

Please sign in to comment.