private int findMaxAlleleLength(final List<? extends Allele> alleles) { int max = 0; for (final Allele allele : alleles) { final int alleleLength = allele.length(); if (max < alleleLength) max = alleleLength; } return max; }
getters.put("EVENTLENGTH", new Getter() { public String get(VariantContext vc) { int maxLength = 0; for ( final Allele a : vc.getAlternateAlleles() ) { final int length = a.length() - vc.getReference().length(); if( Math.abs(length) > Math.abs(maxLength) ) { maxLength = length; } } return Integer.toString(maxLength); }}); getters.put("QUAL", new Getter() { public String get(VariantContext vc) { return Double.toString(vc.getPhredScaledQual()); } });
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()); }
protected int getEndLocation(final RefMetaDataTracker tracker, final ReferenceContext ref, final List<Allele> allelesToUse) { return ref.getLocus().getStart() + allelesToUse.get(0).length() - 1; } }
/** * @return true if the alleles indicate a simple deletion (i.e., a single alt allele that is Null) */ public boolean isSimpleDeletion() { // can't just call !isSimpleInsertion() because of complex indels return isSimpleIndel() && getAlternateAllele(0).length() == 1; }
/** * @return true if the alleles indicate a simple deletion (i.e., a single alt allele that is Null) */ public boolean isSimpleDeletion() { // can't just call !isSimpleInsertion() because of complex indels return isSimpleIndel() && getAlternateAllele(0).length() == 1; }
/** * @return true if the alleles indicate a simple deletion (i.e., a single alt allele that is Null) */ public boolean isSimpleDeletion() { // can't just call !isSimpleInsertion() because of complex indels return isSimpleIndel() && getAlternateAllele(0).length() == 1; }
/** * @return true if the alleles indicate a simple insertion (i.e., the reference allele is Null) */ public boolean isSimpleInsertion() { // can't just call !isSimpleDeletion() because of complex indels return isSimpleIndel() && getReference().length() == 1; }
/** * @return true if the alleles indicate a simple insertion (i.e., the reference allele is Null) */ public boolean isSimpleInsertion() { // can't just call !isSimpleDeletion() because of complex indels return isSimpleIndel() && getReference().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); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testUpdateChromosomeCountsInfoCalledAltAllelesException() { final int calledAlleles = 0; final VariantContextBuilder builder = new VariantContextBuilder("test", "chr1", 1, Aref.length(), Arrays.asList(Aref, C)); GATKVariantContextUtils.updateChromosomeCountsInfo(null, calledAlleles, builder); }
@Test public void testCreatingSpanningDeletionAlleles() { Assert.assertTrue(SpandDel.isNonReference()); Assert.assertFalse(SpandDel.isReference()); Assert.assertTrue(SpandDel.basesMatch(Allele.SPAN_DEL_STRING)); Assert.assertEquals(SpandDel.length(), 1); }
@Override public void update1(final VariantContext eval, final RefMetaDataTracker tracker, final ReferenceContext ref, final AlignmentContext context) { if ( eval.isIndel() && ! eval.isComplexIndel() ) { if ( ! ( getWalker().ignoreAC0Sites() && eval.isMonomorphicInSamples() )) { // only if we are actually polymorphic in the subsetted samples should we count the allele for ( Allele alt : eval.getAlternateAlleles() ) { final int alleleSize = alt.length() - eval.getReference().length(); if ( alleleSize == 0 ) throw new ReviewedGATKException("Allele size not expected to be zero for indel: alt = " + alt + " ref = " + eval.getReference()); updateLengthHistogram(eval.getReference(), alt); } } } }
private VariantContext makeVC(String source, List<Allele> alleles, Collection<Genotype> genotypes, Set<String> filters) { int start = 10; int stop = start + alleles.get(0).length() - 1; // alleles.contains(ATC) ? start + 3 : start; return new VariantContextBuilder(source, "1", start, stop, alleles).genotypes(genotypes).filters(filters).make(); }
protected static VariantContextBuilder liftSimpleVariantContext(VariantContext source, Interval target) { if (target == null || source.getReference().length() != target.length()) { return null; } // Build the new variant context. Note: this will copy genotypes, annotations and filters final VariantContextBuilder builder = new VariantContextBuilder(source); builder.chr(target.getContig()); builder.start(target.getStart()); builder.stop(target.getEnd()); return builder; }
protected static VariantContextBuilder liftSimpleVariantContext(VariantContext source, Interval target) { if (target == null || source.getReference().length() != target.length()) { return null; } // Build the new variant context. Note: this will copy genotypes, annotations and filters final VariantContextBuilder builder = new VariantContextBuilder(source); builder.chr(target.getContig()); builder.start(target.getStart()); builder.stop(target.getEnd()); return builder; }