diff --git a/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContext.java b/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContext.java index 8f4fe5bb6..c6ed4d6a4 100755 --- a/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContext.java +++ b/java/src/org/broadinstitute/sting/gatk/contexts/AlignmentContext.java @@ -41,9 +41,16 @@ import java.util.*; * To change this template use File | Settings | File Templates. */ public class AlignmentContext { - private GenomeLoc loc = null; - private List reads = null; - private List offsets = null; + protected GenomeLoc loc = null; + protected List reads = null; + protected List offsets = null; + + /** + * Default constructor for AlignmentContext object + * since private objects are already set to null we + * don't need to do anything + */ + public AlignmentContext() { /* private objects already set to null */ } /** * Create a new AlignmentContext object diff --git a/java/src/org/broadinstitute/sting/playground/contexts/FilteredAlignmentContext.java b/java/src/org/broadinstitute/sting/playground/contexts/FilteredAlignmentContext.java new file mode 100755 index 000000000..9b50b5870 --- /dev/null +++ b/java/src/org/broadinstitute/sting/playground/contexts/FilteredAlignmentContext.java @@ -0,0 +1,41 @@ +package org.broadinstitute.sting.playground.contexts; + +import org.broadinstitute.sting.gatk.contexts.AlignmentContext; +import org.broadinstitute.sting.utils.Pair; + +import java.util.List; + +import net.sf.samtools.SAMRecord; + +/** + * Created by IntelliJ IDEA. + * User: chartl + * Date: Sep 9, 2009 + * Time: 10:43:23 AM + * To change this template use File | Settings | File Templates. + */ +public abstract class FilteredAlignmentContext extends AlignmentContext{ + + public FilteredAlignmentContext() { /* super method is called */ } + + /* A partitioned alignment context must have a constructor + * method that generates the object from another alignment + * context + */ + + public FilteredAlignmentContext(AlignmentContext context) { + Pair, List> partitionedReads = filter(context); + this.reads = partitionedReads.getFirst(); + this.offsets = partitionedReads.getSecond(); + this.loc = context.getLocation(); + + } + + /* + * A new partitioned alignment object need only specify how the reads from an Alignmentcontext + * are to be partitioned, and return the new partition in a pair. + * @Param: context - an alignment context containing reads to be partitioned + */ + public abstract Pair, List> filter(AlignmentContext context); + +} diff --git a/java/src/org/broadinstitute/sting/playground/contexts/ForwardReadsContext.java b/java/src/org/broadinstitute/sting/playground/contexts/ForwardReadsContext.java new file mode 100755 index 000000000..97571468b --- /dev/null +++ b/java/src/org/broadinstitute/sting/playground/contexts/ForwardReadsContext.java @@ -0,0 +1,34 @@ +package org.broadinstitute.sting.playground.contexts; + +import org.broadinstitute.sting.utils.Pair; +import org.broadinstitute.sting.gatk.contexts.AlignmentContext; +import net.sf.samtools.SAMRecord; + +import java.util.List; +import java.util.ArrayList; + +/** + * Created by IntelliJ IDEA. + * User: chartl + * Date: Sep 9, 2009 + * Time: 11:01:53 AM + * To change this template use File | Settings | File Templates. + */ +public class ForwardReadsContext extends FilteredAlignmentContext { + + public Pair,List> filter(AlignmentContext context) { + List inReads = context.getReads(); + List inOffsets = context.getOffsets(); + List filteredReads = new ArrayList(); + List filteredOffsets = new ArrayList(); + + for( int i = 0; i < inReads.size(); i++ ) { + if( ! inReads.get(i).getReadNegativeStrandFlag() ) { + filteredReads.add(inReads.get(i)); + filteredOffsets.add(inOffsets.get(i)); + } + } + + return new Pair,List>(filteredReads,filteredOffsets); + } +} diff --git a/java/src/org/broadinstitute/sting/playground/contexts/QualityScoreThresholdContext.java b/java/src/org/broadinstitute/sting/playground/contexts/QualityScoreThresholdContext.java new file mode 100755 index 000000000..606407ffd --- /dev/null +++ b/java/src/org/broadinstitute/sting/playground/contexts/QualityScoreThresholdContext.java @@ -0,0 +1,51 @@ +package org.broadinstitute.sting.playground.contexts; + +import org.broadinstitute.sting.gatk.contexts.AlignmentContext; +import org.broadinstitute.sting.utils.Pair; + +import java.util.List; +import java.util.ArrayList; + +import net.sf.samtools.SAMRecord; + +/** + * Created by IntelliJ IDEA. + * User: chartl + * Date: Sep 9, 2009 + * Time: 11:17:30 AM + * To change this template use File | Settings | File Templates. + */ +public class QualityScoreThresholdContext extends FilteredAlignmentContext{ + /* + * @Param: qThresh - default value for thresholding + */ + protected byte qThresh = 22; + + public QualityScoreThresholdContext(AlignmentContext context, byte qThresh) { + this.qThresh = qThresh; + Pair, List> filteredRO = filter(context); + this.reads = filteredRO.getFirst(); + this.offsets = filteredRO.getSecond(); + this.loc = context.getLocation(); + } + + public byte getQualityScoreThreshold() { + return this.qThresh; + } + + public Pair,List> filter(AlignmentContext context) { + List inReads = context.getReads(); + List inOffsets = context.getOffsets(); + List outReads = new ArrayList(); + List outOffsets = new ArrayList(); + + for( int i = 0; i < inReads.size(); i++) { + if(inReads.get(i).getBaseQualities()[inOffsets.get(i)] >= this.qThresh) { + outReads.add(inReads.get(i)); + outOffsets.add(inOffsets.get(i)); + } + } + + return new Pair,List>(outReads,outOffsets); + } +} diff --git a/java/src/org/broadinstitute/sting/playground/contexts/ReverseReadsContext.java b/java/src/org/broadinstitute/sting/playground/contexts/ReverseReadsContext.java new file mode 100755 index 000000000..c65d52118 --- /dev/null +++ b/java/src/org/broadinstitute/sting/playground/contexts/ReverseReadsContext.java @@ -0,0 +1,35 @@ +package org.broadinstitute.sting.playground.contexts; + +import net.sf.samtools.SAMRecord; + +import java.util.List; +import java.util.ArrayList; + +import org.broadinstitute.sting.utils.Pair; +import org.broadinstitute.sting.gatk.contexts.AlignmentContext; + +/** + * Created by IntelliJ IDEA. + * User: chartl + * Date: Sep 9, 2009 + * Time: 11:09:32 AM + * To change this template use File | Settings | File Templates. + */ +public class ReverseReadsContext extends FilteredAlignmentContext { + + public Pair,List> filter(AlignmentContext context) { + List inReads = context.getReads(); + List inOffsets = context.getOffsets(); + List filteredReads = new ArrayList(); + List filteredOffsets = new ArrayList(); + + for( int i = 0; i < inReads.size(); i++ ) { + if( inReads.get(i).getReadNegativeStrandFlag() ) { + filteredReads.add(inReads.get(i)); + filteredOffsets.add(inOffsets.get(i)); + } + } + + return new Pair,List>(filteredReads,filteredOffsets); + } +} diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/poolseq/CoverageAndPowerWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/poolseq/CoverageAndPowerWalker.java index b704c2913..830f8bdb0 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/poolseq/CoverageAndPowerWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/poolseq/CoverageAndPowerWalker.java @@ -71,7 +71,7 @@ public class CoverageAndPowerWalker extends LocusWalker, Pair,List>,Pair,List>> readsByDirection = PoolUtils.splitReadsByReadDirection(filteredContext.getReads(),filteredContext.getOffsets()); if ( ! suppress_printing) { Pair powers = calculatePower(readsByDirection, useBootstrap, filteredContext); - out.printf("%s: %d %d %d %d %d %d %f %f %f%n", filteredContext.getLocation(), readsByDirection.getFirst().getFirst().size(), readsByDirection.getFirst().getSecond().size(), + out.printf("%s %d %d %d %d %d %d %f %f %f%n", filteredContext.getLocation(), readsByDirection.getFirst().getFirst().size(), readsByDirection.getFirst().getSecond().size(), filteredContext.getReads().size(), powers.getSecond()[0], powers.getSecond()[1], powers.getSecond()[2], powers.getFirst()[0], powers.getFirst()[1], powers.getFirst()[2]); } diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalker.java index 4882d4a65..59465ed4e 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalker.java @@ -55,6 +55,9 @@ public class VariantEvalWalker extends RefWalker { @Argument(fullName="supressDateInformation", doc="This flag indicates that we want to suppress the date information from the output, so that if can be diff'ed against previous evals.", required=false) public boolean supressDateInformation = false; + @Argument(fullName = "numPeopleInPool", shortName="S", doc="If using a variant file from a pooled caller, this field provides the number of individuals in each pool", required=false) + public int numPeopleInPool = 1; + String analysisFilenameBase = null; final String knownSNPDBName = "dbSNP";