public boolean isHomRef() { return vcfGenotype.isHomRef(); }
/** Tests to ensure that a locus is bi-allelic within the given set of samples. */ private boolean isVariant(final Genotype... gts) { for (final Genotype gt : gts) { if (gt.isCalled() && !gt.isHomRef()) return true; } return false; }
/** Tests to ensure that a locus is bi-allelic within the given set of samples. */ private boolean isVariant(final Genotype... gts) { for (final Genotype gt : gts) { if (gt.isCalled() && !gt.isHomRef()) return true; } return false; }
/** * @return true if all observed alleles are the same (regardless of whether they are ref or alt); if any alleles are no-calls, this method will return false. */ public boolean isHom() { return isHomRef() || isHomVar(); }
/** * @return true if all observed alleles are the same (regardless of whether they are ref or alt); if any alleles are no-calls, this method will return false. */ public boolean isHom() { return isHomRef() || isHomVar(); }
/** * @return true if all observed alleles are the same (regardless of whether they are ref or alt); if any alleles are no-calls, this method will return false. */ public boolean isHom() { return isHomRef() || isHomVar(); }
/** * Decides whether or not to choose the reference haplotype, depending on the given genotype * * @param g the genotype of the given sample * @param pReferenceGivenHet probability of choosing reference for hets * * @return true if one should use the reference haplotype, false otherwise */ private boolean chooseRefHaplotype(final Genotype g, final double pReferenceGivenHet) { final double refP; if ( g.isHomRef() ) refP = 1; else if ( g.isHet() ) refP = pReferenceGivenHet; else refP = 0.0; return ran.nextDouble() < refP; }
private boolean sampleHasVariant(final Genotype g) { return (g !=null && !g.isHomRef() && (g.isCalled() || (g.isFiltered() && !XLfiltered))); }
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.isMonomorphicInSamples() || !vc.hasGenotypes() ) return null; final StringBuilder samples = new StringBuilder(); for ( Genotype genotype : vc.getGenotypesOrderedByName() ) { if ( genotype.isCalled() && !genotype.isHomRef() ){ if ( samples.length() > 0 ) samples.append(","); samples.append(genotype.getSampleName()); } } if ( samples.length() == 0 ) return null; Map<String, Object> map = new HashMap<String, Object>(); map.put(getKeyNames().get(0), samples.toString()); return map; }
/** * Evaluate the genotypes of mom, dad, and child to detect Mendelian violations * * @param gMom * @param gDad * @param gChild * @return true if the three genotypes represent a Mendelian violation; false otherwise */ public static boolean isViolation(final Genotype gMom, final Genotype gDad, final Genotype gChild) { //1 parent is no "call if(!gMom.isCalled()){ return (gDad.isHomRef() && gChild.isHomVar()) || (gDad.isHomVar() && gChild.isHomRef()); } else if(!gDad.isCalled()){ return (gMom.isHomRef() && gChild.isHomVar()) || (gMom.isHomVar() && gChild.isHomRef()); } //Both parents have genotype information return !(gMom.getAlleles().contains(gChild.getAlleles().get(0)) && gDad.getAlleles().contains(gChild.getAlleles().get(1)) || gMom.getAlleles().contains(gChild.getAlleles().get(1)) && gDad.getAlleles().contains(gChild.getAlleles().get(0))); }
private boolean doAllelesMatch(final Genotype eval, final Genotype truth, final Allele truthRef, final Set<Allele> truthSiteAlleles) { // When determining if alleles match, there are a number of cases to consider. In order: // 1) If either genotype is uncalled or unavailable, the alleles MATCH // 2) If the truth genotype is hom ref, then: // a) If the truth variant is mononallelic (no alternate alleles), the alleles MATCH // b) Otherwise, the alleles match IFF the alleles in the eval genotype are a subset // of the alleles in the truth VARIANT // 3) Otherwise, the alleles match IFF the alleles in the eval genotype are a subset // of the alleles in (the truth GENOTYPE + the truth REF allele) boolean matching = true; if (eval.isCalled() && truth.isCalled()) { // Case 1 if (truth.isHomRef()) { // Case 2 matching = truthSiteAlleles.size() == 1 || truthSiteAlleles.containsAll(eval.getAlleles()); } else { // Case 3 final Set<Allele> truthAlleles = new HashSet<>(truth.getAlleles()); truthAlleles.add(truthRef); matching = truthAlleles.containsAll(eval.getAlleles()); } } return matching; }
private byte getStandardEncoding(Genotype g, int offset) { byte b; if ( ! checkGQIsGood(g) ) { b = NO_CALL; } else if ( g.isHomRef() ) { b = HOM_REF; } else if ( g.isHomVar() ) { b = HOM_VAR; } else if ( g.isHet() ) { b = HET; } else { b = NO_CALL; } return (byte) (b << (2*offset)); }
private byte getFlippedEncoding(Genotype g, int offset) { byte b; if ( ! checkGQIsGood(g) ) { b = NO_CALL; } else if ( g.isHomRef() ) { b = HOM_VAR; } else if ( g.isHomVar() ) { b = HOM_REF; } else if ( g.isHet() ) { b = HET; } else { b = NO_CALL; } return (byte) (b << (2*offset)); }
private void checkCoverage(Genotype gt, Builder<String> builder, GenotypeFilterImpl impl) { if (gt.isHet()) { if (impl.getCoverage(gt) < options.getMinGtCovHet()) builder.add(ThresholdFilterHeaderExtender.FILTER_GT_MIN_COV_HET); } else if (!gt.isHomRef()) { if (impl.getCoverage(gt) < options.getMinGtCovHomAlt()) builder.add(ThresholdFilterHeaderExtender.FILTER_GT_MIN_COV_HOM_ALT); } if (impl.getCoverage(gt) > options.getMaxCov()) builder.add(ThresholdFilterHeaderExtender.FILTER_GT_MAX_COV); }
private void checkAaf(Genotype gt, Builder<String> builder, GenotypeFilterImpl impl) { if (gt.isHet()) { if (impl.getAlternativeAlleleFraction(gt) < options.getMinGtAafHet()) builder.add(ThresholdFilterHeaderExtender.FILTER_GT_MIN_AAF_HET); if (impl.getAlternativeAlleleFraction(gt) > options.getMaxGtAafHet()) builder.add(ThresholdFilterHeaderExtender.FILTER_GT_MAX_AAF_HET); } else if (gt.isHomRef()) { if (impl.getAlternativeAlleleFraction(gt) > options.getMaxGtAafHomRef()) builder.add(ThresholdFilterHeaderExtender.FILTER_GT_MAX_AAF_HOM_REF); } else { if (impl.getAlternativeAlleleFraction(gt) < options.getMinGtAafHomAlt()) builder.add(ThresholdFilterHeaderExtender.FILTER_GT_MIN_AAF_HOM_ALT); } }
private void putContig(VariantContext vc, String sampleName) { final Statistics stats = perSampleStats.get(sampleName); if (sampleName == null) { stats.putContig(vc.getContig()); } else { final Genotype gt = vc.getGenotype(sampleName); if (!gt.isHomRef() && !gt.isNoCall()) stats.putContig(vc.getContig()); } }
/** Incorporates the provided variant's data into the metric analysis. */ @Override public void accumulate(final VariantContext vc) { progress.record(vc.getContig(), vc.getStart()); if (!isVariantExcluded(vc)) { final String singletonSample = getSingletonSample(vc); updateSummaryMetric(summaryMetric, null, vc, singletonSample != null); // The summary metric has no genotype. vc.getSampleNames().stream() .filter(sampleName -> !vc.getGenotype(sampleName).isHomRef()) .forEach(sampleName -> updateDetailMetric(sampleMetricsMap.get(sampleName), vc.getGenotype(sampleName), vc, sampleName.equals(singletonSample))); } }
/** Incorporates the provided variant's data into the metric analysis. */ @Override public void accumulate(final VariantContext vc) { progress.record(vc.getContig(), vc.getStart()); if (!isVariantExcluded(vc)) { final String singletonSample = getSingletonSample(vc); updateSummaryMetric(summaryMetric, null, vc, singletonSample != null); // The summary metric has no genotype. vc.getSampleNames().stream() .filter(sampleName -> !vc.getGenotype(sampleName).isHomRef()) .forEach(sampleName -> updateDetailMetric(sampleMetricsMap.get(sampleName), vc.getGenotype(sampleName), vc, sampleName.equals(singletonSample))); } }
public void addFormatGenotype(Genotype gt) { if(gt == null){ this.setText(' '); } else if(gt.isHomRef()){ this.setText('.'); this.setBgColor(Config.get(ConfigKey.feature_background_no_strand)); } else if(gt.isHomVar()){ this.setText('O'); this.setBgColor(Config.get(ConfigKey.feature_background_negative_strand)); } else if(gt.isHet()){ this.setText('E'); this.setBgColor(Config.get(ConfigKey.feature_background_positive_strand)); } else { this.setText('?'); } }
if ( ! g.isNoCall() && ! g.isHomRef() ) { countsPerSample.inc(type, g.getSampleName());