GenotypeMap -> GenotypeCollection
This commit is contained in:
parent
9b5c79b49d
commit
1fbdcb4f43
|
|
@ -194,7 +194,7 @@ public class VariantContextAdaptors {
|
|||
return null; // we weren't given enough reference context to create the VariantContext
|
||||
Byte refBaseForIndel = new Byte(ref.getBases()[index]);
|
||||
|
||||
GenotypeMap genotypes = null;
|
||||
GenotypeCollection genotypes = null;
|
||||
VariantContext vc = new VariantContext(name, dbsnp.getChr(), dbsnp.getStart() - (sawNullAllele ? 1 : 0), dbsnp.getEnd() - (refAllele.isNull() ? 1 : 0), alleles, genotypes, VariantContext.NO_NEG_LOG_10PERROR, null, attributes, refBaseForIndel);
|
||||
return vc;
|
||||
} else
|
||||
|
|
@ -324,7 +324,7 @@ public class VariantContextAdaptors {
|
|||
String[] samples = hapmap.getSampleIDs();
|
||||
String[] genotypeStrings = hapmap.getGenotypes();
|
||||
|
||||
GenotypeMap genotypes = GenotypeMap.create(samples.length);
|
||||
GenotypeCollection genotypes = GenotypeCollection.create(samples.length);
|
||||
for ( int i = 0; i < samples.length; i++ ) {
|
||||
// ignore bad genotypes
|
||||
if ( genotypeStrings[i].contains("N") )
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
|
|||
import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
|
||||
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -55,18 +55,18 @@ public class AlleleBalance extends InfoFieldAnnotation {
|
|||
|
||||
if ( !vc.isBiallelic() )
|
||||
return null;
|
||||
final GenotypeMap genotypes = vc.getGenotypes();
|
||||
final GenotypeCollection genotypes = vc.getGenotypes();
|
||||
if ( !vc.hasGenotypes() )
|
||||
return null;
|
||||
|
||||
double ratio = 0.0;
|
||||
double totalWeights = 0.0;
|
||||
for ( Map.Entry<String, Genotype> genotype : genotypes.entrySet() ) {
|
||||
for ( Genotype genotype : genotypes ) {
|
||||
// we care only about het calls
|
||||
if ( !genotype.getValue().isHet() )
|
||||
if ( !genotype.isHet() )
|
||||
continue;
|
||||
|
||||
AlignmentContext context = stratifiedContexts.get(genotype.getKey());
|
||||
AlignmentContext context = stratifiedContexts.get(genotype.getSampleName());
|
||||
if ( context == null )
|
||||
continue;
|
||||
|
||||
|
|
@ -85,8 +85,8 @@ public class AlleleBalance extends InfoFieldAnnotation {
|
|||
continue;
|
||||
|
||||
// weight the allele balance by genotype quality so that e.g. mis-called homs don't affect the ratio too much
|
||||
ratio += genotype.getValue().getNegLog10PError() * ((double)refCount / (double)(refCount + altCount));
|
||||
totalWeights += genotype.getValue().getNegLog10PError();
|
||||
ratio += genotype.getNegLog10PError() * ((double)refCount / (double)(refCount + altCount));
|
||||
totalWeights += genotype.getNegLog10PError();
|
||||
} else if ( vc.isIndel() && context.hasExtendedEventPileup() ) {
|
||||
final ReadBackedExtendedEventPileup indelPileup = context.getExtendedEventPileup();
|
||||
if ( indelPileup == null ) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import org.broadinstitute.sting.utils.QualityUtils;
|
|||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -31,16 +31,14 @@ public class HardyWeinberg extends InfoFieldAnnotation implements WorkInProgress
|
|||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, AnnotatorCompatibleWalker walker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
|
||||
final GenotypeMap genotypes = vc.getGenotypes();
|
||||
final GenotypeCollection genotypes = vc.getGenotypes();
|
||||
if ( genotypes == null || genotypes.size() < MIN_SAMPLES )
|
||||
return null;
|
||||
|
||||
int refCount = 0;
|
||||
int hetCount = 0;
|
||||
int homCount = 0;
|
||||
for ( Map.Entry<String, Genotype> genotype : genotypes.entrySet() ) {
|
||||
Genotype g = genotype.getValue();
|
||||
|
||||
for ( final Genotype g : genotypes ) {
|
||||
if ( g.isNoCall() )
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import org.broadinstitute.sting.utils.MathUtils;
|
|||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -33,7 +33,7 @@ public class InbreedingCoeff extends InfoFieldAnnotation implements StandardAnno
|
|||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, AnnotatorCompatibleWalker walker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
|
||||
final GenotypeMap genotypes = vc.getGenotypes();
|
||||
final GenotypeCollection genotypes = vc.getGenotypes();
|
||||
if ( genotypes == null || genotypes.size() < MIN_SAMPLES )
|
||||
return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnota
|
|||
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -29,7 +29,7 @@ public class QualByDepth extends InfoFieldAnnotation implements StandardAnnotati
|
|||
if ( stratifiedContexts.size() == 0 )
|
||||
return null;
|
||||
|
||||
final GenotypeMap genotypes = vc.getGenotypes();
|
||||
final GenotypeCollection genotypes = vc.getGenotypes();
|
||||
if ( genotypes == null || genotypes.size() == 0 )
|
||||
return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import org.broadinstitute.sting.utils.collections.Pair;
|
|||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -33,7 +33,7 @@ public abstract class RankSumTest extends InfoFieldAnnotation implements Standar
|
|||
if ( stratifiedContexts.size() == 0 )
|
||||
return null;
|
||||
|
||||
final GenotypeMap genotypes = vc.getGenotypes();
|
||||
final GenotypeCollection genotypes = vc.getGenotypes();
|
||||
if ( genotypes == null || genotypes.size() == 0 )
|
||||
return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
|
|||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -217,11 +217,11 @@ public class VariantAnnotatorEngine {
|
|||
}
|
||||
}
|
||||
|
||||
private GenotypeMap annotateGenotypes(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
private GenotypeCollection annotateGenotypes(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
if ( requestedGenotypeAnnotations.size() == 0 )
|
||||
return vc.getGenotypes();
|
||||
|
||||
GenotypeMap genotypes = GenotypeMap.create(vc.getNSamples());
|
||||
GenotypeCollection genotypes = GenotypeCollection.create(vc.getNSamples());
|
||||
for ( Map.Entry<String, Genotype> g : vc.getGenotypes().entrySet() ) {
|
||||
Genotype genotype = g.getValue();
|
||||
AlignmentContext context = stratifiedContexts.get(g.getKey());
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
|||
byte refByte = ref.getBase();
|
||||
|
||||
// make new Genotypes based on Beagle results
|
||||
GenotypeMap genotypes = GenotypeMap.create(vc_input.getGenotypes().size());
|
||||
GenotypeCollection genotypes = GenotypeCollection.create(vc_input.getGenotypes().size());
|
||||
|
||||
// for each genotype, create a new object with Beagle information on it
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ public class BeagleOutputToVCFWalker extends RodWalker<Integer, Integer> {
|
|||
Double alleleFrequencyH = 0.0;
|
||||
int beagleVarCounts = 0;
|
||||
|
||||
GenotypeMap hapmapGenotypes = null;
|
||||
GenotypeCollection hapmapGenotypes = null;
|
||||
|
||||
if (vc_comp != null) {
|
||||
hapmapGenotypes = vc_comp.getGenotypes();
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.broadinstitute.sting.utils.SampleUtils;
|
|||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
|
||||
|
||||
|
|
@ -283,11 +283,11 @@ public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
|
|||
VariantContext vc = context.getVariantContext();
|
||||
|
||||
// make new Genotypes based on filters
|
||||
GenotypeMap genotypes;
|
||||
GenotypeCollection genotypes;
|
||||
if ( genotypeFilterExps.size() == 0 ) {
|
||||
genotypes = null;
|
||||
} else {
|
||||
genotypes = GenotypeMap.create(vc.getGenotypes().size());
|
||||
genotypes = GenotypeCollection.create(vc.getGenotypes().size());
|
||||
|
||||
// for each genotype, check filters then create a new object
|
||||
for ( Map.Entry<String, Genotype> genotype : vc.getGenotypes().entrySet() ) {
|
||||
|
|
|
|||
|
|
@ -26,17 +26,14 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.genotyper;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -86,7 +83,7 @@ public abstract class AlleleFrequencyCalculationModel implements Cloneable {
|
|||
*
|
||||
* @return calls
|
||||
*/
|
||||
protected abstract GenotypeMap assignGenotypes(VariantContext vc,
|
||||
protected abstract GenotypeCollection assignGenotypes(VariantContext vc,
|
||||
double[] log10AlleleFrequencyPosteriors,
|
||||
int AFofMaxLikelihood);
|
||||
}
|
||||
|
|
@ -26,14 +26,12 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.genotyper;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
|
@ -269,14 +267,14 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel {
|
|||
*
|
||||
* @return calls
|
||||
*/
|
||||
public GenotypeMap assignGenotypes(VariantContext vc,
|
||||
public GenotypeCollection assignGenotypes(VariantContext vc,
|
||||
double[] log10AlleleFrequencyPosteriors,
|
||||
int AFofMaxLikelihood) {
|
||||
if ( !vc.isVariant() )
|
||||
throw new UserException("The VCF record passed in does not contain an ALT allele at " + vc.getChr() + ":" + vc.getStart());
|
||||
|
||||
|
||||
GenotypeMap GLs = vc.getGenotypes();
|
||||
GenotypeCollection GLs = vc.getGenotypes();
|
||||
double[][] pathMetricArray = new double[GLs.size()+1][AFofMaxLikelihood+1];
|
||||
int[][] tracebackArray = new int[GLs.size()+1][AFofMaxLikelihood+1];
|
||||
|
||||
|
|
@ -343,7 +341,7 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel {
|
|||
}
|
||||
}
|
||||
|
||||
GenotypeMap calls = GenotypeMap.create();
|
||||
GenotypeCollection calls = GenotypeCollection.create();
|
||||
|
||||
int startIdx = AFofMaxLikelihood;
|
||||
for (int k = sampleIdx; k > 0; k--) {
|
||||
|
|
|
|||
|
|
@ -26,15 +26,13 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.genotyper;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
import org.broadinstitute.sting.utils.collections.Pair;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
|
@ -90,7 +88,7 @@ public class GridSearchAFEstimation extends AlleleFrequencyCalculationModel {
|
|||
*
|
||||
* @return calls
|
||||
*/
|
||||
protected GenotypeMap assignGenotypes(VariantContext vc,
|
||||
protected GenotypeCollection assignGenotypes(VariantContext vc,
|
||||
double[] log10AlleleFrequencyPosteriors,
|
||||
int AFofMaxLikelihood) {
|
||||
if ( !vc.isVariant() )
|
||||
|
|
@ -98,7 +96,7 @@ public class GridSearchAFEstimation extends AlleleFrequencyCalculationModel {
|
|||
|
||||
Allele refAllele = vc.getReference();
|
||||
Allele altAllele = vc.getAlternateAllele(0);
|
||||
GenotypeMap calls = GenotypeMap.create();
|
||||
GenotypeCollection calls = GenotypeCollection.create();
|
||||
|
||||
// first, the potential alt calls
|
||||
for ( String sample : AFMatrix.getSamples() ) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import org.broadinstitute.sting.utils.SampleUtils;
|
|||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ public class UGCallVariants extends RodWalker<VariantCallContext, Integer> {
|
|||
return null;
|
||||
|
||||
VariantContext variantVC = null;
|
||||
GenotypeMap genotypes = GenotypeMap.create();
|
||||
GenotypeCollection genotypes = GenotypeCollection.create();
|
||||
for ( VariantContext vc : VCs ) {
|
||||
if ( variantVC == null && vc.isVariant() )
|
||||
variantVC = vc;
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ public class UnifiedGenotyperEngine {
|
|||
alleles.add(refAllele);
|
||||
boolean addedAltAlleles = false;
|
||||
|
||||
GenotypeMap genotypes = GenotypeMap.create();
|
||||
GenotypeCollection genotypes = GenotypeCollection.create();
|
||||
for ( MultiallelicGenotypeLikelihoods GL : GLs.values() ) {
|
||||
if ( !addedAltAlleles ) {
|
||||
addedAltAlleles = true;
|
||||
|
|
@ -354,7 +354,7 @@ public class UnifiedGenotyperEngine {
|
|||
}
|
||||
|
||||
// create the genotypes
|
||||
GenotypeMap genotypes = afcm.get().assignGenotypes(vc, log10AlleleFrequencyPosteriors.get(), bestAFguess);
|
||||
GenotypeCollection genotypes = afcm.get().assignGenotypes(vc, log10AlleleFrequencyPosteriors.get(), bestAFguess);
|
||||
|
||||
// print out stats if we have a writer
|
||||
if ( verboseWriter != null )
|
||||
|
|
@ -491,7 +491,7 @@ public class UnifiedGenotyperEngine {
|
|||
}
|
||||
|
||||
// create the genotypes
|
||||
GenotypeMap genotypes = afcm.get().assignGenotypes(vc, log10AlleleFrequencyPosteriors.get(), bestAFguess);
|
||||
GenotypeCollection genotypes = afcm.get().assignGenotypes(vc, log10AlleleFrequencyPosteriors.get(), bestAFguess);
|
||||
|
||||
// *** note that calculating strand bias involves overwriting data structures, so we do that last
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>();
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
|||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.io.*;
|
||||
|
|
@ -1058,7 +1058,7 @@ public class SomaticIndelDetectorWalker extends ReadWalker<Integer,Integer> {
|
|||
stop += event_length;
|
||||
}
|
||||
|
||||
GenotypeMap genotypes = GenotypeMap.create();
|
||||
GenotypeCollection genotypes = GenotypeCollection.create();
|
||||
|
||||
for ( String sample : normalSamples ) {
|
||||
|
||||
|
|
@ -1148,7 +1148,7 @@ public class SomaticIndelDetectorWalker extends ReadWalker<Integer,Integer> {
|
|||
homRefAlleles.add( alleles.get(0));
|
||||
homRefAlleles.add( alleles.get(0));
|
||||
|
||||
GenotypeMap genotypes = GenotypeMap.create();
|
||||
GenotypeCollection genotypes = GenotypeCollection.create();
|
||||
|
||||
for ( String sample : normalSamples ) {
|
||||
genotypes.put(sample,new Genotype(sample, homRefN ? homRefAlleles : alleles,Genotype.NO_NEG_LOG_10PERROR,null,attrsNormal,false));
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ public class PhaseByTransmission extends RodWalker<Integer, Integer> {
|
|||
if (tracker != null) {
|
||||
VariantContext vc = tracker.getFirstValue(variantCollection.variants, context.getLocation());
|
||||
|
||||
GenotypeMap genotypeMap = vc.getGenotypes();
|
||||
GenotypeCollection genotypeCollection = vc.getGenotypes();
|
||||
|
||||
for (Trio trio : trios) {
|
||||
Genotype mother = vc.getGenotype(trio.getMother());
|
||||
|
|
@ -306,12 +306,12 @@ public class PhaseByTransmission extends RodWalker<Integer, Integer> {
|
|||
Genotype phasedFather = trioGenotypes.get(1);
|
||||
Genotype phasedChild = trioGenotypes.get(2);
|
||||
|
||||
genotypeMap.put(phasedMother.getSampleName(), phasedMother);
|
||||
genotypeMap.put(phasedFather.getSampleName(), phasedFather);
|
||||
genotypeMap.put(phasedChild.getSampleName(), phasedChild);
|
||||
genotypeCollection.put(phasedMother.getSampleName(), phasedMother);
|
||||
genotypeCollection.put(phasedFather.getSampleName(), phasedFather);
|
||||
genotypeCollection.put(phasedChild.getSampleName(), phasedChild);
|
||||
}
|
||||
|
||||
VariantContext newvc = VariantContext.modifyGenotypes(vc, genotypeMap);
|
||||
VariantContext newvc = VariantContext.modifyGenotypes(vc, genotypeCollection);
|
||||
|
||||
vcfWriter.add(newvc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
UnfinishedVariantContext uvc = uvr.unfinishedVariant;
|
||||
|
||||
// Perform per-sample phasing:
|
||||
GenotypeMap sampGenotypes = vc.getGenotypes();
|
||||
GenotypeCollection sampGenotypes = vc.getGenotypes();
|
||||
Map<String, PhaseCounts> samplePhaseStats = new TreeMap<String, PhaseCounts>();
|
||||
for (Map.Entry<String, Genotype> sampGtEntry : sampGenotypes.entrySet()) {
|
||||
String samp = sampGtEntry.getKey();
|
||||
|
|
@ -1123,7 +1123,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
private int start;
|
||||
private int stop;
|
||||
private Collection<Allele> alleles;
|
||||
private GenotypeMap genotypes;
|
||||
private GenotypeCollection genotypes;
|
||||
private double negLog10PError;
|
||||
private Set<String> filters;
|
||||
private Map<String, Object> attributes;
|
||||
|
|
@ -1134,7 +1134,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
|
|||
this.start = vc.getStart();
|
||||
this.stop = vc.getEnd();
|
||||
this.alleles = vc.getAlleles();
|
||||
this.genotypes = GenotypeMap.create(vc.getGenotypes()); // since vc.getGenotypes() is unmodifiable
|
||||
this.genotypes = GenotypeCollection.create(vc.getGenotypes()); // since vc.getGenotypes() is unmodifiable
|
||||
this.negLog10PError = vc.getNegLog10PError();
|
||||
this.filters = vc.filtersWereApplied() ? vc.getFilters() : null;
|
||||
this.attributes = new HashMap<String, Object>(vc.getAttributes());
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import org.broadinstitute.sting.gatk.walkers.varianteval.util.TableType;
|
|||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.MathUtils;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
@ -92,13 +92,13 @@ public class GenotypePhasingEvaluator extends VariantEvaluator {
|
|||
|
||||
Set<String> allSamples = new HashSet<String>();
|
||||
|
||||
GenotypeMap compSampGenotypes = null;
|
||||
GenotypeCollection compSampGenotypes = null;
|
||||
if (isRelevantToPhasing(comp)) {
|
||||
allSamples.addAll(comp.getSampleNames());
|
||||
compSampGenotypes = comp.getGenotypes();
|
||||
}
|
||||
|
||||
GenotypeMap evalSampGenotypes = null;
|
||||
GenotypeCollection evalSampGenotypes = null;
|
||||
if (isRelevantToPhasing(eval)) {
|
||||
allSamples.addAll(eval.getSampleNames());
|
||||
evalSampGenotypes = eval.getGenotypes();
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import org.broadinstitute.sting.utils.codecs.vcf.*;
|
|||
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -211,7 +211,7 @@ public class LeftAlignVariants extends RodWalker<Integer, Integer> {
|
|||
}
|
||||
|
||||
// create new Genotype objects
|
||||
GenotypeMap newGenotypes = GenotypeMap.create(vc.getNSamples());
|
||||
GenotypeCollection newGenotypes = GenotypeCollection.create(vc.getNSamples());
|
||||
for ( Map.Entry<String, Genotype> genotype : vc.getGenotypes().entrySet() ) {
|
||||
List<Allele> newAlleles = new ArrayList<Allele>();
|
||||
for ( Allele allele : genotype.getValue().getAlleles() ) {
|
||||
|
|
|
|||
|
|
@ -24,10 +24,8 @@
|
|||
|
||||
package org.broadinstitute.sting.gatk.walkers.variantutils;
|
||||
|
||||
import org.apache.poi.hpsf.Variant;
|
||||
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;
|
||||
import org.broadinstitute.sting.utils.text.XReadLines;
|
||||
|
|
@ -558,7 +556,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> {
|
|||
return (compVCs == null || compVCs.isEmpty());
|
||||
|
||||
// check if we find it in the variant rod
|
||||
GenotypeMap genotypes = vc.getGenotypes(samples);
|
||||
GenotypeCollection genotypes = vc.getGenotypes(samples);
|
||||
for (Genotype g : genotypes.values()) {
|
||||
if (sampleHasVariant(g)) {
|
||||
// There is a variant called (or filtered with not exclude filtered option set) that is not HomRef for at least one of the samples.
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public class VariantsToVCF extends RodWalker<Integer, Integer> {
|
|||
// set the appropriate sample name if necessary
|
||||
if ( sampleName != null && vc.hasGenotypes() && vc.hasGenotype(variants.getName()) ) {
|
||||
Genotype g = Genotype.modifyName(vc.getGenotype(variants.getName()), sampleName);
|
||||
GenotypeMap genotypes = GenotypeMap.create(1);
|
||||
GenotypeCollection genotypes = GenotypeCollection.create(1);
|
||||
genotypes.put(sampleName, g);
|
||||
vc = VariantContext.modifyGenotypes(vc, genotypes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ import org.broad.tribble.util.ParsingUtils;
|
|||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.io.*;
|
||||
|
|
@ -77,7 +76,7 @@ public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec,
|
|||
* @param pos position
|
||||
* @return a mapping of sample name to genotype object
|
||||
*/
|
||||
public abstract GenotypeMap createGenotypeMap(String str, List<Allele> alleles, String chr, int pos);
|
||||
public abstract GenotypeCollection createGenotypeMap(String str, List<Allele> alleles, String chr, int pos);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@ import org.broad.tribble.readers.LineReader;
|
|||
import org.broad.tribble.util.ParsingUtils;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -119,13 +118,13 @@ public class VCF3Codec extends AbstractVCFCodec {
|
|||
* @param pos position
|
||||
* @return a mapping of sample name to genotype object
|
||||
*/
|
||||
public GenotypeMap createGenotypeMap(String str, List<Allele> alleles, String chr, int pos) {
|
||||
public GenotypeCollection createGenotypeMap(String str, List<Allele> alleles, String chr, int pos) {
|
||||
if (genotypeParts == null)
|
||||
genotypeParts = new String[header.getColumnCount() - NUM_STANDARD_FIELDS];
|
||||
|
||||
int nParts = ParsingUtils.split(str, genotypeParts, VCFConstants.FIELD_SEPARATOR_CHAR);
|
||||
|
||||
GenotypeMap genotypes = GenotypeMap.create(nParts);
|
||||
GenotypeCollection genotypes = GenotypeCollection.create(nParts);
|
||||
|
||||
// get the format keys
|
||||
int nGTKeys = ParsingUtils.split(genotypeParts[0], genotypeKeyArray, VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@ import org.broad.tribble.readers.LineReader;
|
|||
import org.broad.tribble.util.ParsingUtils;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -146,13 +145,13 @@ public class VCFCodec extends AbstractVCFCodec {
|
|||
* @param alleles the list of alleles
|
||||
* @return a mapping of sample name to genotype object
|
||||
*/
|
||||
public GenotypeMap createGenotypeMap(String str, List<Allele> alleles, String chr, int pos) {
|
||||
public GenotypeCollection createGenotypeMap(String str, List<Allele> alleles, String chr, int pos) {
|
||||
if (genotypeParts == null)
|
||||
genotypeParts = new String[header.getColumnCount() - NUM_STANDARD_FIELDS];
|
||||
|
||||
int nParts = ParsingUtils.split(str, genotypeParts, VCFConstants.FIELD_SEPARATOR_CHAR);
|
||||
|
||||
GenotypeMap genotypes = GenotypeMap.create(nParts);
|
||||
GenotypeCollection genotypes = GenotypeCollection.create(nParts);
|
||||
|
||||
// get the format keys
|
||||
int nGTKeys = ParsingUtils.split(genotypeParts[0], genotypeKeyArray, VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
package org.broadinstitute.sting.utils.codecs.vcf;
|
||||
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -21,6 +19,6 @@ public interface VCFParser {
|
|||
* @param pos position
|
||||
* @return a mapping of sample name to genotype object
|
||||
*/
|
||||
public GenotypeMap createGenotypeMap(String str, List<Allele> alleles, String chr, int pos);
|
||||
public GenotypeCollection createGenotypeMap(String str, List<Allele> alleles, String chr, int pos);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.broadinstitute.sting.utils.codecs.vcf.StandardVCFWriter;
|
|||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
|
||||
import java.io.*;
|
||||
|
|
@ -146,16 +146,16 @@ public class GCF {
|
|||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
attributes.put("INFO", info);
|
||||
Byte refPadByte = refPad == 0 ? null : refPad;
|
||||
GenotypeMap genotypes = decodeGenotypes(header);
|
||||
GenotypeCollection genotypes = decodeGenotypes(header);
|
||||
|
||||
return new VariantContext(source, contig, start, stop, alleleMap, genotypes, negLog10PError, filters, attributes, refPadByte);
|
||||
}
|
||||
|
||||
private GenotypeMap decodeGenotypes(final GCFHeader header) {
|
||||
private GenotypeCollection decodeGenotypes(final GCFHeader header) {
|
||||
if ( genotypes.isEmpty() )
|
||||
return VariantContext.NO_GENOTYPES;
|
||||
else {
|
||||
GenotypeMap map = GenotypeMap.create();
|
||||
GenotypeCollection map = GenotypeCollection.create();
|
||||
|
||||
for ( int i = 0; i < genotypes.size(); i++ ) {
|
||||
final String sampleName = header.getSample(i);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,325 @@
|
|||
/*
|
||||
* 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.utils.variantcontext;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class GenotypeCollection implements List<Genotype> {
|
||||
public final static GenotypeCollection NO_GENOTYPES = new GenotypeCollection();
|
||||
|
||||
Map<String, Integer> sampleNameToOffset = null;
|
||||
boolean cacheIsInvalid = true;
|
||||
final ArrayList<Genotype> genotypes;
|
||||
boolean immutable = false;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// private constructors -- you have to use static create methods to make these classes
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
private GenotypeCollection() {
|
||||
this(10, false);
|
||||
}
|
||||
|
||||
private GenotypeCollection(final int n, final boolean immutable) {
|
||||
this(new ArrayList<Genotype>(n), immutable);
|
||||
}
|
||||
|
||||
private GenotypeCollection(final ArrayList<Genotype> genotypes, final boolean immutable) {
|
||||
this.genotypes = genotypes;
|
||||
this.immutable = immutable;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// public static factory methods
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
public static final GenotypeCollection create() {
|
||||
return new GenotypeCollection();
|
||||
}
|
||||
|
||||
public static final GenotypeCollection create(final int nGenotypes) {
|
||||
return new GenotypeCollection(nGenotypes, true);
|
||||
}
|
||||
|
||||
// todo -- differentiate between empty constructor and copy constructor
|
||||
// todo -- create constructor (Genotype ... genotypes)
|
||||
|
||||
public static final GenotypeCollection create(final ArrayList<Genotype> genotypes) {
|
||||
return new GenotypeCollection(genotypes, true);
|
||||
}
|
||||
|
||||
public static final GenotypeCollection copy(final GenotypeCollection toCopy) {
|
||||
return create(toCopy.genotypes);
|
||||
}
|
||||
|
||||
// public static final GenotypeMap create(final Collection<Genotype> genotypes) {
|
||||
// if ( genotypes == null )
|
||||
// return null; // todo -- really should return an empty map
|
||||
// else {
|
||||
// GenotypeMap genotypeMap = new GenotypeMap(genotypes.size(), false);
|
||||
// for ( final Genotype g : genotypes ) {
|
||||
// if ( genotypeMap.containsKey(g.getSampleName() ) )
|
||||
// throw new IllegalArgumentException("Duplicate genotype added to VariantContext: " + g);
|
||||
// genotypeMap.put(g.getSampleName(), g);
|
||||
// }
|
||||
//
|
||||
// //return genotypeMap.immutable(); // todo enable when we have time to dive into mutability issue
|
||||
// return genotypeMap;
|
||||
// }
|
||||
// }
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// Mutability methods
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
public final GenotypeCollection mutable() {
|
||||
immutable = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final GenotypeCollection immutable() {
|
||||
immutable = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMutable() {
|
||||
return ! immutable;
|
||||
}
|
||||
|
||||
public final void checkImmutability() {
|
||||
if ( immutable )
|
||||
throw new IllegalAccessError("GenotypeMap is currently immutable, but a mutator method was invoked on it");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// caches
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
private void invalidateCaches() {
|
||||
cacheIsInvalid = true;
|
||||
if ( sampleNameToOffset != null ) sampleNameToOffset.clear();
|
||||
}
|
||||
|
||||
private void buildCache() {
|
||||
cacheIsInvalid = false;
|
||||
|
||||
if ( sampleNameToOffset == null )
|
||||
sampleNameToOffset = new HashMap<String, Integer>(genotypes.size());
|
||||
|
||||
for ( int i = 0; i < genotypes.size(); i++ )
|
||||
sampleNameToOffset.put(genotypes.get(i).getSampleName(), i);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// Map methods
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
checkImmutability();
|
||||
genotypes.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return genotypes.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return genotypes.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(final Genotype genotype) {
|
||||
checkImmutability();
|
||||
invalidateCaches();
|
||||
return genotypes.add(genotype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(final int i, final Genotype genotype) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final Collection<? extends Genotype> genotypes) {
|
||||
checkImmutability();
|
||||
invalidateCaches();
|
||||
return this.genotypes.addAll(genotypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(final int i, final Collection<? extends Genotype> genotypes) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(final Object o) {
|
||||
return this.genotypes.contains(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(final Collection<?> objects) {
|
||||
return this.genotypes.containsAll(objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Genotype get(final int i) {
|
||||
return genotypes.get(i);
|
||||
}
|
||||
|
||||
public Genotype get(final String sampleName) {
|
||||
buildCache();
|
||||
Integer offset = sampleNameToOffset.get(sampleName);
|
||||
if ( offset == null )
|
||||
throw new IllegalArgumentException("Sample " + sampleName + " not found in this GenotypeCollection");
|
||||
return genotypes.get(offset);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int indexOf(final Object o) {
|
||||
return genotypes.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Genotype> iterator() {
|
||||
return genotypes.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(final Object o) {
|
||||
return genotypes.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<Genotype> listIterator() {
|
||||
// todo -- must be immutable
|
||||
return genotypes.listIterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<Genotype> listIterator(final int i) {
|
||||
// todo -- must be immutable
|
||||
return genotypes.listIterator(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Genotype remove(final int i) {
|
||||
checkImmutability();
|
||||
invalidateCaches();
|
||||
return genotypes.remove(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(final Object o) {
|
||||
checkImmutability();
|
||||
invalidateCaches();
|
||||
return genotypes.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(final Collection<?> objects) {
|
||||
checkImmutability();
|
||||
invalidateCaches();
|
||||
return genotypes.removeAll(objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(final Collection<?> objects) {
|
||||
checkImmutability();
|
||||
invalidateCaches();
|
||||
return genotypes.retainAll(objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Genotype set(final int i, final Genotype genotype) {
|
||||
checkImmutability();
|
||||
invalidateCaches();
|
||||
return genotypes.set(i, genotype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Genotype> subList(final int i, final int i1) {
|
||||
return genotypes.subList(i, i1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return genotypes.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T[] toArray(final T[] ts) {
|
||||
return genotypes.toArray(ts);
|
||||
}
|
||||
|
||||
public Iterable<Genotype> iterateInOrder(final Iterable<String> sampleNamesInOrder) {
|
||||
return new Iterable<Genotype>() {
|
||||
@Override
|
||||
public Iterator<Genotype> iterator() {
|
||||
return new InOrderIterator(sampleNamesInOrder.iterator());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private final class InOrderIterator implements Iterator<Genotype> {
|
||||
final Iterator<String> sampleNamesInOrder;
|
||||
|
||||
private InOrderIterator(final Iterator<String> sampleNamesInOrder) {
|
||||
this.sampleNamesInOrder = sampleNamesInOrder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return sampleNamesInOrder.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Genotype next() {
|
||||
return get(sampleNamesInOrder.next());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,191 +0,0 @@
|
|||
/*
|
||||
* 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.utils.variantcontext;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class GenotypeMap implements Map<String, Genotype> {
|
||||
final TreeMap<String, Genotype> genotypes;
|
||||
boolean immutable = false;
|
||||
public final static GenotypeMap NO_GENOTYPES = new GenotypeMap();
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// private constructors -- you have to use static create methods to make these classes
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
private GenotypeMap() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
private GenotypeMap(boolean immutable) {
|
||||
this(new TreeMap<String, Genotype>(), immutable);
|
||||
}
|
||||
|
||||
private GenotypeMap(final TreeMap<String, Genotype> genotypes, final boolean immutable) {
|
||||
this.genotypes = genotypes;
|
||||
this.immutable = immutable;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// public static factory methods
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
public static final GenotypeMap create() {
|
||||
return new GenotypeMap();
|
||||
}
|
||||
|
||||
public static final GenotypeMap create(final int nGenotypes) {
|
||||
return new GenotypeMap();
|
||||
}
|
||||
|
||||
public static final GenotypeMap create(final GenotypeMap genotypes) {
|
||||
return create(genotypes.values());
|
||||
}
|
||||
|
||||
// todo -- differentiate between empty constructor and copy constructor
|
||||
// todo -- create constructor (Genotype ... genotypes)
|
||||
|
||||
public static final GenotypeMap create(final Map<String, Genotype> genotypes) {
|
||||
return create(genotypes.values());
|
||||
}
|
||||
|
||||
public static final GenotypeMap create(final Collection<Genotype> genotypes) {
|
||||
if ( genotypes == null )
|
||||
return null; // todo -- really should return an empty map
|
||||
else {
|
||||
GenotypeMap genotypeMap = new GenotypeMap().mutable();
|
||||
for ( final Genotype g : genotypes ) {
|
||||
if ( genotypeMap.containsKey(g.getSampleName() ) )
|
||||
throw new IllegalArgumentException("Duplicate genotype added to VariantContext: " + g);
|
||||
genotypeMap.put(g.getSampleName(), g);
|
||||
}
|
||||
|
||||
//return genotypeMap.immutable(); // todo enable when we have time to dive into mutability issue
|
||||
return genotypeMap;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// Mutability methods
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
public final GenotypeMap mutable() {
|
||||
immutable = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final GenotypeMap immutable() {
|
||||
immutable = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMutable() {
|
||||
return ! immutable;
|
||||
}
|
||||
|
||||
public final void checkImmutability() {
|
||||
if ( immutable )
|
||||
throw new IllegalAccessError("GenotypeMap is currently immutable, but a mutator method was invoked on it");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// Map methods
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
checkImmutability();
|
||||
genotypes.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return genotypes.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return genotypes.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(final Object o) {
|
||||
return genotypes.containsKey(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(final Object o) {
|
||||
return genotypes.containsValue(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Genotype get(final Object o) {
|
||||
return genotypes.get(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Genotype put(final String s, final Genotype genotype) {
|
||||
checkImmutability();
|
||||
return genotypes.put(s, genotype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Genotype remove(final Object o) {
|
||||
checkImmutability();
|
||||
return genotypes.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(final Map<? extends String, ? extends Genotype> map) {
|
||||
checkImmutability();
|
||||
genotypes.putAll(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> keySet() {
|
||||
return Collections.unmodifiableSet(genotypes.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Genotype> values() {
|
||||
return genotypes.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<String, Genotype>> entrySet() {
|
||||
return genotypes.entrySet();
|
||||
}
|
||||
}
|
||||
|
|
@ -184,12 +184,12 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
final protected List<Allele> alleles;
|
||||
|
||||
/** A mapping from sampleName -> genotype objects for all genotypes associated with this context */
|
||||
protected GenotypeMap genotypes = null;
|
||||
protected GenotypeCollection genotypes = null;
|
||||
|
||||
/** Counts for each of the possible Genotype types in this context */
|
||||
protected int[] genotypeCounts = null;
|
||||
|
||||
public final static GenotypeMap NO_GENOTYPES = GenotypeMap.NO_GENOTYPES;
|
||||
public final static GenotypeCollection NO_GENOTYPES = GenotypeCollection.NO_GENOTYPES;
|
||||
|
||||
// a fast cached access point to the ref / alt alleles for biallelic case
|
||||
private Allele REF = null;
|
||||
|
|
@ -222,7 +222,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
* @param attributes attributes
|
||||
* @param referenceBaseForIndel padded reference base
|
||||
*/
|
||||
public VariantContext(String source, String contig, long start, long stop, Collection<Allele> alleles, GenotypeMap genotypes, double negLog10PError, Set<String> filters, Map<String, Object> attributes, Byte referenceBaseForIndel) {
|
||||
public VariantContext(String source, String contig, long start, long stop, Collection<Allele> alleles, GenotypeCollection genotypes, double negLog10PError, Set<String> filters, Map<String, Object> attributes, Byte referenceBaseForIndel) {
|
||||
this(source, contig, start, stop, alleles, genotypes, negLog10PError, filters, attributes, referenceBaseForIndel, false);
|
||||
}
|
||||
|
||||
|
|
@ -239,7 +239,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
* @param filters filters: use null for unfiltered and empty set for passes filters
|
||||
* @param attributes attributes
|
||||
*/
|
||||
public VariantContext(String source, String contig, long start, long stop, Collection<Allele> alleles, GenotypeMap genotypes, double negLog10PError, Set<String> filters, Map<String, Object> attributes) {
|
||||
public VariantContext(String source, String contig, long start, long stop, Collection<Allele> alleles, GenotypeCollection genotypes, double negLog10PError, Set<String> filters, Map<String, Object> attributes) {
|
||||
this(source, contig, start, stop, alleles, genotypes, negLog10PError, filters, attributes, null, false);
|
||||
}
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
*/
|
||||
public VariantContext(String source, String contig, long start, long stop, Collection<Allele> alleles, Collection<Genotype> genotypes, double negLog10PError, Set<String> filters, Map<String, Object> attributes) {
|
||||
this(source, contig, start, stop, alleles,
|
||||
GenotypeMap.create(genotypes),
|
||||
GenotypeCollection.create(genotypes),
|
||||
negLog10PError, filters, attributes, null, false);
|
||||
}
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
* @param genotypesAreUnparsed true if the genotypes have not yet been parsed
|
||||
*/
|
||||
private VariantContext(String source, String contig, long start, long stop,
|
||||
Collection<Allele> alleles, GenotypeMap genotypes,
|
||||
Collection<Allele> alleles, GenotypeCollection genotypes,
|
||||
double negLog10PError, Set<String> filters, Map<String, Object> attributes,
|
||||
Byte referenceBaseForIndel, boolean genotypesAreUnparsed) {
|
||||
if ( contig == null ) { throw new IllegalArgumentException("Contig cannot be null"); }
|
||||
|
|
@ -383,7 +383,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
//
|
||||
// ---------------------------------------------------------------------------------------------------------
|
||||
|
||||
public static VariantContext modifyGenotypes(VariantContext vc, GenotypeMap genotypes) {
|
||||
public static VariantContext modifyGenotypes(VariantContext vc, GenotypeCollection genotypes) {
|
||||
return new VariantContext(vc.getSource(), vc.getChr(), vc.getStart(), vc.getEnd(), vc.getAlleles(), genotypes, vc.getNegLog10PError(), vc.filtersWereApplied() ? vc.getFilters() : null, new HashMap<String, Object>(vc.getAttributes()), vc.getReferenceBaseForIndel(), false);
|
||||
}
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
*/
|
||||
public VariantContext subContextFromGenotypes(Collection<Genotype> genotypes, Collection<Allele> alleles) {
|
||||
return new VariantContext(getSource(), contig, start, stop, alleles,
|
||||
GenotypeMap.create(genotypes),
|
||||
GenotypeCollection.create(genotypes),
|
||||
getNegLog10PError(),
|
||||
filtersWereApplied() ? getFilters() : null,
|
||||
getAttributes(),
|
||||
|
|
@ -890,7 +890,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
/**
|
||||
* @return set of all Genotypes associated with this context
|
||||
*/
|
||||
public GenotypeMap getGenotypes() {
|
||||
public GenotypeCollection getGenotypes() {
|
||||
loadGenotypes();
|
||||
return genotypes;
|
||||
}
|
||||
|
|
@ -909,7 +909,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
* @return
|
||||
* @throws IllegalArgumentException if sampleName isn't bound to a genotype
|
||||
*/
|
||||
public GenotypeMap getGenotypes(String sampleName) {
|
||||
public GenotypeCollection getGenotypes(String sampleName) {
|
||||
return getGenotypes(Arrays.asList(sampleName));
|
||||
}
|
||||
|
||||
|
|
@ -921,8 +921,8 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
* @return
|
||||
* @throws IllegalArgumentException if sampleName isn't bound to a genotype
|
||||
*/
|
||||
public GenotypeMap getGenotypes(Collection<String> sampleNames) {
|
||||
GenotypeMap map = GenotypeMap.create(sampleNames.size());
|
||||
public GenotypeCollection getGenotypes(Collection<String> sampleNames) {
|
||||
GenotypeCollection map = GenotypeCollection.create(sampleNames.size());
|
||||
|
||||
for ( String name : sampleNames ) {
|
||||
if ( map.containsKey(name) ) throw new IllegalArgumentException("Duplicate names detected in requested samples " + sampleNames);
|
||||
|
|
@ -1465,8 +1465,8 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
Byte refByte = inputVC.getReferenceBaseForIndel();
|
||||
|
||||
List<Allele> alleles = new ArrayList<Allele>();
|
||||
GenotypeMap genotypes = GenotypeMap.create();
|
||||
GenotypeMap inputGenotypes = inputVC.getGenotypes();
|
||||
GenotypeCollection genotypes = GenotypeCollection.create();
|
||||
GenotypeCollection inputGenotypes = inputVC.getGenotypes();
|
||||
|
||||
for (Allele a : inputVC.getAlleles()) {
|
||||
// get bases for current allele and create a new one with trimmed bases
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class VariantContextUtils {
|
|||
* @return VariantContext object
|
||||
*/
|
||||
public static VariantContext toVC(String name, GenomeLoc loc, Collection<Allele> alleles, Collection<Genotype> genotypes, double negLog10PError, Set<String> filters, Map<String, Object> attributes) {
|
||||
return new VariantContext(name, loc.getContig(), loc.getStart(), loc.getStop(), alleles, GenotypeMap.create(genotypes), negLog10PError, filters, attributes);
|
||||
return new VariantContext(name, loc.getContig(), loc.getStart(), loc.getStop(), alleles, GenotypeCollection.create(genotypes), negLog10PError, filters, attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -350,7 +350,7 @@ public class VariantContextUtils {
|
|||
if ( vc.hasID() ) attributes.put(VariantContext.ID_KEY, vc.getID());
|
||||
|
||||
// Genotypes
|
||||
final GenotypeMap genotypes = GenotypeMap.create(vc.getNSamples());
|
||||
final GenotypeCollection genotypes = GenotypeCollection.create(vc.getNSamples());
|
||||
for ( final Genotype g : vc.getGenotypes().values() ) {
|
||||
Map<String, Object> genotypeAttributes = subsetAttributes(g.commonInfo, keysToPreserve);
|
||||
genotypes.put(g.getSampleName(),
|
||||
|
|
@ -458,7 +458,7 @@ public class VariantContextUtils {
|
|||
final Map<String, Object> attributesWithMaxAC = new TreeMap<String, Object>();
|
||||
double negLog10PError = -1;
|
||||
VariantContext vcWithMaxAC = null;
|
||||
GenotypeMap genotypes = GenotypeMap.create();
|
||||
GenotypeCollection genotypes = GenotypeCollection.create();
|
||||
|
||||
// counting the number of filtered and variant VCs
|
||||
int nFiltered = 0;
|
||||
|
|
@ -648,7 +648,7 @@ public class VariantContextUtils {
|
|||
// nothing to do if we don't need to trim bases
|
||||
if (trimVC) {
|
||||
List<Allele> alleles = new ArrayList<Allele>();
|
||||
GenotypeMap genotypes = GenotypeMap.create();
|
||||
GenotypeCollection genotypes = GenotypeCollection.create();
|
||||
|
||||
// set the reference base for indels in the attributes
|
||||
Map<String,Object> attributes = new TreeMap<String,Object>(inputVC.getAttributes());
|
||||
|
|
@ -702,8 +702,8 @@ public class VariantContextUtils {
|
|||
return inputVC;
|
||||
}
|
||||
|
||||
public static GenotypeMap stripPLs(GenotypeMap genotypes) {
|
||||
GenotypeMap newGs = GenotypeMap.create(genotypes.size());
|
||||
public static GenotypeCollection stripPLs(GenotypeCollection genotypes) {
|
||||
GenotypeCollection newGs = GenotypeCollection.create(genotypes.size());
|
||||
|
||||
for ( Map.Entry<String, Genotype> g : genotypes.entrySet() ) {
|
||||
newGs.put(g.getKey(), g.getValue().hasLikelihoods() ? removePLs(g.getValue()) : g.getValue());
|
||||
|
|
@ -883,7 +883,7 @@ public class VariantContextUtils {
|
|||
}
|
||||
}
|
||||
|
||||
private static void mergeGenotypes(GenotypeMap mergedGenotypes, VariantContext oneVC, AlleleMapper alleleMapping, boolean uniqifySamples) {
|
||||
private static void mergeGenotypes(GenotypeCollection mergedGenotypes, VariantContext oneVC, AlleleMapper alleleMapping, boolean uniqifySamples) {
|
||||
for ( Genotype g : oneVC.getGenotypes().values() ) {
|
||||
String name = mergedSampleName(oneVC.getSource(), g.getSampleName(), uniqifySamples);
|
||||
if ( ! mergedGenotypes.containsKey(name) ) {
|
||||
|
|
@ -923,7 +923,7 @@ public class VariantContextUtils {
|
|||
}
|
||||
|
||||
// create new Genotype objects
|
||||
GenotypeMap newGenotypes = GenotypeMap.create(vc.getNSamples());
|
||||
GenotypeCollection newGenotypes = GenotypeCollection.create(vc.getNSamples());
|
||||
for ( Map.Entry<String, Genotype> genotype : vc.getGenotypes().entrySet() ) {
|
||||
List<Allele> newAlleles = new ArrayList<Allele>();
|
||||
for ( Allele allele : genotype.getValue().getAlleles() ) {
|
||||
|
|
@ -943,7 +943,7 @@ public class VariantContextUtils {
|
|||
if ( allowedAttributes == null )
|
||||
return vc;
|
||||
|
||||
GenotypeMap newGenotypes = GenotypeMap.create(vc.getNSamples());
|
||||
GenotypeCollection newGenotypes = GenotypeCollection.create(vc.getNSamples());
|
||||
for ( Map.Entry<String, Genotype> genotype : vc.getGenotypes().entrySet() ) {
|
||||
Map<String, Object> attrs = new HashMap<String, Object>();
|
||||
for ( Map.Entry<String, Object> attr : genotype.getValue().getAttributes().entrySet() ) {
|
||||
|
|
@ -1022,7 +1022,7 @@ public class VariantContextUtils {
|
|||
}
|
||||
MergedAllelesData mergeData = new MergedAllelesData(intermediateBases, vc1, vc2); // ensures that the reference allele is added
|
||||
|
||||
GenotypeMap mergedGenotypes = GenotypeMap.create();
|
||||
GenotypeCollection mergedGenotypes = GenotypeCollection.create();
|
||||
for (Map.Entry<String, Genotype> gt1Entry : vc1.getGenotypes().entrySet()) {
|
||||
String sample = gt1Entry.getKey();
|
||||
Genotype gt1 = gt1Entry.getValue();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import org.broad.tribble.Tribble;
|
|||
import org.broad.tribble.readers.AsciiLineReader;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Genotype;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeMap;
|
||||
import org.broadinstitute.sting.utils.variantcontext.GenotypeCollection;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.codecs.vcf.*;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
|
|
@ -122,7 +122,7 @@ public class VCFWriterUnitTest extends BaseTest {
|
|||
List<Allele> alleles = new ArrayList<Allele>();
|
||||
Set<String> filters = null;
|
||||
Map<String, Object> attributes = new HashMap<String,Object>();
|
||||
GenotypeMap genotypes = GenotypeMap.create();
|
||||
GenotypeCollection genotypes = GenotypeCollection.create();
|
||||
|
||||
alleles.add(Allele.create("-",true));
|
||||
alleles.add(Allele.create("CC",false));
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class VariantContextUtilsUnitTest extends BaseTest {
|
|||
int start = 10;
|
||||
int stop = start; // alleles.contains(ATC) ? start + 3 : start;
|
||||
return new VariantContext(source, "1", start, stop, alleles,
|
||||
GenotypeMap.create(genotypes), 1.0, filters, null, Cref.getBases()[0]);
|
||||
GenotypeCollection.create(genotypes), 1.0, filters, null, Cref.getBases()[0]);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue