For Manny: filter out reads where the the ref index ==

NO_ALIGNMENT_REFERENCE_INDEX but the alignment start != NO_ALIGNMENT_START.


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1295 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-07-22 21:19:24 +00:00
parent 9c12c02768
commit cac04a407a
1 changed files with 8 additions and 1 deletions

View File

@ -70,9 +70,16 @@ public class SAMReadValidator {
throw new SAMReadValidationException("Alignment ends prior to its beginning");
}
/**
* Check to ensure that the alignment makes sense based on the contents of the header.
* @param header The SAM file header.
* @param read The read to verify.
*/
private static void checkAlignmentDisagreesWithHeader( SAMFileHeader header, SAMRecord read ) {
if( read.getReferenceIndex() == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && read.getAlignmentStart() != SAMRecord.NO_ALIGNMENT_START )
throw new SAMReadValidationException("Read is aligned to nonexistent contig");
SAMSequenceRecord contigHeader = header.getSequence( read.getReferenceIndex() );
if( !read.getReadUnmappedFlag() && read.getAlignmentStart() > contigHeader.getSequenceLength() )
if( read.getReadUnmappedFlag() && read.getAlignmentStart() > contigHeader.getSequenceLength() )
throw new SAMReadValidationException("Read is aligned to a point after the end of the contig");
}