Spurious associations can develop from including ambiguous reads in these tests. Perhaps MQ0 reads shouldn't be used for anything except MQ0, but the best way to do that is to restructure the code, so for now I'll put it off.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5656 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
chartl 2011-04-17 23:17:03 +00:00
parent 49ea07acce
commit e28fc21642
6 changed files with 23 additions and 9 deletions

View File

@ -11,14 +11,17 @@ import java.util.List;
* @author chartl * @author chartl
*/ */
public class InsertSizeDistribution extends ValueTest { public class InsertSizeDistribution extends ValueTest {
private final int MAPQ_THRESHOLD = 5;
public boolean usePreviouslySeenReads() { return false; } public boolean usePreviouslySeenReads() { return false; }
public Collection<Number> map(ReadBackedPileup pileup) { public Collection<Number> map(ReadBackedPileup pileup) {
List<Integer> insertSizes = new ArrayList<Integer>(pileup.size()); List<Integer> insertSizes = new ArrayList<Integer>(pileup.size());
for ( PileupElement e : pileup ) { for ( PileupElement e : pileup ) {
if ( e.getMappingQual() >= MAPQ_THRESHOLD ) {
insertSizes.add(Math.abs(e.getRead().getInferredInsertSize())); insertSizes.add(Math.abs(e.getRead().getInferredInsertSize()));
} }
}
return (Collection) insertSizes; return (Collection) insertSizes;
} }

View File

@ -13,13 +13,15 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
*/ */
public class MateOtherContig extends ProportionTest { public class MateOtherContig extends ProportionTest {
private final int MAPQ_THRESHOLD = 5;
public boolean usePreviouslySeenReads() { return false; } public boolean usePreviouslySeenReads() { return false; }
public Pair<Number,Number> map(ReadBackedPileup pileup) { public Pair<Number,Number> map(ReadBackedPileup pileup) {
int tot = 0; int tot = 0;
int otherCon = 0; int otherCon = 0;
for ( PileupElement e : pileup ) { for ( PileupElement e : pileup ) {
if ( e.getRead().getReadPairedFlag() ) { if ( e.getRead().getReadPairedFlag() && e.getRead().getMappingQuality() >= MAPQ_THRESHOLD ) {
++tot; ++tot;
if ( ! e.getRead().getMateReferenceIndex().equals(e.getRead().getReferenceIndex()) ) { if ( ! e.getRead().getMateReferenceIndex().equals(e.getRead().getReferenceIndex()) ) {
++otherCon; ++otherCon;

View File

@ -12,12 +12,13 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public class MateSameStrand extends ProportionTest { public class MateSameStrand extends ProportionTest {
private final int MAPQ_THRESHOLD = 5;
public Pair<Number,Number> map(ReadBackedPileup rbp) { public Pair<Number,Number> map(ReadBackedPileup rbp) {
int numPairs = 0; int numPairs = 0;
int mateSameStrand = 0; int mateSameStrand = 0;
for (PileupElement e : rbp ) { for (PileupElement e : rbp ) {
if ( e.getRead().getReadPairedFlag() ) { if ( e.getRead().getReadPairedFlag() && e.getMappingQual() >= MAPQ_THRESHOLD) {
++numPairs; ++numPairs;
if ( e.getRead().getMateNegativeStrandFlag() == e.getRead().getReadNegativeStrandFlag() ) { if ( e.getRead().getMateNegativeStrandFlag() == e.getRead().getReadNegativeStrandFlag() ) {
++mateSameStrand; ++mateSameStrand;

View File

@ -12,12 +12,13 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public class MateUnmapped extends ProportionTest { public class MateUnmapped extends ProportionTest {
private final int MAPQ_THRESHOLD = 5;
public Pair<Number,Number> map(ReadBackedPileup pileup) { public Pair<Number,Number> map(ReadBackedPileup pileup) {
int numMatedReads = 0; int numMatedReads = 0;
int numPairUnmapped = 0; int numPairUnmapped = 0;
for (PileupElement e : pileup ) { for (PileupElement e : pileup ) {
if (e.getRead().getReadPairedFlag() ) { if (e.getRead().getReadPairedFlag() && e.getMappingQual() >= MAPQ_THRESHOLD ) {
++numMatedReads; ++numMatedReads;
if ( e.getRead().getMateUnmappedFlag() ) { if ( e.getRead().getMateUnmappedFlag() ) {
++numPairUnmapped; ++numPairUnmapped;

View File

@ -12,16 +12,19 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public class ProperPairs extends ProportionTest { public class ProperPairs extends ProportionTest {
private final int MAPQ_THRESHOLD = 5;
public Pair<Number,Number> map(ReadBackedPileup rbp) { public Pair<Number,Number> map(ReadBackedPileup rbp) {
int numReads = 0; int numReads = 0;
int numPropPair = 0; int numPropPair = 0;
for (PileupElement e : rbp ) { for (PileupElement e : rbp ) {
if ( e.getRead().getReadPairedFlag() && e.getMappingQual() >= MAPQ_THRESHOLD ) {
++numReads; ++numReads;
if ( e.getRead().getReadPairedFlag() && e.getRead().getProperPairFlag() ) { if ( e.getRead().getReadPairedFlag() && e.getRead().getProperPairFlag() ) {
++numPropPair; ++numPropPair;
} }
} }
}
return new Pair<Number,Number>(numPropPair,numReads); return new Pair<Number,Number>(numPropPair,numReads);
} }

View File

@ -1,5 +1,6 @@
package org.broadinstitute.sting.oneoffprojects.walkers.association.modules.casecontrol; package org.broadinstitute.sting.oneoffprojects.walkers.association.modules.casecontrol;
import net.sf.samtools.CigarElement;
import net.sf.samtools.CigarOperator; import net.sf.samtools.CigarOperator;
import org.broadinstitute.sting.utils.collections.Pair; import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.pileup.PileupElement; import org.broadinstitute.sting.utils.pileup.PileupElement;
@ -19,8 +20,11 @@ public class ReadsWithIndels extends ProportionTest {
int numWithIndels = 0; int numWithIndels = 0;
for ( PileupElement e : pileup ) { for ( PileupElement e : pileup ) {
++numReads; ++numReads;
if ( e.getRead().getCigar().getCigarElements().contains(CigarOperator.DELETION) || e.getRead().getCigar().getCigarElements().contains(CigarOperator.INSERTION)) { for ( CigarElement element : e.getRead().getCigar().getCigarElements() ) {
if ( element.getOperator().equals(CigarOperator.DELETION) || element.getOperator().equals(CigarOperator.INSERTION) ) {
++numWithIndels; ++numWithIndels;
break;
}
} }
} }