Added a StandardVariantContextInputArgumentCollection that is now used for consistency by many of the core tools.
This commit is contained in:
parent
bc125f104a
commit
06cdc4d5f9
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2010 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.arguments;
|
||||
|
||||
|
||||
import org.broadinstitute.sting.commandline.Input;
|
||||
import org.broadinstitute.sting.commandline.RodBinding;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.simpleframework.xml.Root;
|
||||
|
||||
/**
|
||||
* @author ebanks
|
||||
* @version 1.0
|
||||
*/
|
||||
@Root
|
||||
public class StandardVariantContextInputArgumentCollection {
|
||||
|
||||
/**
|
||||
* The VCF input file(s)
|
||||
*
|
||||
* The variant track can take any number of arguments on the command line. Each -V argument
|
||||
* will be included as an input to the tool. If no explicit name is provided,
|
||||
* the -V arguments will be named using the default algorithm: variant, variant2, variant3, etc.
|
||||
* The user can override this by providing an explicit name -V:name,vcf for each -V argument,
|
||||
* and each named argument will be labeled as such in the output (i.e., set=name rather than
|
||||
* set=variant2). The order of arguments does not matter except for the naming.
|
||||
*/
|
||||
@Input(fullName="variant", shortName = "V", doc="Input VCF file", required=true)
|
||||
public RodBinding<VariantContext> variants;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.gatk.walkers.annotator;
|
|||
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
import org.broadinstitute.sting.gatk.arguments.DbsnpArgumentCollection;
|
||||
import org.broadinstitute.sting.gatk.arguments.StandardVariantContextInputArgumentCollection;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
|
|
@ -35,7 +36,6 @@ import org.broadinstitute.sting.gatk.walkers.*;
|
|||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotationType;
|
||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation;
|
||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
|
||||
import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedArgumentCollection;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||
|
|
@ -56,8 +56,7 @@ import java.util.*;
|
|||
@By(DataSource.REFERENCE)
|
||||
public class VariantAnnotator extends RodWalker<Integer, Integer> {
|
||||
|
||||
@Input(fullName="variant", shortName = "V", doc="Input VCF file", required=true)
|
||||
public RodBinding<VariantContext> variants;
|
||||
@ArgumentCollection protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Input(fullName="snpEffFile", shortName = "snpEffFile", doc="SnpEff file", required=false)
|
||||
public RodBinding<SnpEffFeature> snpEffFile;
|
||||
|
|
@ -142,7 +141,7 @@ public class VariantAnnotator extends RodWalker<Integer, Integer> {
|
|||
listAnnotationsAndExit();
|
||||
|
||||
// get the list of all sample names from the variant VCF input rod, if applicable
|
||||
List<String> rodName = Arrays.asList(variants.getName());
|
||||
List<String> rodName = Arrays.asList(variantCollection.variants.getName());
|
||||
Set<String> samples = SampleUtils.getUniqueSamplesFromRods(getToolkit(), rodName);
|
||||
|
||||
// add the non-VCF sample from the command-line, if applicable
|
||||
|
|
@ -166,7 +165,7 @@ public class VariantAnnotator extends RodWalker<Integer, Integer> {
|
|||
// note that if any of the definitions conflict with our new ones, then we want to overwrite the old ones
|
||||
Set<VCFHeaderLine> hInfo = new HashSet<VCFHeaderLine>();
|
||||
hInfo.addAll(engine.getVCFAnnotationDescriptions());
|
||||
for ( VCFHeaderLine line : VCFUtils.getHeaderFields(getToolkit(), Arrays.asList(variants.getName())) ) {
|
||||
for ( VCFHeaderLine line : VCFUtils.getHeaderFields(getToolkit(), Arrays.asList(variantCollection.variants.getName())) ) {
|
||||
if ( isUniqueHeaderLine(line, hInfo) )
|
||||
hInfo.add(line);
|
||||
}
|
||||
|
|
@ -225,7 +224,7 @@ public class VariantAnnotator extends RodWalker<Integer, Integer> {
|
|||
if ( tracker == null )
|
||||
return 0;
|
||||
|
||||
Collection<VariantContext> VCs = tracker.getValues(variants, context.getLocation());
|
||||
Collection<VariantContext> VCs = tracker.getValues(variantCollection.variants, context.getLocation());
|
||||
if ( VCs.size() == 0 )
|
||||
return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,8 @@
|
|||
|
||||
package org.broadinstitute.sting.gatk.walkers.beagle;
|
||||
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Input;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.commandline.RodBinding;
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
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.datasources.rmd.ReferenceOrderedDataSource;
|
||||
|
|
@ -54,8 +52,9 @@ import static java.lang.Math.log10;
|
|||
*/
|
||||
@Requires(value={})
|
||||
public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
||||
@Input(fullName="variant", shortName = "V", doc="Input VCF file", required=true)
|
||||
public RodBinding<VariantContext> variants;
|
||||
|
||||
@ArgumentCollection
|
||||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Input(fullName="comp", shortName = "comp", doc="Comparison VCF file", required=false)
|
||||
public RodBinding<VariantContext> comp = RodBinding.makeUnbound(VariantContext.class);
|
||||
|
|
@ -111,7 +110,7 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
|||
hInfo.add(new VCFInfoHeaderLine("AFH", 1, VCFHeaderLineType.Float, "Allele Number from Comparison ROD at this site"));
|
||||
}
|
||||
|
||||
Set<String> samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(variants.getName()));
|
||||
Set<String> samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(variantCollection.variants.getName()));
|
||||
|
||||
final VCFHeader vcfHeader = new VCFHeader(hInfo, samples);
|
||||
vcfWriter.writeHeader(vcfHeader);
|
||||
|
|
@ -123,7 +122,7 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
|||
return 0;
|
||||
|
||||
GenomeLoc loc = context.getLocation();
|
||||
VariantContext vc_input = tracker.getFirstValue(variants, loc);
|
||||
VariantContext vc_input = tracker.getFirstValue(variantCollection.variants, loc);
|
||||
|
||||
VariantContext vc_comp = tracker.getFirstValue(comp, loc);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.gatk.walkers.beagle;
|
|||
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||
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;
|
||||
|
|
@ -52,8 +53,8 @@ import java.util.*;
|
|||
*/
|
||||
@Requires(value={})
|
||||
public class ProduceBeagleInputWalker extends RodWalker<Integer, Integer> {
|
||||
@Input(fullName="variant", shortName = "V", doc="Input VCF file", required=true)
|
||||
public RodBinding<VariantContext> variants;
|
||||
|
||||
@ArgumentCollection protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Input(fullName="validation", shortName = "validation", doc="Input VCF file", required=false)
|
||||
public RodBinding<VariantContext> validation = RodBinding.makeUnbound(VariantContext.class);
|
||||
|
|
@ -98,7 +99,7 @@ public class ProduceBeagleInputWalker extends RodWalker<Integer, Integer> {
|
|||
|
||||
public void initialize() {
|
||||
|
||||
samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(variants.getName()));
|
||||
samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(variantCollection.variants.getName()));
|
||||
|
||||
beagleWriter.print("marker alleleA alleleB");
|
||||
for ( String sample : samples )
|
||||
|
|
@ -120,7 +121,7 @@ public class ProduceBeagleInputWalker extends RodWalker<Integer, Integer> {
|
|||
public Integer map( RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context ) {
|
||||
if( tracker != null ) {
|
||||
GenomeLoc loc = context.getLocation();
|
||||
VariantContext variant_eval = tracker.getFirstValue(variants, loc);
|
||||
VariantContext variant_eval = tracker.getFirstValue(variantCollection.variants, loc);
|
||||
VariantContext validation_eval = tracker.getFirstValue(validation, loc);
|
||||
|
||||
if ( goodSite(variant_eval,validation_eval) ) {
|
||||
|
|
|
|||
|
|
@ -26,13 +26,10 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.filters;
|
||||
|
||||
import org.broad.tribble.Feature;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Input;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.commandline.RodBinding;
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
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.datasources.rmd.ReferenceOrderedDataSource;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
|
|
@ -53,8 +50,8 @@ import java.util.*;
|
|||
@Reference(window=@Window(start=-50,stop=50))
|
||||
public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
|
||||
|
||||
@Input(fullName="variant", shortName = "V", doc="Input VCF file", required=true)
|
||||
public RodBinding<VariantContext> variants;
|
||||
@ArgumentCollection
|
||||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Input(fullName="mask", doc="Input ROD mask", required=false)
|
||||
public RodBinding<Feature> mask = RodBinding.makeUnbound(Feature.class);
|
||||
|
|
@ -100,7 +97,7 @@ public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
|
|||
|
||||
private void initializeVcfWriter() {
|
||||
|
||||
final List<String> inputNames = Arrays.asList(variants.getName());
|
||||
final List<String> inputNames = Arrays.asList(variantCollection.variants.getName());
|
||||
|
||||
// setup the header fields
|
||||
Set<VCFHeaderLine> hInfo = new HashSet<VCFHeaderLine>();
|
||||
|
|
@ -152,7 +149,7 @@ public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
|
|||
if ( tracker == null )
|
||||
return 0;
|
||||
|
||||
Collection<VariantContext> VCs = tracker.getValues(variants, context.getLocation());
|
||||
Collection<VariantContext> VCs = tracker.getValues(variantCollection.variants, context.getLocation());
|
||||
|
||||
// is there a SNP mask present?
|
||||
boolean hasMask = tracker.hasValues(mask);
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.phasing;
|
||||
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
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.datasources.sample.Sample;
|
||||
import org.broadinstitute.sting.gatk.filters.MappingQualityZeroReadFilter;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
import org.broadinstitute.sting.utils.DisjointSet;
|
||||
|
|
@ -67,8 +67,8 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
*
|
||||
* All heterozygous variants found in this VCF file will be phased, where possible
|
||||
*/
|
||||
@Input(fullName="variant", shortName = "V", doc="Phase variants from this VCF file", required=true)
|
||||
public RodBinding<VariantContext> variants;
|
||||
@ArgumentCollection
|
||||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Output(doc = "File to which variants should be written", required = true)
|
||||
protected VCFWriter writer = null;
|
||||
|
|
@ -175,8 +175,9 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
hInfo.add(new VCFInfoHeaderLine(PHASING_INCONSISTENT_KEY, 0, VCFHeaderLineType.Flag, "Are the reads significantly haplotype-inconsistent?"));
|
||||
|
||||
// todo -- fix samplesToPhase
|
||||
Map<String, VCFHeader> rodNameToHeader = getVCFHeadersFromRods(getToolkit(), Arrays.asList(variants.getName()));
|
||||
Set<String> samples = new TreeSet<String>(samplesToPhase == null ? rodNameToHeader.get(variants.getName()).getGenotypeSamples() : samplesToPhase);
|
||||
String trackName = variantCollection.variants.getName();
|
||||
Map<String, VCFHeader> rodNameToHeader = getVCFHeadersFromRods(getToolkit(), Arrays.asList(trackName));
|
||||
Set<String> samples = new TreeSet<String>(samplesToPhase == null ? rodNameToHeader.get(trackName).getGenotypeSamples() : samplesToPhase);
|
||||
writer.writeHeader(new VCFHeader(hInfo, samples));
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +208,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
PhasingStats phaseStats = new PhasingStats();
|
||||
List<VariantContext> unprocessedList = new LinkedList<VariantContext>();
|
||||
|
||||
for (VariantContext vc : tracker.getValues(variants, context.getLocation())) {
|
||||
for (VariantContext vc : tracker.getValues(variantCollection.variants, context.getLocation())) {
|
||||
if (samplesToPhase != null) vc = reduceVCToSamples(vc, samplesToPhase);
|
||||
|
||||
if (ReadBackedPhasingWalker.processVariantInPhasing(vc)) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
|||
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.Reference;
|
||||
import org.broadinstitute.sting.gatk.walkers.Requires;
|
||||
import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.Window;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
|
|
@ -64,8 +63,8 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
|
|||
* are techincally order dependent. It is strongly recommended to provide explicit names when
|
||||
* a rod priority list is provided.
|
||||
*/
|
||||
@Input(fullName = "variant", shortName = "V", doc="The VCF files to merge together", required=true)
|
||||
public List<RodBinding<VariantContext>> variantsToMerge;
|
||||
@Input(fullName="variant", shortName = "V", doc="Input VCF file", required=true)
|
||||
public List<RodBinding<VariantContext>> variants;
|
||||
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected VCFWriter vcfWriter = null;
|
||||
|
|
@ -157,7 +156,7 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
|
|||
|
||||
// get all of the vcf rods at this locus
|
||||
// Need to provide reference bases to simpleMerge starting at current locus
|
||||
Collection<VariantContext> vcs = tracker.getValues(variantsToMerge, context.getLocation());
|
||||
Collection<VariantContext> vcs = tracker.getValues(variants, context.getLocation());
|
||||
|
||||
if ( sitesOnlyVCF ) {
|
||||
vcs = VariantContextUtils.sitesOnlyVariantContexts(vcs);
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ package org.broadinstitute.sting.gatk.walkers.variantutils;
|
|||
import net.sf.samtools.Cigar;
|
||||
import net.sf.samtools.CigarElement;
|
||||
import net.sf.samtools.CigarOperator;
|
||||
import org.broadinstitute.sting.commandline.Input;
|
||||
import org.broadinstitute.sting.commandline.ArgumentCollection;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.commandline.RodBinding;
|
||||
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;
|
||||
|
|
@ -50,8 +50,9 @@ import java.util.*;
|
|||
@Reference(window=@Window(start=-200,stop=200))
|
||||
@Requires(value={})
|
||||
public class LeftAlignVariants extends RodWalker<Integer, Integer> {
|
||||
@Input(fullName="variant", shortName = "V", doc="Input VCF file", required=true)
|
||||
public RodBinding<VariantContext> variants;
|
||||
|
||||
@ArgumentCollection
|
||||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected VCFWriter baseWriter = null;
|
||||
|
|
@ -59,10 +60,11 @@ public class LeftAlignVariants extends RodWalker<Integer, Integer> {
|
|||
private SortingVCFWriter writer;
|
||||
|
||||
public void initialize() {
|
||||
Set<String> samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(variants.getName()));
|
||||
Map<String, VCFHeader> vcfHeaders = VCFUtils.getVCFHeadersFromRods(getToolkit(), Arrays.asList(variants.getName()));
|
||||
String trackName = variantCollection.variants.getName();
|
||||
Set<String> samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(trackName));
|
||||
Map<String, VCFHeader> vcfHeaders = VCFUtils.getVCFHeadersFromRods(getToolkit(), Arrays.asList(trackName));
|
||||
|
||||
Set<VCFHeaderLine> headerLines = vcfHeaders.get(variants.getName()).getMetaData();
|
||||
Set<VCFHeaderLine> headerLines = vcfHeaders.get(trackName).getMetaData();
|
||||
baseWriter.writeHeader(new VCFHeader(headerLines, samples));
|
||||
|
||||
writer = new SortingVCFWriter(baseWriter, 200);
|
||||
|
|
@ -72,7 +74,7 @@ public class LeftAlignVariants extends RodWalker<Integer, Integer> {
|
|||
if ( tracker == null )
|
||||
return 0;
|
||||
|
||||
Collection<VariantContext> VCs = tracker.getValues(variants, context.getLocation());
|
||||
Collection<VariantContext> VCs = tracker.getValues(variantCollection.variants, context.getLocation());
|
||||
|
||||
int changedSites = 0;
|
||||
for ( VariantContext vc : VCs )
|
||||
|
|
|
|||
|
|
@ -29,10 +29,8 @@ import net.sf.picard.liftover.LiftOver;
|
|||
import net.sf.picard.util.Interval;
|
||||
import net.sf.samtools.SAMFileHeader;
|
||||
import net.sf.samtools.SAMFileReader;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Input;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.commandline.RodBinding;
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
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;
|
||||
|
|
@ -52,8 +50,9 @@ import java.util.*;
|
|||
*/
|
||||
@Requires(value={})
|
||||
public class LiftoverVariants extends RodWalker<Integer, Integer> {
|
||||
@Input(fullName="variant", shortName = "V", doc="Input VCF file", required=true)
|
||||
public RodBinding<VariantContext> variants;
|
||||
|
||||
@ArgumentCollection
|
||||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Output(doc="File to which variants should be written",required=true)
|
||||
protected File file = null;
|
||||
|
|
@ -88,12 +87,13 @@ public class LiftoverVariants extends RodWalker<Integer, Integer> {
|
|||
throw new UserException.BadInput("the chain file you are using is not compatible with the reference you are trying to lift over to; please use the appropriate chain file for the given reference");
|
||||
}
|
||||
|
||||
Set<String> samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(variants.getName()));
|
||||
Map<String, VCFHeader> vcfHeaders = VCFUtils.getVCFHeadersFromRods(getToolkit(), Arrays.asList(variants.getName()));
|
||||
String trackName = variantCollection.variants.getName();
|
||||
Set<String> samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), Arrays.asList(trackName));
|
||||
Map<String, VCFHeader> vcfHeaders = VCFUtils.getVCFHeadersFromRods(getToolkit(), Arrays.asList(trackName));
|
||||
|
||||
Set<VCFHeaderLine> metaData = new HashSet<VCFHeaderLine>();
|
||||
if ( vcfHeaders.containsKey(variants.getName()) )
|
||||
metaData.addAll(vcfHeaders.get(variants.getName()).getMetaData());
|
||||
if ( vcfHeaders.containsKey(trackName) )
|
||||
metaData.addAll(vcfHeaders.get(trackName).getMetaData());
|
||||
if ( RECORD_ORIGINAL_LOCATION ) {
|
||||
metaData.add(new VCFInfoHeaderLine("OriginalChr", 1, VCFHeaderLineType.String, "Original contig name for the record"));
|
||||
metaData.add(new VCFInfoHeaderLine("OriginalStart", 1, VCFHeaderLineType.Integer, "Original start position for the record"));
|
||||
|
|
@ -146,7 +146,7 @@ public class LiftoverVariants extends RodWalker<Integer, Integer> {
|
|||
if ( tracker == null )
|
||||
return 0;
|
||||
|
||||
Collection<VariantContext> VCs = tracker.getValues(variants, context.getLocation());
|
||||
Collection<VariantContext> VCs = tracker.getValues(variantCollection.variants, context.getLocation());
|
||||
for ( VariantContext vc : VCs )
|
||||
convertAndWrite(vc, ref);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.variantutils;
|
||||
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
import org.broadinstitute.sting.gatk.arguments.StandardVariantContextInputArgumentCollection;
|
||||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
|
|
@ -61,8 +62,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> {
|
|||
* Variants from this file are sent through the filtering and modifying routines as directed
|
||||
* by the arguments to SelectVariants, and finally are emitted.
|
||||
*/
|
||||
@Input(fullName="variant", shortName = "V", doc="Select variants from this VCF file", required=true)
|
||||
public RodBinding<VariantContext> variants;
|
||||
@ArgumentCollection protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
/**
|
||||
* If provided, we will filter out variants that are "discordant" to the variants in this file
|
||||
|
|
@ -194,7 +194,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> {
|
|||
*/
|
||||
public void initialize() {
|
||||
// Get list of samples to include in the output
|
||||
List<String> rodNames = Arrays.asList(variants.getName());
|
||||
List<String> rodNames = Arrays.asList(variantCollection.variants.getName());
|
||||
|
||||
Map<String, VCFHeader> vcfRods = VCFUtils.getVCFHeadersFromRods(getToolkit(), rodNames);
|
||||
TreeSet<String> vcfSamples = new TreeSet<String>(SampleUtils.getSampleList(vcfRods, VariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE));
|
||||
|
|
@ -318,7 +318,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> {
|
|||
if ( tracker == null )
|
||||
return 0;
|
||||
|
||||
Collection<VariantContext> vcs = tracker.getValues(variants, context.getLocation());
|
||||
Collection<VariantContext> vcs = tracker.getValues(variantCollection.variants, context.getLocation());
|
||||
|
||||
if ( vcs == null || vcs.size() == 0) {
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -28,13 +28,10 @@ package org.broadinstitute.sting.gatk.walkers.variantutils;
|
|||
import org.broad.tribble.Feature;
|
||||
import org.broad.tribble.TribbleException;
|
||||
import org.broad.tribble.dbsnp.DbSNPFeature;
|
||||
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.commandline.*;
|
||||
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.datasources.rmd.ReferenceOrderedDataSource;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.refdata.features.DbSNPHelper;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
|
|
@ -56,8 +53,8 @@ import java.util.Set;
|
|||
@Requires(value={})
|
||||
public class ValidateVariants extends RodWalker<Integer, Integer> {
|
||||
|
||||
@Input(fullName="variant", shortName = "V", doc="Input VCF file", required=true)
|
||||
public RodBinding<VariantContext> variants;
|
||||
@ArgumentCollection
|
||||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
public enum ValidationType {
|
||||
ALL, REF, IDS, ALLELES, CHR_COUNTS
|
||||
|
|
@ -78,14 +75,14 @@ public class ValidateVariants extends RodWalker<Integer, Integer> {
|
|||
private File file = null;
|
||||
|
||||
public void initialize() {
|
||||
file = new File(variants.getSource());
|
||||
file = new File(variantCollection.variants.getSource());
|
||||
}
|
||||
|
||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) {
|
||||
if ( tracker == null )
|
||||
return 0;
|
||||
|
||||
Collection<VariantContext> VCs = tracker.getValues(variants, context.getLocation());
|
||||
Collection<VariantContext> VCs = tracker.getValues(variantCollection.variants, context.getLocation());
|
||||
for ( VariantContext vc : VCs )
|
||||
validate(vc, tracker, ref);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,10 @@
|
|||
|
||||
package org.broadinstitute.sting.gatk.walkers.variantutils;
|
||||
|
||||
import org.broadinstitute.sting.commandline.Input;
|
||||
import org.broadinstitute.sting.commandline.RodBinding;
|
||||
import org.broadinstitute.sting.commandline.*;
|
||||
import org.broadinstitute.sting.gatk.arguments.StandardVariantContextInputArgumentCollection;
|
||||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
|
|
@ -48,8 +46,8 @@ import java.util.*;
|
|||
@Requires(value={})
|
||||
public class VariantsToTable extends RodWalker<Integer, Integer> {
|
||||
|
||||
@Input(fullName="variant", shortName = "V", doc="Input VCF file", required=true)
|
||||
public RodBinding<VariantContext> variants;
|
||||
@ArgumentCollection
|
||||
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
|
||||
|
||||
@Output(doc="File to which results should be written",required=true)
|
||||
protected PrintStream out;
|
||||
|
|
@ -138,7 +136,7 @@ public class VariantsToTable extends RodWalker<Integer, Integer> {
|
|||
return 0;
|
||||
|
||||
if ( ++nRecords < MAX_RECORDS || MAX_RECORDS == -1 ) {
|
||||
for ( VariantContext vc : tracker.getValues(variants, context.getLocation())) {
|
||||
for ( VariantContext vc : tracker.getValues(variantCollection.variants, context.getLocation())) {
|
||||
if ( (keepMultiAllelic || vc.isBiallelic()) && ( showFiltered || vc.isNotFiltered() ) ) {
|
||||
List<String> vals = extractFields(vc, fieldsToTake, ALLOW_MISSING_DATA);
|
||||
out.println(Utils.join("\t", vals));
|
||||
|
|
|
|||
Loading…
Reference in New Issue