/** * Return the DNA bases segregating in this allele in String format. * This is useful, because toString() adds a '*' to reference alleles and getBases() returns garbage when you call toString() on it. * * @return the segregating bases */ public String getBaseString() { return isNoCall() ? NO_CALL_STRING : new String(getBases()); }
/** * Return the DNA bases segregating in this allele in String format. * This is useful, because toString() adds a '*' to reference alleles and getBases() returns garbage when you call toString() on it. * * @return the segregating bases */ public String getBaseString() { return isNoCall() ? NO_CALL_STRING : new String(getBases()); }
/** * @param test allele to test against * * @return true if this Allele contains the same bases as test, regardless of its reference status; handles Null and NO_CALL alleles */ public boolean basesMatch(final Allele test) { return basesMatch(test.getBases()); }
/** * Return the DNA bases segregating in this allele in String format. * This is useful, because toString() adds a '*' to reference alleles and getBases() returns garbage when you call toString() on it. * * @return the segregating bases */ public String getBaseString() { return isNoCall() ? NO_CALL_STRING : new String(getBases()); }
/** * @param test allele to test against * * @return true if this Allele contains the same bases as test, regardless of its reference status; handles Null and NO_CALL alleles */ public boolean basesMatch(Allele test) { return basesMatch(test.getBases()); }
/** * @param test allele to test against * * @return true if this Allele contains the same bases as test, regardless of its reference status; handles Null and NO_CALL alleles */ public boolean basesMatch(final Allele test) { return basesMatch(test.getBases()); }
public List<Allele> getAlternateAlleles() { if (alternateAlleles == null) { List<htsjdk.variant.variantcontext.Allele> tmp = variantContext.getAlternateAlleles(); alternateAlleles = new ArrayList<Allele>(tmp.size()); for (htsjdk.variant.variantcontext.Allele a : tmp) { alternateAlleles.add(new VCFAllele(a.getBases())); } } return alternateAlleles; }
public List<org.broad.igv.variant.Allele> getAlleles() { if (alleles == null) { alleles = new ArrayList<org.broad.igv.variant.Allele>(); List<htsjdk.variant.variantcontext.Allele> tmp = vcfGenotype.getAlleles(); if (tmp != null) { for (Allele a : tmp) { alleles.add(new VCFAllele(a.getBases())); } } } return alleles; }
private Double annotateWithPileup(final AlignmentContext stratifiedContext, final VariantContext vc) { final HashMap<Byte, MutableInt> alleleCounts = new HashMap<>(); for ( final Allele allele : vc.getAlleles() ) alleleCounts.put(allele.getBases()[0], new MutableInt(0)); for ( final byte base : stratifiedContext.getBasePileup().getBases() ) { if ( alleleCounts.containsKey(base) ) alleleCounts.get(base).increment(); } final int refCount = alleleCounts.get(vc.getReference().getBases()[0]).intValue(); final int altCount = alleleCounts.get(vc.getAlternateAllele(0).getBases()[0]).intValue(); return (refCount + altCount == 0) ? null : ((double) refCount) / (refCount + altCount); }
public SNPallelePair(Genotype gt) { super(gt); if (getTopAllele().getBases().length != 1) throw new ReviewedGATKException("LOGICAL ERROR: SNPallelePair may not contain non-SNP site!"); if (getBottomAllele().getBases().length != 1) throw new ReviewedGATKException("LOGICAL ERROR: SNPallelePair may not contain non-SNP site!"); }
public byte getTopBase() { byte[] topBases = getTopAllele().getBases(); return getSingleBase(topBases); }
public static BaseUtils.BaseSubstitutionType getSNPSubstitutionType(VariantContext context) { if (!context.isSNP() || !context.isBiallelic()) throw new IllegalStateException("Requested SNP substitution type for bialleic non-SNP " + context); return BaseUtils.SNPSubstitutionType(context.getReference().getBases()[0], context.getAlternateAllele(0).getBases()[0]); }
public static Allele extend(final Allele left, final byte[] right) { if (left.isSymbolic()) throw new IllegalArgumentException("Cannot extend a symbolic allele"); byte[] bases = new byte[left.length() + right.length]; System.arraycopy(left.getBases(), 0, bases, 0, left.length()); System.arraycopy(right, 0, bases, left.length(), right.length); return create(bases, left.isReference()); }
public static Allele extend(Allele left, byte[] right) { if (left.isSymbolic()) throw new IllegalArgumentException("Cannot extend a symbolic allele"); byte[] bases = new byte[left.length() + right.length]; System.arraycopy(left.getBases(), 0, bases, 0, left.length()); System.arraycopy(right, 0, bases, left.length(), right.length); return create(bases, left.isReference()); }
/** * @return true if the alleles indicate a simple indel, false otherwise. */ public boolean isSimpleIndel() { return getType() == Type.INDEL // allelic lengths differ && isBiallelic() // exactly 2 alleles && getReference().length() > 0 // ref is not null or symbolic && getAlternateAllele(0).length() > 0 // alt is not null or symbolic && getReference().getBases()[0] == getAlternateAllele(0).getBases()[0] // leading bases match for both alleles && (getReference().length() == 1 || getAlternateAllele(0).length() == 1); }
/** * @return true if the alleles indicate a simple indel, false otherwise. */ public boolean isSimpleIndel() { return getType() == Type.INDEL // allelic lengths differ && isBiallelic() // exactly 2 alleles && getReference().length() > 0 // ref is not null or symbolic && getAlternateAllele(0).length() > 0 // alt is not null or symbolic && getReference().getBases()[0] == getAlternateAllele(0).getBases()[0] // leading bases match for both alleles && (getReference().length() == 1 || getAlternateAllele(0).length() == 1); }
/** * @return true if the alleles indicate a simple indel, false otherwise. */ public boolean isSimpleIndel() { return getType() == Type.INDEL // allelic lengths differ && isBiallelic() // exactly 2 alleles && getReference().length() > 0 // ref is not null or symbolic && getAlternateAllele(0).length() > 0 // alt is not null or symbolic && getReference().getBases()[0] == getAlternateAllele(0).getBases()[0] // leading bases match for both alleles && (getReference().length() == 1 || getAlternateAllele(0).length() == 1); }
private AlleleList<Allele> alleleList(final int alleleCount, final boolean hasReference) { final Allele[] alleles = AlleleListUnitTester.generateRandomAlleles(alleleCount,100); if (hasReference) { final int referenceIndex = rnd.nextInt(alleleCount); alleles[referenceIndex] = Allele.create(alleles[referenceIndex].getBases(),true); } final AlleleList<Allele> alleleList = new IndexedAlleleList<>(alleles); if (alleleList.alleleCount() != alleles.length) throw new SkipException("repeated alleles, should be infrequent"); return alleleList; }
@Test(dataProvider = "AssembleIntervalsWithVariantData") public void testAssembleRefAndDeletion(final ReadThreadingAssembler assembler, final GenomeLoc loc, final int nReadsToUse, final int variantSite) { final byte[] refBases = seq.getSubsequenceAt(loc.getContig(), loc.getStart(), loc.getStop()).getBases(); for ( int deletionLength = 1; deletionLength < 10; deletionLength++ ) { final Allele refBase = Allele.create(new String(refBases).substring(variantSite, variantSite + deletionLength + 1), true); final Allele altBase = Allele.create(refBase.getBases()[0], false); final VariantContextBuilder vcb = new VariantContextBuilder("x", loc.getContig(), variantSite, variantSite + deletionLength, Arrays.asList(refBase, altBase)); testAssemblyWithVariant(assembler, refBases, loc, nReadsToUse, vcb.make()); } }