/** * convenience method for point events * * @return true if this is a SNP or ref site, false if it's an indel or mixed event */ public boolean isPointEvent() { return isSNP() || !isVariant(); }
/** * convenience method for point events * * @return true if this is a SNP or ref site, false if it's an indel or mixed event */ public boolean isPointEvent() { return isSNP() || !isVariant(); }
/** * convenience method for point events * * @return true if this is a SNP or ref site, false if it's an indel or mixed event */ public boolean isPointEvent() { return isSNP() || !isVariant(); }
public Map<String, Object> annotate(final RefMetaDataTracker tracker, final AnnotatorCompatible walker, final ReferenceContext ref, final Map<String, AlignmentContext> stratifiedContexts, final VariantContext vc, final Map<String, PerReadAlleleLikelihoodMap> stratifiedPerReadAlleleLikelihoodMap) { if ((vc.isSNP() || !vc.isVariant()) && stratifiedContexts != null) return annotatePileup(ref, stratifiedContexts, vc); else if (stratifiedPerReadAlleleLikelihoodMap != null && vc.isVariant()) return annotateWithLikelihoods(stratifiedPerReadAlleleLikelihoodMap, vc); else return null; }
/** Returns true if the variant is --NOT-- interesting enough to be included in metrics calculations. */ static private boolean isVariantExcluded(final VariantContext vc) { // If the entire record is not a variant, exclude it return !vc.isVariant() || vc.getGenotypes().stream().allMatch(Genotype::isHomRef); }
/** Returns true if the variant is --NOT-- interesting enough to be included in metrics calculations. */ static private boolean isVariantExcluded(final VariantContext vc) { // If the entire record is not a variant, exclude it return !vc.isVariant() || vc.getGenotypes().stream().allMatch(Genotype::isHomRef); }
protected Map<String, Object> makeEHAnnotation(final VariantContext vc) { final GenotypesContext genotypes = (founderIds == null || founderIds.isEmpty()) ? vc.getGenotypes() : vc.getGenotypes(founderIds); if (genotypes == null || !vc.isVariant()) return null; double EH = calculateEH(vc, genotypes); if (sampleCount < 1) return null; return Collections.singletonMap(getKeyNames().get(0), (Object) String.format("%.4f", EH)); }
protected Map<String, Object> makeCoeffAnnotation(final VariantContext vc) { final GenotypesContext genotypes = (founderIds == null || founderIds.isEmpty()) ? vc.getGenotypes() : vc.getGenotypes(founderIds); if (genotypes == null || genotypes.size() < MIN_SAMPLES || !vc.isVariant()) return null; final double F = calculateIC(vc, genotypes); if (heterozygosityUtils.getSampleCount() < MIN_SAMPLES) return null; return Collections.singletonMap(getKeyNames().get(0), (Object)String.format("%.4f", F)); }
public static boolean processVariantInPhasing(VariantContext vc) { return vc.isNotFiltered() && ((vc.isSNP() && vc.isBiallelic()) || !vc.isVariant()); // we can handle the non-variant case as well //return isUnfilteredBiallelicSNP(vc); }
public Map<String, Object> annotate(final RefMetaDataTracker tracker, final AnnotatorCompatible walker, final ReferenceContext ref, final Map<String, AlignmentContext> stratifiedContexts, final VariantContext vc, final Map<String, PerReadAlleleLikelihoodMap> stratifiedPerReadAlleleLikelihoodMap) { StringBuffer type = new StringBuffer(""); if ( vc.isVariant() && !vc.isBiallelic() ) type.append("MULTIALLELIC_"); if ( !vc.isIndel() ) { type.append(vc.getType().toString()); } else { if (vc.isSimpleInsertion()) type.append("INSERTION."); else if (vc.isSimpleDeletion()) type.append("DELETION."); else type.append("COMPLEX."); ArrayList<Integer> inds = IndelUtils.findEventClassificationIndex(vc, ref); type.append(IndelUtils.getIndelClassificationName(inds.get(0))); for (int i = 1; i < inds.size(); i++ ) { type.append("."); type.append(IndelUtils.getIndelClassificationName(inds.get(i))); } } Map<String, Object> map = new HashMap<>(); map.put(getKeyNames().get(0), String.format("%s", type)); return map; }
/** * Genotype-specific functions -- are the genotypes monomorphic w.r.t. to the alleles segregating at this * site? That is, is the number of alternate alleles among all fo the genotype == 0? * * @return true if it's monomorphic */ public boolean isMonomorphicInSamples() { if ( monomorphic == null ) monomorphic = ! isVariant() || (hasGenotypes() && getCalledChrCount(getReference()) == getCalledChrCount()); return monomorphic; }
/** * Genotype-specific functions -- are the genotypes monomorphic w.r.t. to the alleles segregating at this * site? That is, is the number of alternate alleles among all fo the genotype == 0? * * @return true if it's monomorphic */ public boolean isMonomorphicInSamples() { if ( monomorphic == null ) monomorphic = ! isVariant() || (hasGenotypes() && getCalledChrCount(getReference()) == getCalledChrCount()); return monomorphic; }
/** * Genotype-specific functions -- are the genotypes monomorphic w.r.t. to the alleles segregating at this * site? That is, is the number of alternate alleles among all fo the genotype == 0? * * @return true if it's monomorphic */ public boolean isMonomorphicInSamples() { if ( monomorphic == null ) monomorphic = ! isVariant() || (hasGenotypes() && getCalledChrCount(getReference()) == getCalledChrCount()); return monomorphic; }
private boolean isValidVariant( final VariantContext evalVC, final VariantContext trainVC, final boolean TRUST_ALL_POLYMORPHIC) { return trainVC != null && trainVC.isNotFiltered() && trainVC.isVariant() && checkVariationClass( evalVC, trainVC ) && (TRUST_ALL_POLYMORPHIC || !trainVC.hasGenotypes() || trainVC.isPolymorphicInSamples()); }
public enum GenotypeAssignmentMethod { /** * set all of the genotype GT values to NO_CALL */ SET_TO_NO_CALL, /** * set all of the genotype GT values to NO_CALL and remove annotations */ SET_TO_NO_CALL_NO_ANNOTATIONS, /** * Use the subsetted PLs to greedily assigned genotypes */ USE_PLS_TO_ASSIGN, /** * Try to match the original GT calls, if at all possible * * Suppose I have 3 alleles: A/B/C and the following samples: * * original_GT best_match to A/B best_match to A/C * S1 => A/A A/A A/A * S2 => A/B A/B A/A * S3 => B/B B/B A/A * S4 => B/C A/B A/C * S5 => C/C A/A C/C * * Basically, all alleles not in the subset map to ref. It means that het-alt genotypes
if ( AC == 0 && eval.isVariant() ) {
@Override public List<Object> getRelevantStates( final ReferenceContext ref, final RefMetaDataTracker tracker, final VariantContext comp, final String compName, final VariantContext eval, final String evalName, final String sampleName, final String FamilyName) { final List<Object> relevantStates = new ArrayList<Object>(); if (eval != null && eval.isVariant() && eval.hasAttribute(InfoFieldKey.EFFECT_KEY.getKeyName())) { final SnpEff.EffectType effectType = SnpEff.EffectType.valueOf( eval.getAttribute(InfoFieldKey.EFFECT_KEY.getKeyName()).toString()); if (SnpEffUtil.isSubTypeOf(effectType, EffectType.EXON)) relevantStates.add(PositionModifier.GENE.name()); if (SnpEffUtil.isSubTypeOf(effectType, EffectType.CDS)) relevantStates.add(PositionModifier.CODING_REGION.name()); if (SnpEffUtil.isSubTypeOf(effectType, EffectType.STOP_GAINED)) relevantStates.add(PositionModifier.STOP_GAINED.name()); if (SnpEffUtil.isSubTypeOf(effectType, EffectType.STOP_LOST)) relevantStates.add(PositionModifier.STOP_LOST.name()); if (SnpEffUtil.isSubTypeOf(effectType, EffectType.SPLICE_SITE_ACCEPTOR) || SnpEffUtil.isSubTypeOf(effectType, EffectType.SPLICE_SITE_DONOR)) relevantStates.add(PositionModifier.SPLICE_SITE.name()); } return relevantStates; } }
if ( !variants[i].getVariantContext().isVariant() ) throw new UserException.BadInput("The clustered SNPs filter does not work in the presence of non-variant records; see the documentation for more details"); if ( variants[currentIndex] != null && variants[currentIndex].getVariantContext() != null && variants[currentIndex].getVariantContext().isVariant() ) { if ( ++snpsSeen == snpThreshold ) { right = GATKVariantContextUtils.getLocation(genomeLocParser, variants[currentIndex].getVariantContext());
if ( !vc.isVariant() ) return null;
@Test(enabled = !DEBUG, dataProvider = "SplitBiallelics", dependsOnMethods = "testSplitBiallelicsNoGenotypes") public void testSplitBiallelicsGenotypes(final VariantContext vc, final List<VariantContext> expectedBiallelics) { final List<Genotype> genotypes = new ArrayList<Genotype>(); int sampleI = 0; for ( final List<Allele> alleles : Utils.makePermutations(vc.getAlleles(), 2, true) ) { genotypes.add(GenotypeBuilder.create("sample" + sampleI++, alleles)); } genotypes.add(GenotypeBuilder.createMissing("missing", 2)); final VariantContext vcWithGenotypes = new VariantContextBuilder(vc).genotypes(genotypes).make(); final List<VariantContext> biallelics = GATKVariantContextUtils.splitVariantContextToBiallelics(vcWithGenotypes); for ( int i = 0; i < biallelics.size(); i++ ) { final VariantContext actual = biallelics.get(i); Assert.assertEquals(actual.getNSamples(), vcWithGenotypes.getNSamples()); // not dropping any samples for ( final Genotype inputGenotype : genotypes ) { final Genotype actualGenotype = actual.getGenotype(inputGenotype.getSampleName()); Assert.assertNotNull(actualGenotype); if ( ! vc.isVariant() || vc.isBiallelic() ) Assert.assertEquals(actualGenotype, vcWithGenotypes.getGenotype(inputGenotype.getSampleName())); else Assert.assertTrue(actualGenotype.isNoCall()); } } }