Java Code Examples for htsjdk.variant.variantcontext.VariantContext#getIndelLengths()

The following examples show how to use htsjdk.variant.variantcontext.VariantContext#getIndelLengths() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VariantSummary.java    From gatk with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private Type getType(VariantContext vc) {
    switch (vc.getType()) {
        case SNP:
            return Type.SNP;
        case INDEL:
            for ( int l : vc.getIndelLengths() )
                if ( Math.abs(l) > MAX_INDEL_LENGTH )
                    return Type.CNV;
            return Type.INDEL;
        case SYMBOLIC:
            return Type.CNV;
        default:
            //throw new UserException.BadInput("Unexpected variant context type: " + vc);
            return null;
    }
}
 
Example 2
Source File: MappingQualityFilter.java    From gatk with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public List<Boolean> areAllelesArtifacts(final VariantContext vc, final Mutect2FilteringEngine filteringEngine, final ReferenceContext referenceContext) {
    final List<Integer> indelLengths = vc.getIndelLengths(); // alts only
    final List<Integer> mappingQualityByAllele = vc.getAttributeAsIntList(GATKVCFConstants.MEDIAN_MAPPING_QUALITY_KEY, 0);

    // we use the mapping quality annotation of the alt allele in most cases, but for long indels we use the reference
    // annotation.  We have to do this because the indel, even if it maps uniquely, gets a poor mapping quality
    // by virtue of its mismatch.  The reference mapping quality is a decent proxy for the region's mappability.
    final int refQual = mappingQualityByAllele.remove(0); // get the ref value and convert list to alts only
    new IndexRange(0, mappingQualityByAllele.size()).forEach(i -> {
        if (indelLengths != null && indelLengths.get(i) >= longIndelSize) {
            mappingQualityByAllele.set(i, refQual);
        }
    });
    return mappingQualityByAllele.stream().map(qual -> qual < minMedianMappingQuality).collect(Collectors.toList());
}
 
Example 3
Source File: SelectVariants.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected static boolean containsIndelLargerOrSmallerThan(final VariantContext vc, final int maxIndelSize, final int minIndelSize) {
    final List<Integer> lengths = vc.getIndelLengths();
    if (lengths == null)
        return false;

    for (final Integer indelLength : lengths) {
        if (Math.abs(indelLength) > maxIndelSize || Math.abs(indelLength) < minIndelSize)
            return true;
    }

    return false;
}
 
Example 4
Source File: OneBPIndel.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public List<Object> getRelevantStates(ReferenceContext referenceContext, ReadsContext readsContext, FeatureContext featureContext, VariantContext comp, String compName, VariantContext eval, String evalName, String sampleName, String FamilyName) {
    if (eval != null && eval.isIndel()) {
        for ( int l : eval.getIndelLengths() )
            if ( Math.abs(l) > 1 )
                return TWO_PLUS_BP; // someone is too long
        return ONE_BP; // all lengths are one
    } else
        return ALL;
}