By default, don't clean reads with mates mapped to other chromosomes

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3654 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-06-28 15:14:20 +00:00
parent e7939f7036
commit 9a24598a98
1 changed files with 13 additions and 6 deletions

View File

@ -96,6 +96,9 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
@Argument(fullName="sortInCoordinateOrderEvenThoughItIsHighlyUnsafe", required=false, doc="Should we sort the final bam in coordinate order even though it will be malformed because mate pairs of realigned reads will contain inaccurate information?")
protected boolean SORT_IN_COORDINATE_ORDER = false;
@Argument(fullName="realignReadsWithBadMates", required=false, doc="Should we try to realign paired-end reads whose mates map to other chromosomes?")
protected boolean REALIGN_BADLY_MATED_READS = false;
@Argument(fullName="no_pg_tag", shortName="noPG", required=false, doc="Don't output the usual PG tag in the realigned bam file header. FOR DEBUGGING PURPOSES ONLY. This option is required in order to pass integration tests.")
protected boolean NO_PG_TAG = false;
@ -246,13 +249,9 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
return 0;
}
else if ( readLoc.overlapsP(currentInterval) ) {
if ( read.getReadUnmappedFlag() ||
read.getNotPrimaryAlignmentFlag() ||
read.getMappingQuality() == 0 ||
read.getAlignmentStart() == SAMRecord.NO_ALIGNMENT_START ) {
if ( doNotTryToClean(read) ) {
readsNotToClean.add(read);
}
else {
} else {
readsToClean.add(read, ref.getBases());
// add the rods to the list of known variants
populateKnownIndels(metaDataTracker, null);
@ -274,6 +273,14 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
return 0;
}
private boolean doNotTryToClean(SAMRecord read) {
return read.getReadUnmappedFlag() ||
read.getNotPrimaryAlignmentFlag() ||
read.getMappingQuality() == 0 ||
read.getAlignmentStart() == SAMRecord.NO_ALIGNMENT_START ||
(!REALIGN_BADLY_MATED_READS && read.getReadPairedFlag() && !read.getMateUnmappedFlag() && read.getMateReferenceIndex() != read.getReferenceIndex());
}
private void cleanAndCallMap(ReferenceContext ref, SAMRecord read, ReadMetaDataTracker metaDataTracker, GenomeLoc readLoc) {
clean(readsToClean);
knownIndelsToTry.clear();