Fix minor bug introduced in filtration, and cleaned up the artificial sam records so that they use SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX and SAMRecord.NO_ALIGNMENT_START rather than hardcoded -1's.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1296 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
cac04a407a
commit
298cc24524
|
|
@ -113,7 +113,11 @@ public class ArtificialPatternedSAMIterator extends ArtificialSAMIterator {
|
|||
return false;
|
||||
} else {
|
||||
++totalReadCount;
|
||||
this.next = ArtificialSAMUtils.createArtificialRead(this.header, String.valueOf(totalReadCount), -1, -1, 50);
|
||||
this.next = ArtificialSAMUtils.createArtificialRead(this.header,
|
||||
String.valueOf(totalReadCount),
|
||||
SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX,
|
||||
SAMRecord.NO_ALIGNMENT_START,
|
||||
50);
|
||||
--unmappedRemaining;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,11 @@ public class ArtificialSAMIterator implements StingSAMIterator {
|
|||
return false;
|
||||
} else {
|
||||
++totalReadCount;
|
||||
this.next = ArtificialSAMUtils.createArtificialRead(this.header, String.valueOf(totalReadCount), -1, -1, 50);
|
||||
this.next = ArtificialSAMUtils.createArtificialRead(this.header,
|
||||
String.valueOf(totalReadCount),
|
||||
SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX,
|
||||
SAMRecord.NO_ALIGNMENT_START,
|
||||
50);
|
||||
--unmappedRemaining;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,8 @@ public class ArtificialSAMUtils {
|
|||
* @return the artificial read
|
||||
*/
|
||||
public static SAMRecord createArtificialRead( SAMFileHeader header, String name, int refIndex, int alignmentStart, int length ) {
|
||||
if (alignmentStart == 0)
|
||||
if( (refIndex == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && alignmentStart != SAMRecord.NO_ALIGNMENT_START) ||
|
||||
(refIndex != SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && alignmentStart == SAMRecord.NO_ALIGNMENT_START) )
|
||||
throw new StingException("Invalid alignment start for artificial read, start = " + alignmentStart);
|
||||
SAMRecord record = new SAMRecord(header);
|
||||
record.setReadName(name);
|
||||
|
|
@ -153,7 +154,7 @@ public class ArtificialSAMUtils {
|
|||
elements.add(new CigarElement(length, CigarOperator.characterToEnum('M')));
|
||||
record.setCigar(new Cigar(elements));
|
||||
record.setProperPairFlag(false);
|
||||
if (refIndex == -1) {
|
||||
if (refIndex == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) {
|
||||
record.setReadUmappedFlag(true);
|
||||
}
|
||||
return record;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class SAMReadValidator {
|
|||
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");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue