当前位置: 首页>>代码示例>>Java>>正文


Java Allele.equals方法代码示例

本文整理汇总了Java中htsjdk.variant.variantcontext.Allele.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Allele.equals方法的具体用法?Java Allele.equals怎么用?Java Allele.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在htsjdk.variant.variantcontext.Allele的用法示例。


在下文中一共展示了Allele.equals方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hasPLIncompatibleAlleles

import htsjdk.variant.variantcontext.Allele; //导入方法依赖的package包/类
private static boolean hasPLIncompatibleAlleles(final Collection<Allele> alleleSet1, final Collection<Allele> alleleSet2) {
    final Iterator<Allele> it1 = alleleSet1.iterator();
    final Iterator<Allele> it2 = alleleSet2.iterator();

    while ( it1.hasNext() && it2.hasNext() ) {
        final Allele a1 = it1.next();
        final Allele a2 = it2.next();
        if ( ! a1.equals(a2) )
            return true;
    }

    // by this point, at least one of the iterators is empty.  All of the elements
    // we've compared are equal up until this point.  But it's possible that the
    // sets aren't the same size, which is indicated by the test below.  If they
    // are of the same size, though, the sets are compatible
    return it1.hasNext() || it2.hasNext();
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:18,代码来源:GATKVariantContextUtils.java

示例2: determineReferenceAllele

import htsjdk.variant.variantcontext.Allele; //导入方法依赖的package包/类
/**
 * Determines the common reference allele
 *
 * @param VCs    the list of VariantContexts
 * @param loc    if not null, ignore records that do not begin at this start location
 * @return possibly null Allele
 */
public static Allele determineReferenceAllele(final List<VariantContext> VCs, final GenomeLoc loc) {
    Allele ref = null;

    for ( final VariantContext vc : VCs ) {
        if ( contextMatchesLoc(vc, loc) ) {
            final Allele myRef = vc.getReference();
            if ( ref == null || ref.length() < myRef.length() )
                ref = myRef;
            else if ( ref.length() == myRef.length() && ! ref.equals(myRef) )
                throw new TribbleException(String.format("The provided variant file(s) have inconsistent references for the same position(s) at %s:%d, %s vs. %s", vc.getChr(), vc.getStart(), ref, myRef));
        }
    }

    return ref;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:23,代码来源:GATKVariantContextUtils.java

示例3: createAlleleMapping

import htsjdk.variant.variantcontext.Allele; //导入方法依赖的package包/类
/**
 * Create an allele mapping for the given context where its reference allele must (potentially) be extended to the given allele
 *
 * The refAllele is the longest reference allele seen at this start site.
 * So imagine it is:
 * refAllele: ACGTGA
 * myRef:     ACGT
 * myAlt:     A
 *
 * We need to remap all of the alleles in vc to include the extra GA so that
 * myRef => refAllele and myAlt => AGA
 *
 * @param refAllele          the new (extended) reference allele
 * @param oneVC              the Variant Context to extend
 * @param currentAlleles     the list of alleles already created
 * @return a non-null mapping of original alleles to new (extended) ones
 */
private static Map<Allele, Allele> createAlleleMapping(final Allele refAllele,
                                                       final VariantContext oneVC,
                                                       final Collection<Allele> currentAlleles) {
    final Allele myRef = oneVC.getReference();
    if ( refAllele.length() <= myRef.length() ) throw new IllegalStateException("BUG: myRef="+myRef+" is longer than refAllele="+refAllele);

    final byte[] extraBases = Arrays.copyOfRange(refAllele.getBases(), myRef.length(), refAllele.length());

    final Map<Allele, Allele> map = new HashMap<>();
    for ( final Allele a : oneVC.getAlternateAlleles() ) {
        if ( isUsableAlternateAllele(a) ) {
            Allele extended = Allele.extend(a, extraBases);
            for ( final Allele b : currentAlleles )
                if ( extended.equals(b) )
                    extended = b;
            map.put(a, extended);
        }
    }

    return map;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:39,代码来源:GATKVariantContextUtils.java

示例4: updateTable

import htsjdk.variant.variantcontext.Allele; //导入方法依赖的package包/类
private static void updateTable(final int[] table, final Allele allele, final GATKSAMRecord read, final Allele ref, final Allele alt) {

        final boolean matchesRef = allele.equals(ref, true);
        final boolean matchesAlt = allele.equals(alt, true);

        if (matchesRef || matchesAlt) {
            final int offset = matchesRef ? 0 : 2;

            if (read.isStrandless()) {
                // a strandless read counts as observations on both strand, at 50% weight, with a minimum of 1
                // (the 1 is to ensure that a strandless read always counts as an observation on both strands, even
                // if the read is only seen once, because it's a merged read or other)
                table[offset]++;
                table[offset + 1]++;
            } else {
                // a normal read with an actual strand
                final boolean isFW = !read.getReadNegativeStrandFlag();
                table[offset + (isFW ? 0 : 1)]++;
            }
        }
    }
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:22,代码来源:StrandBiasTest.java

示例5: resolveIncompatibleAlleles

import htsjdk.variant.variantcontext.Allele; //导入方法依赖的package包/类
static private AlleleMapper resolveIncompatibleAlleles(final Allele refAllele, final VariantContext vc, final LinkedHashSet<Allele> allAlleles) {
    if ( refAllele.equals(vc.getReference()) )
        return new AlleleMapper(vc);
    else {
        final Map<Allele, Allele> map = createAlleleMapping(refAllele, vc, allAlleles);
        map.put(vc.getReference(), refAllele);
        return new AlleleMapper(map);
    }
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:10,代码来源:GATKVariantContextUtils.java

示例6: indexOfEqualAllele

import htsjdk.variant.variantcontext.Allele; //导入方法依赖的package包/类
private static int indexOfEqualAllele(final VariantContext vc, final Allele allele, final boolean ignoreRefState,
                                      final boolean considerRefAllele) {
    int i = 0;
    for (final Allele a : vc.getAlleles())
        if (a.equals(allele,ignoreRefState))
            return i == 0 ? (considerRefAllele ? 0 : -1) : i;
        else
            i++;
    return -1;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:11,代码来源:GATKVariantContextUtils.java

示例7: remapAlleles

import htsjdk.variant.variantcontext.Allele; //导入方法依赖的package包/类
/**
 * This method does a couple of things:
 * <ul><li>
 *     remaps the vc alleles considering the differences between the final reference allele and its own reference,</li>
 * <li>
 *     collects alternative alleles present in variant context and add them to the {@code finalAlleles} set.
 * </li></ul>
 *
 * @param vcAlleles the variant context allele list.
 * @param refAllele final reference allele.
 * @param finalAlleles where to add the final set of non-ref called alleles.
 * @return never {@code null}
 */
//TODO as part of a larger refactoring effort {@link #remapAlleles} can be merged with {@link GATKVariantContextUtils#remapAlleles}.
private static List<Allele> remapAlleles(final List<Allele> vcAlleles, final Allele refAllele, final LinkedHashSet<Allele> finalAlleles) {
    final Allele vcRef = vcAlleles.get(0);
    if (!vcRef.isReference()) throw new IllegalStateException("the first allele of the vc allele list must be reference");
    final byte[] refBases = refAllele.getBases();
    final int extraBaseCount = refBases.length - vcRef.getBases().length;
    if (extraBaseCount < 0) throw new IllegalStateException("the wrong reference was selected");
    final List<Allele> result = new ArrayList<>(vcAlleles.size());

    for (final Allele a : vcAlleles) {
        if (a.isReference()) {
            result.add(refAllele);
        } else if (a.isSymbolic()) {
            result.add(a);
            // we always skip <NON_REF> when adding to finalAlleles this is done outside if applies.
            if (!a.equals(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE))
                finalAlleles.add(a);
        } else if (a.isCalled()) {
            final Allele newAllele;
            if (extraBaseCount > 0) {
                final byte[] oldBases = a.getBases();
                final byte[] newBases = Arrays.copyOf(oldBases,oldBases.length + extraBaseCount);
                System.arraycopy(refBases,refBases.length - extraBaseCount,newBases,oldBases.length,extraBaseCount);
                newAllele = Allele.create(newBases,false);
            } else
                newAllele = a;
            result.add(newAllele);
            finalAlleles.add(newAllele);
        } else { // NO_CALL and strange miscellanea
            result.add(a);
        }
    }
    return result;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:48,代码来源:ReferenceConfidenceVariantContextMerger.java


注:本文中的htsjdk.variant.variantcontext.Allele.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。