Skip to content

Commit

Permalink
[ADAM-1702] Validate read numbers in InterleavedFASTQInFormatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnothaft committed Aug 30, 2017
1 parent fcaca38 commit bac6c1d
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,20 @@ class InterleavedFASTQInFormatter private (
outputOriginalBaseQualities = writeOriginalQualities) + "\n"

// write both to the output stream
os.write(fastq1.getBytes)
os.write(fastq2.getBytes)
// ensure that reads are ordered properly if ordering is known (see #1702)
if (read1.getReadInFragment == 0 &&
read2.getReadInFragment == 1) {
os.write(fastq1.getBytes)
os.write(fastq2.getBytes)
} else if (read1.getReadInFragment == 1 &&
read2.getReadInFragment == 0) {
os.write(fastq2.getBytes)
os.write(fastq1.getBytes)
} else {
if (enableLogging) {
log.warn("Improper pair of reads in fragment %s. Dropping...".format(p))
}
}
})
}
}

0 comments on commit bac6c1d

Please sign in to comment.