A convenience shortcut isReadUnmapped() added: thanks to SAM format specification, 'read unmapped' flag is not always required to be set for an unmapped read; this method checks both the flag and the alignment reference index/start (if those are set to '*' the flag is not required according to the spec!)
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1506 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
0e6feff8f2
commit
58debd7e56
|
|
@ -258,4 +258,18 @@ public class AlignmentUtils {
|
||||||
refLine.append('\n');
|
refLine.append('\n');
|
||||||
return refLine.toString();
|
return refLine.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Due to (unfortunate) multiple ways to indicate that read is unmapped allowed by SAM format
|
||||||
|
* specification, one may need this convenience shortcut. Checks both 'read unmapped' flag and
|
||||||
|
* alignment reference index/start.
|
||||||
|
* @param r
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isReadUnmapped(final SAMRecord r) {
|
||||||
|
if ( r.getReadUnmappedFlag() ) return true;
|
||||||
|
if ( r.getReferenceIndex() == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX ||
|
||||||
|
r.getAlignmentStart() == SAMRecord.NO_ALIGNMENT_START ) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue