Merge branch 'master' of ssh://nickel.broadinstitute.org/humgen/gsa-scr1/gsa-engineering/git/unstable
This commit is contained in:
commit
e93538cdf7
|
|
@ -185,7 +185,7 @@ public class ArgumentSource {
|
|||
* @return A default value for the given type.
|
||||
*/
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine) {
|
||||
return typeDescriptor.createTypeDefault(parsingEngine,this,field.getType());
|
||||
return typeDescriptor.createTypeDefault(parsingEngine,this,field.getGenericType());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -96,12 +96,13 @@ public abstract class ArgumentTypeDescriptor {
|
|||
|
||||
/**
|
||||
* Generates a default for the given type.
|
||||
*
|
||||
* @param parsingEngine the parsing engine used to validate this argument type descriptor.
|
||||
* @param source Source of the command-line argument.
|
||||
* @param type Type of value to create, in case the command-line argument system wants influence.
|
||||
* @return A default value for the given type.
|
||||
*/
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source,Class<?> type) { throw new UnsupportedOperationException("Unable to create default for type " + getClass()); }
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source, Type type) { throw new UnsupportedOperationException("Unable to create default for type " + getClass()); }
|
||||
|
||||
/**
|
||||
* Given the given argument source and attributes, synthesize argument definitions for command-line arguments.
|
||||
|
|
@ -323,8 +324,9 @@ class RodBindingArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
|||
public boolean createsTypeDefault(ArgumentSource source) { return ! source.isRequired(); }
|
||||
|
||||
@Override
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine, ArgumentSource source, Class<?> type) {
|
||||
return RodBinding.makeUnbound((Class<? extends Feature>)type);
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine, ArgumentSource source, Type type) {
|
||||
Class parameterType = getParameterizedTypeClass(type);
|
||||
return RodBinding.makeUnbound((Class<? extends Feature>)parameterType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -646,7 +648,7 @@ class MultiplexArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source,Class<?> type) {
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source, Type type) {
|
||||
if(multiplexer == null || multiplexedIds == null)
|
||||
throw new ReviewedStingException("No multiplexed ids available");
|
||||
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ public class ParsingEngine {
|
|||
*/
|
||||
private void loadValueIntoObject( ArgumentSource source, Object instance, ArgumentMatches argumentMatches ) {
|
||||
// Nothing to load
|
||||
if( argumentMatches.size() == 0 && !(source.createsTypeDefault() && source.isRequired()))
|
||||
if( argumentMatches.size() == 0 && ! source.createsTypeDefault() )
|
||||
return;
|
||||
|
||||
// Target instance into which to inject the value.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* Copyright (c) 2011, The Broad Institute
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.broadinstitute.sting.gatk.examples;
|
||||
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.ArgumentCollection;
|
||||
import org.broadinstitute.sting.gatk.arguments.StandardVariantContextInputArgumentCollection;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
|
||||
/**
|
||||
* [Short one sentence description of this walker]
|
||||
*
|
||||
* <p>
|
||||
* [Functionality of this walker]
|
||||
* </p>
|
||||
*
|
||||
* <h2>Input</h2>
|
||||
* <p>
|
||||
* [Input description]
|
||||
* </p>
|
||||
*
|
||||
* <h2>Output</h2>
|
||||
* <p>
|
||||
* [Output description]
|
||||
* </p>
|
||||
*
|
||||
* <h2>Examples</h2>
|
||||
* <pre>
|
||||
* java
|
||||
* -jar GenomeAnalysisTK.jar
|
||||
* -T $WalkerName
|
||||
* </pre>
|
||||
*
|
||||
* @author Your Name
|
||||
* @since Date created
|
||||
*/
|
||||
public class GATKDocsExample extends RodWalker<Integer, Integer> {
|
||||
/**
|
||||
* Put detailed documentation about the argument here. No need to duplicate the summary information
|
||||
* in doc annotation field, as that will be added before this text in the documentation page.
|
||||
*
|
||||
* Notes:
|
||||
* <ul>
|
||||
* <li>This field can contain HTML as a normal javadoc</li>
|
||||
* <li>Don't include information about the default value, as gatkdocs adds this automatically</li>
|
||||
* <li>Try your best to describe in detail the behavior of the argument, as ultimately confusing
|
||||
* docs here will just result in user posts on the forum</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Argument(fullName="full", shortName="short", doc="Brief summary of argument [~ 80 characters of text]", required=false)
|
||||
private boolean myWalkerArgument = false;
|
||||
|
||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) { return 0; }
|
||||
public Integer reduceInit() { return 0; }
|
||||
public Integer reduce(Integer value, Integer sum) { return value + sum; }
|
||||
public void onTraversalDone(Integer result) { }
|
||||
}
|
||||
|
|
@ -75,12 +75,12 @@ public class OutputStreamArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source,Class type) {
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source, Type type) {
|
||||
if(!source.isRequired())
|
||||
throw new ReviewedStingException("BUG: tried to create type default for argument type descriptor that can't support a type default.");
|
||||
OutputStreamStub stub = new OutputStreamStub(defaultOutputStream);
|
||||
engine.addOutput(stub);
|
||||
return createInstanceOfClass(type,stub);
|
||||
return createInstanceOfClass((Class)type,stub);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class SAMFileWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source,Class<?> type) {
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source, Type type) {
|
||||
if(!source.isRequired())
|
||||
throw new ReviewedStingException("BUG: tried to create type default for argument type descriptor that can't support a type default.");
|
||||
SAMFileWriterStub stub = new SAMFileWriterStub(engine,defaultOutputStream);
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source,Class<?> type) {
|
||||
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source, Type type) {
|
||||
if(!source.isRequired())
|
||||
throw new ReviewedStingException("BUG: tried to create type default for argument type descriptor that can't support a type default.");
|
||||
VCFWriterStub stub = new VCFWriterStub(engine, defaultOutputStream, false, argumentSources, false, false);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.genotyper;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.sting.commandline.RodBinding;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
|
|
@ -35,6 +36,7 @@ import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
|||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood
|
|||
haplotypeMap.clear();
|
||||
|
||||
if (getAlleleListFromVCF) {
|
||||
for( final VariantContext vc_input : tracker.getValues(VariantContext.class, "alleles") ) {
|
||||
for( final VariantContext vc_input : tracker.getValues(UAC.alleles) ) {
|
||||
if( vc_input != null &&
|
||||
allowableTypes.contains(vc_input.getType()) &&
|
||||
ref.getLocus().getStart() == vc_input.getStart()) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.genotyper;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.sting.commandline.RodBinding;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
|
|
@ -57,13 +58,13 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC
|
|||
useAlleleFromVCF = UAC.GenotypingMode == GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES;
|
||||
}
|
||||
|
||||
public static VariantContext getSNPVCFromAllelesRod(RefMetaDataTracker tracker, ReferenceContext ref, boolean requireSNP, Logger logger) {
|
||||
public static VariantContext getSNPVCFromAllelesRod(RefMetaDataTracker tracker, ReferenceContext ref, boolean requireSNP, Logger logger, final RodBinding<VariantContext> allelesBinding) {
|
||||
if ( tracker == null || ref == null || logger == null )
|
||||
throw new ReviewedStingException("Bad arguments: tracker=" + tracker + " ref=" + ref + " logger=" + logger);
|
||||
VariantContext vc = null;
|
||||
|
||||
// search for usable record
|
||||
for( final VariantContext vc_input : tracker.getValues(VariantContext.class, "alleles", ref.getLocus()) ) {
|
||||
for( final VariantContext vc_input : tracker.getValues(allelesBinding) ) {
|
||||
if ( vc_input != null && ! vc_input.isFiltered() && (! requireSNP || vc_input.isSNP() )) {
|
||||
if ( vc == null ) {
|
||||
vc = vc_input;
|
||||
|
|
@ -95,7 +96,7 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC
|
|||
if ( alternateAlleleToUse != null ) {
|
||||
bestAlternateAllele = alternateAlleleToUse.getBases()[0];
|
||||
} else if ( useAlleleFromVCF ) {
|
||||
VariantContext vc = getSNPVCFromAllelesRod(tracker, ref, true, logger);
|
||||
VariantContext vc = getSNPVCFromAllelesRod(tracker, ref, true, logger, UAC.alleles);
|
||||
|
||||
// ignore places where we don't have a variant
|
||||
if ( vc == null )
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ package org.broadinstitute.sting.gatk.walkers.genotyper;
|
|||
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Hidden;
|
||||
import org.broadinstitute.sting.commandline.Input;
|
||||
import org.broadinstitute.sting.commandline.RodBinding;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
|
@ -61,6 +64,11 @@ public class UnifiedArgumentCollection {
|
|||
@Argument(fullName = "computeSLOD", shortName = "sl", doc = "If provided, we will calculate the SLOD", required = false)
|
||||
public boolean COMPUTE_SLOD = false;
|
||||
|
||||
/**
|
||||
* When the UnifiedGenotyper is put into GENOTYPE_GIVEN_ALLELES mode it will genotype the samples using only the alleles provide in this rod binding
|
||||
*/
|
||||
@Input(fullName="alleles", shortName = "alleles", doc="The set of alleles at which to genotype when in GENOTYPE_MODE = GENOTYPE_GIVEN_ALLELES", required=false)
|
||||
public RodBinding<VariantContext> alleles;
|
||||
|
||||
// control the error modes
|
||||
@Hidden
|
||||
|
|
@ -168,6 +176,7 @@ public class UnifiedArgumentCollection {
|
|||
uac.OUTPUT_DEBUG_INDEL_INFO = OUTPUT_DEBUG_INDEL_INFO;
|
||||
uac.INDEL_HAPLOTYPE_SIZE = INDEL_HAPLOTYPE_SIZE;
|
||||
uac.DO_CONTEXT_DEPENDENT_PENALTIES = DO_CONTEXT_DEPENDENT_PENALTIES;
|
||||
uac.alleles = alleles;
|
||||
|
||||
uac.GET_GAP_PENALTIES_FROM_DATA = GET_GAP_PENALTIES_FROM_DATA;
|
||||
uac.INDEL_RECAL_FILE = INDEL_RECAL_FILE;
|
||||
|
|
|
|||
|
|
@ -25,10 +25,7 @@
|
|||
|
||||
package org.broadinstitute.sting.gatk.walkers.genotyper;
|
||||
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.ArgumentCollection;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.commandline.RodBinding;
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
import org.broadinstitute.sting.gatk.DownsampleType;
|
||||
import org.broadinstitute.sting.gatk.arguments.DbsnpArgumentCollection;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ public class UnifiedGenotyperEngine {
|
|||
|
||||
// the unified argument collection
|
||||
private final UnifiedArgumentCollection UAC;
|
||||
public UnifiedArgumentCollection getUAC() { return UAC; }
|
||||
|
||||
// the annotation engine
|
||||
private final VariantAnnotatorEngine annotationEngine;
|
||||
|
|
@ -232,7 +233,7 @@ public class UnifiedGenotyperEngine {
|
|||
private VariantCallContext generateEmptyContext(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, AlignmentContext rawContext) {
|
||||
VariantContext vc;
|
||||
if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) {
|
||||
VariantContext vcInput = SNPGenotypeLikelihoodsCalculationModel.getSNPVCFromAllelesRod(tracker, ref, false, logger);
|
||||
VariantContext vcInput = SNPGenotypeLikelihoodsCalculationModel.getSNPVCFromAllelesRod(tracker, ref, false, logger, UAC.alleles);
|
||||
if ( vcInput == null )
|
||||
return null;
|
||||
vc = new VariantContext("UG_call", vcInput.getChr(), vcInput.getStart(), vcInput.getEnd(), vcInput.getAlleles());
|
||||
|
|
@ -630,7 +631,7 @@ public class UnifiedGenotyperEngine {
|
|||
// no extended event pileup
|
||||
// if we're genotyping given alleles and we have a requested SNP at this position, do SNP
|
||||
if (UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES) {
|
||||
VariantContext vcInput = SNPGenotypeLikelihoodsCalculationModel.getSNPVCFromAllelesRod(tracker, refContext, false, logger);
|
||||
VariantContext vcInput = SNPGenotypeLikelihoodsCalculationModel.getSNPVCFromAllelesRod(tracker, refContext, false, logger, UAC.alleles);
|
||||
if (vcInput == null)
|
||||
return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,15 +25,10 @@
|
|||
|
||||
package org.broadinstitute.sting.gatk.walkers.recalibration;
|
||||
|
||||
import org.broad.tribble.bed.BEDCodec;
|
||||
import org.broad.tribble.dbsnp.DbSNPCodec;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.ArgumentCollection;
|
||||
import org.broadinstitute.sting.commandline.Gather;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broad.tribble.Feature;
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
|
||||
import org.broadinstitute.sting.gatk.filters.MappingQualityUnavailableReadFilter;
|
||||
import org.broadinstitute.sting.gatk.filters.MappingQualityZeroReadFilter;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
|
|
@ -42,8 +37,6 @@ import org.broadinstitute.sting.utils.BaseUtils;
|
|||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.baq.BAQ;
|
||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCF3Codec;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFCodec;
|
||||
import org.broadinstitute.sting.utils.collections.NestedHashMap;
|
||||
import org.broadinstitute.sting.utils.exceptions.DynamicClassResolutionException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
|
|
@ -94,13 +87,18 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
|
|||
/////////////////////////////
|
||||
@ArgumentCollection private RecalibrationArgumentCollection RAC = new RecalibrationArgumentCollection();
|
||||
|
||||
@Output
|
||||
PrintStream out;
|
||||
|
||||
/////////////////////////////
|
||||
// Command Line Arguments
|
||||
/////////////////////////////
|
||||
@Output(fullName="recal_file", shortName="recalFile", required=true, doc="Filename for the outputted covariates table recalibration file")
|
||||
/**
|
||||
* This algorithm treats every reference mismatch as an indication of error. However, real genetic variation is expected to mismatch the reference,
|
||||
* so it is critical that a database of known polymorphic sites is given to the tool in order to skip over those sites.
|
||||
*/
|
||||
@Input(fullName="knownSites", shortName = "knownSites", doc="A database of known polymorphic sites to skip over in the recalibration algorithm", required=false)
|
||||
public List<RodBinding<Feature>> knownSites = Collections.emptyList();
|
||||
@Output
|
||||
PrintStream out;
|
||||
@Output(fullName="recal_file", shortName="recalFile", required=true, doc="Filename for the output covariates table recalibration file")
|
||||
@Gather(CountCovariatesGatherer.class)
|
||||
public PrintStream RECAL_FILE;
|
||||
|
||||
|
|
@ -124,8 +122,8 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
|
|||
/////////////////////////////
|
||||
private final RecalDataManager dataManager = new RecalDataManager(); // Holds the data HashMap, mostly used by TableRecalibrationWalker to create collapsed data hashmaps
|
||||
private final ArrayList<Covariate> requestedCovariates = new ArrayList<Covariate>(); // A list to hold the covariate objects that were requested
|
||||
private static final double DBSNP_VS_NOVEL_MISMATCH_RATE = 2.0; // rate at which dbSNP sites (on an individual level) mismatch relative to novel sites (determined by looking at NA12878)
|
||||
private static int DBSNP_VALIDATION_CHECK_FREQUENCY = 1000000; // how often to validate dbsnp mismatch rate (in terms of loci seen)
|
||||
private static final double DBSNP_VS_NOVEL_MISMATCH_RATE = 2.0; // rate at which dbSNP sites (on an individual level) mismatch relative to novel sites (determined by looking at NA12878)
|
||||
private static int DBSNP_VALIDATION_CHECK_FREQUENCY = 1000000; // how often to validate dbsnp mismatch rate (in terms of loci seen)
|
||||
|
||||
public static class CountedData {
|
||||
private long countedSites = 0; // Number of loci used in the calculations, used for reporting in the output file
|
||||
|
|
@ -136,7 +134,7 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
|
|||
|
||||
private long dbSNPCountsMM = 0, dbSNPCountsBases = 0; // mismatch/base counts for dbSNP loci
|
||||
private long novelCountsMM = 0, novelCountsBases = 0; // mismatch/base counts for non-dbSNP loci
|
||||
private int lociSinceLastDbsnpCheck = 0; // loci since last dbsnp validation
|
||||
private int lociSinceLastDbsnpCheck = 0; // loci since last dbsnp validation
|
||||
|
||||
/**
|
||||
* Adds the values of other to this, returning this
|
||||
|
|
@ -190,20 +188,8 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
|
|||
}
|
||||
|
||||
// Warn the user if no dbSNP file or other variant mask was specified
|
||||
boolean foundDBSNP = false;
|
||||
for( ReferenceOrderedDataSource rod : this.getToolkit().getRodDataSources() ) {
|
||||
if( rod != null ) {
|
||||
if( rod.getType().equals(DbSNPCodec.class) ||
|
||||
rod.getType().equals(VCFCodec.class) ||
|
||||
rod.getType().equals(VCF3Codec.class) ||
|
||||
rod.getType().equals(BEDCodec.class) ) {
|
||||
foundDBSNP = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( !foundDBSNP && !RUN_WITHOUT_DBSNP ) {
|
||||
throw new UserException.CommandLineException("This calculation is critically dependent on being able to skip over known variant sites. Please provide a dbSNP ROD or a VCF file containing known sites of genetic variation.");
|
||||
if( knownSites.isEmpty() && !RUN_WITHOUT_DBSNP ) {
|
||||
throw new UserException.CommandLineException("This calculation is critically dependent on being able to skip over known variant sites. Please provide a VCF file containing known sites of genetic variation.");
|
||||
}
|
||||
|
||||
// Initialize the requested covariates by parsing the -cov argument
|
||||
|
|
@ -266,12 +252,6 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
|
|||
logger.info( "\t" + cov.getClass().getSimpleName() );
|
||||
cov.initialize( RAC ); // Initialize any covariate member variables using the shared argument collection
|
||||
}
|
||||
|
||||
// try {
|
||||
// stream = new PrintStream( RAC.RECAL_FILE );
|
||||
// } catch ( FileNotFoundException e ) {
|
||||
// throw new RuntimeException( "Couldn't open output file: ", e );
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -290,16 +270,13 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
|
|||
* @return Returns 1, but this value isn't used in the reduce step
|
||||
*/
|
||||
public CountedData map( RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context ) {
|
||||
// If any ROD covers this site then we assume it is a site of known genetic variation and we skip it
|
||||
boolean isSNP = tracker.getNTracksWithBoundFeatures() > 0;
|
||||
|
||||
// Only use data from non-dbsnp sites
|
||||
// Assume every mismatch at a non-dbsnp site is indicative of poor quality
|
||||
CountedData counter = new CountedData();
|
||||
if( !isSNP ) {
|
||||
if( tracker.getValues(knownSites).size() == 0 ) { // If something here is in one of the knownSites tracks then skip over it, otherwise proceed
|
||||
// For each read at this locus
|
||||
for( PileupElement p : context.getBasePileup() ) {
|
||||
GATKSAMRecord gatkRead = (GATKSAMRecord) p.getRead();
|
||||
for( final PileupElement p : context.getBasePileup() ) {
|
||||
final GATKSAMRecord gatkRead = (GATKSAMRecord) p.getRead();
|
||||
int offset = p.getOffset();
|
||||
|
||||
if( gatkRead.containsTemporaryAttribute( SKIP_RECORD_ATTRIBUTE ) ) {
|
||||
|
|
@ -358,8 +335,6 @@ public class CountCovariatesWalker extends LocusWalker<CountCovariatesWalker.Cou
|
|||
return counter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update the mismatch / total_base counts for a given class of loci.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -93,8 +93,7 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
|
|||
|
||||
@Output(doc="The output BAM file", required=true)
|
||||
private StingSAMFileWriter OUTPUT_BAM = null;
|
||||
@Argument(fullName="preserve_qscores_less_than", shortName="pQ",
|
||||
doc="Bases with quality scores less than this threshold won't be recalibrated, default=5. In general it's unsafe to change qualities scores below < 5, since base callers use these values to indicate random or bad bases", required=false)
|
||||
@Argument(fullName="preserve_qscores_less_than", shortName="pQ", doc="Bases with quality scores less than this threshold won't be recalibrated, default=5. In general it's unsafe to change qualities scores below < 5, since base callers use these values to indicate random or bad bases", required=false)
|
||||
private int PRESERVE_QSCORES_LESS_THAN = 5;
|
||||
@Argument(fullName="smoothing", shortName="sm", required = false, doc="Number of imaginary counts to add to each bin in order to smooth out bins with few data points, default=1")
|
||||
private int SMOOTHING = 1;
|
||||
|
|
|
|||
|
|
@ -632,8 +632,8 @@ public class ParsingEngineUnitTest extends BaseTest {
|
|||
// --------------------------------------------------------------------------------
|
||||
|
||||
private class SingleRodBindingArgProvider {
|
||||
@Input(fullName="binding", shortName="V", required=false)
|
||||
public RodBinding<Feature> binding = RodBinding.makeUnbound(Feature.class);
|
||||
@Input(fullName="binding", shortName="V", required=true)
|
||||
public RodBinding<Feature> binding;
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -656,7 +656,7 @@ public class ParsingEngineUnitTest extends BaseTest {
|
|||
|
||||
private class ShortNameOnlyRodBindingArgProvider {
|
||||
@Input(shortName="short", required=false)
|
||||
public RodBinding<Feature> binding = RodBinding.makeUnbound(Feature.class);
|
||||
public RodBinding<Feature> binding; // = RodBinding.makeUnbound(Feature.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -677,22 +677,38 @@ public class ParsingEngineUnitTest extends BaseTest {
|
|||
Assert.assertEquals(argProvider.binding.getTags().getPositionalTags().size(), 1, "Tags aren't correctly set");
|
||||
}
|
||||
|
||||
private class OptionalRodBindingArgProvider {
|
||||
@Input(fullName="binding", shortName="V", required=false)
|
||||
public RodBinding<Feature> binding;
|
||||
|
||||
@Input(fullName="bindingNull", shortName="VN", required=false)
|
||||
public RodBinding<VariantContext> bindingNull = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unbasicRodBindingArgumentTest() {
|
||||
public void optionalRodBindingArgumentTest() {
|
||||
final String[] commandLine = new String[] {};
|
||||
|
||||
parsingEngine.addArgumentSource( SingleRodBindingArgProvider.class );
|
||||
parsingEngine.addArgumentSource( OptionalRodBindingArgProvider.class );
|
||||
parsingEngine.parse( commandLine );
|
||||
parsingEngine.validate();
|
||||
|
||||
SingleRodBindingArgProvider argProvider = new SingleRodBindingArgProvider();
|
||||
OptionalRodBindingArgProvider argProvider = new OptionalRodBindingArgProvider();
|
||||
parsingEngine.loadArgumentsIntoObject( argProvider );
|
||||
|
||||
Assert.assertNotNull(argProvider.binding, "Default value not applied corrected to RodBinding");
|
||||
Assert.assertEquals(argProvider.binding.getName(), RodBinding.UNBOUND_VARIABLE_NAME, "Name isn't set properly");
|
||||
Assert.assertEquals(argProvider.binding.getSource(), RodBinding.UNBOUND_SOURCE, "Source isn't set to its expected value");
|
||||
Assert.assertEquals(argProvider.binding.getType(), Feature.class, "Type isn't set to its expected value");
|
||||
Assert.assertEquals(argProvider.binding.isBound(), false, "Bound() isn't returning its expected value");
|
||||
Assert.assertEquals(argProvider.binding.getTags().getPositionalTags().size(), 0, "Tags aren't correctly set");
|
||||
|
||||
Assert.assertNotNull(argProvider.bindingNull, "Default value not applied corrected to RodBinding");
|
||||
Assert.assertEquals(argProvider.bindingNull.getName(), RodBinding.UNBOUND_VARIABLE_NAME, "Name isn't set properly");
|
||||
Assert.assertEquals(argProvider.bindingNull.getSource(), RodBinding.UNBOUND_SOURCE, "Source isn't set to its expected value");
|
||||
Assert.assertEquals(argProvider.bindingNull.getType(), VariantContext.class, "Type isn't set to its expected value");
|
||||
Assert.assertEquals(argProvider.bindingNull.isBound(), false, "Bound() isn't returning its expected value");
|
||||
Assert.assertEquals(argProvider.bindingNull.getTags().getPositionalTags().size(), 0, "Tags aren't correctly set");
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = UserException.class)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
|
|||
GenomeAnalysisEngine.resetRandomGenerator();
|
||||
|
||||
WalkerTest.WalkerTestSpec spec2 = new WalkerTest.WalkerTestSpec(
|
||||
baseCommand + " --genotyping_mode GENOTYPE_GIVEN_ALLELES -B:alleles,vcf " + result.get(0).getAbsolutePath() + " -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,050,000", 1,
|
||||
baseCommand + " --genotyping_mode GENOTYPE_GIVEN_ALLELES -alleles " + result.get(0).getAbsolutePath() + " -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,050,000", 1,
|
||||
Arrays.asList(md5));
|
||||
executeTest("test MultiSample Pilot2 with alleles passed in", spec2);
|
||||
}
|
||||
|
|
@ -53,12 +53,12 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
|
|||
@Test
|
||||
public void testWithAllelesPassedIn() {
|
||||
WalkerTest.WalkerTestSpec spec1 = new WalkerTest.WalkerTestSpec(
|
||||
baseCommand + " --genotyping_mode GENOTYPE_GIVEN_ALLELES -B:alleles,vcf " + validationDataLocation + "allelesForUG.vcf -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,025,000", 1,
|
||||
baseCommand + " --genotyping_mode GENOTYPE_GIVEN_ALLELES -alleles " + validationDataLocation + "allelesForUG.vcf -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,025,000", 1,
|
||||
Arrays.asList("811ddc0bd8322b14f14f58df8c627aa9"));
|
||||
executeTest("test MultiSample Pilot2 with alleles passed in", spec1);
|
||||
|
||||
WalkerTest.WalkerTestSpec spec2 = new WalkerTest.WalkerTestSpec(
|
||||
baseCommand + " --output_mode EMIT_ALL_SITES --genotyping_mode GENOTYPE_GIVEN_ALLELES -B:alleles,vcf " + validationDataLocation + "allelesForUG.vcf -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,025,000", 1,
|
||||
baseCommand + " --output_mode EMIT_ALL_SITES --genotyping_mode GENOTYPE_GIVEN_ALLELES -alleles " + validationDataLocation + "allelesForUG.vcf -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,025,000", 1,
|
||||
Arrays.asList("5cf08dd7ac3d218082f7be3915ce0b15"));
|
||||
executeTest("test MultiSample Pilot2 with alleles passed in and emitting all sites", spec2);
|
||||
}
|
||||
|
|
@ -286,13 +286,13 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
|
|||
@Test
|
||||
public void testWithIndelAllelesPassedIn() {
|
||||
WalkerTest.WalkerTestSpec spec1 = new WalkerTest.WalkerTestSpec(
|
||||
baseCommandIndels + " --genotyping_mode GENOTYPE_GIVEN_ALLELES -B:alleles,vcf " + validationDataLocation + "indelAllelesForUG.vcf -I " + validationDataLocation +
|
||||
baseCommandIndels + " --genotyping_mode GENOTYPE_GIVEN_ALLELES -alleles " + validationDataLocation + "indelAllelesForUG.vcf -I " + validationDataLocation +
|
||||
"pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,100,000", 1,
|
||||
Arrays.asList("69b0b3f089c80b9864294d838a061336"));
|
||||
executeTest("test MultiSample Pilot2 indels with alleles passed in", spec1);
|
||||
|
||||
WalkerTest.WalkerTestSpec spec2 = new WalkerTest.WalkerTestSpec(
|
||||
baseCommandIndels + " --output_mode EMIT_ALL_SITES --genotyping_mode GENOTYPE_GIVEN_ALLELES -B:alleles,vcf "
|
||||
baseCommandIndels + " --output_mode EMIT_ALL_SITES --genotyping_mode GENOTYPE_GIVEN_ALLELES -alleles "
|
||||
+ validationDataLocation + "indelAllelesForUG.vcf -I " + validationDataLocation +
|
||||
"pilot2_daughters.chr20.10k-11k.bam -o %s -L 20:10,000,000-10,100,000", 1,
|
||||
Arrays.asList("c90174cfd7dd68bdef36fe2c60145e10"));
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class RecalibrationWalkersIntegrationTest extends WalkerTest {
|
|||
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-R " + b36KGReference +
|
||||
" -B:dbsnp,vcf " + b36dbSNP129 +
|
||||
" -knownSites " + b36dbSNP129 +
|
||||
" -T CountCovariates" +
|
||||
" -I " + bam +
|
||||
( bam.equals( validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.allTechs.bam" )
|
||||
|
|
@ -135,7 +135,7 @@ public class RecalibrationWalkersIntegrationTest extends WalkerTest {
|
|||
" -standard" +
|
||||
" -OQ" +
|
||||
" -recalFile %s" +
|
||||
" -B:dbsnp,vcf " + b36dbSNP129,
|
||||
" -knownSites " + b36dbSNP129,
|
||||
1, // just one output file
|
||||
Arrays.asList(md5));
|
||||
executeTest("testCountCovariatesUseOriginalQuals", spec);
|
||||
|
|
@ -182,7 +182,7 @@ public class RecalibrationWalkersIntegrationTest extends WalkerTest {
|
|||
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-R " + b36KGReference +
|
||||
" -B:dbsnp,vcf " + b36dbSNP129 +
|
||||
" -knownSites " + b36dbSNP129 +
|
||||
" -T CountCovariates" +
|
||||
" -I " + bam +
|
||||
" -standard" +
|
||||
|
|
@ -225,30 +225,6 @@ public class RecalibrationWalkersIntegrationTest extends WalkerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCountCovariatesVCF() {
|
||||
HashMap<String, String> e = new HashMap<String, String>();
|
||||
e.put( validationDataLocation + "NA12892.SLX.SRP000031.2009_06.selected.bam", "170f0c3cc4b8d72c539136effeec9a16");
|
||||
|
||||
for ( Map.Entry<String, String> entry : e.entrySet() ) {
|
||||
String bam = entry.getKey();
|
||||
String md5 = entry.getValue();
|
||||
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-R " + b36KGReference +
|
||||
" -B:dbsnp,VCF3 " + validationDataLocation + "vcfexample3.vcf" +
|
||||
" -T CountCovariates" +
|
||||
" -I " + bam +
|
||||
" -L 1:10,000,000-10,200,000" +
|
||||
" -standard" +
|
||||
" --solid_recal_mode SET_Q_ZERO" +
|
||||
" -recalFile %s",
|
||||
1, // just one output file
|
||||
Arrays.asList(md5));
|
||||
executeTest("testCountCovariatesVCF", spec);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCountCovariatesBED() {
|
||||
HashMap<String, String> e = new HashMap<String, String>();
|
||||
|
|
@ -260,7 +236,7 @@ public class RecalibrationWalkersIntegrationTest extends WalkerTest {
|
|||
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-R " + b36KGReference +
|
||||
" -B:bed,bed " + validationDataLocation + "recalibrationTest.bed" +
|
||||
" -knownSites:bed " + validationDataLocation + "recalibrationTest.bed" +
|
||||
" -T CountCovariates" +
|
||||
" -I " + bam +
|
||||
" -L 1:10,000,000-10,200,000" +
|
||||
|
|
@ -284,10 +260,10 @@ public class RecalibrationWalkersIntegrationTest extends WalkerTest {
|
|||
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-R " + b36KGReference +
|
||||
" -B:anyNameABCD,VCF3 " + validationDataLocation + "vcfexample3.vcf" +
|
||||
" -knownSites:anyNameABCD,VCF3 " + validationDataLocation + "vcfexample3.vcf" +
|
||||
" -T CountCovariates" +
|
||||
" -I " + bam +
|
||||
" -B:dbsnp,vcf " + b36dbSNP129 +
|
||||
" -knownSites " + b36dbSNP129 +
|
||||
" -L 1:10,000,000-10,200,000" +
|
||||
" -cov ReadGroupCovariate" +
|
||||
" -cov QualityScoreCovariate" +
|
||||
|
|
@ -312,7 +288,7 @@ public class RecalibrationWalkersIntegrationTest extends WalkerTest {
|
|||
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-R " + b36KGReference +
|
||||
" -B:dbsnp,vcf " + b36dbSNP129 +
|
||||
" -knownSites " + b36dbSNP129 +
|
||||
" -T CountCovariates" +
|
||||
" -I " + bam +
|
||||
" -cov ReadGroupCovariate" +
|
||||
|
|
|
|||
Loading…
Reference in New Issue