Java Code Examples for htsjdk.variant.variantcontext.VariantContext#isSimpleDeletion()
The following examples show how to use
htsjdk.variant.variantcontext.VariantContext#isSimpleDeletion() .
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: SamRecordScoring.java From hmftools with GNU General Public License v3.0 | 6 votes |
@NotNull private static ReadType getReadType(@NotNull final SAMRecord record, @NotNull final VariantContext variant) { final Allele alt = variant.getAlternateAllele(0); final Allele ref = variant.getReference(); final int recordIdxOfVariantStart = record.getReadPositionAtReferencePosition(variant.getStart()); if (recordIdxOfVariantStart == 0) { // Variant position was deleted return ReadType.MISSING; } if (variant.isSNP()) { if (record.getReadString().charAt(recordIdxOfVariantStart - 1) == alt.getBaseString().charAt(0)) { return ReadType.ALT; } else { return ReadType.REF; } } if (variant.isSimpleInsertion()) { return SAMRecords.containsInsert(record, variant.getStart(), alt.getBaseString()) ? ReadType.ALT : ReadType.REF; } if (variant.isSimpleDeletion()) { return SAMRecords.containsDelete(record, variant.getStart(), ref.getBaseString()) ? ReadType.ALT : ReadType.REF; } return ReadType.OTHER; }
Example 2
Source File: IndelSize.java From gatk with BSD 3-Clause "New" or "Revised" License | 6 votes |
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() && eval.isBiallelic()) { try { int eventLength = 0; if ( eval.isSimpleInsertion() ) { eventLength = eval.getAlternateAllele(0).length(); } else if ( eval.isSimpleDeletion() ) { eventLength = -eval.getReference().length(); } if (eventLength > MAX_INDEL_SIZE) eventLength = MAX_INDEL_SIZE; else if (eventLength < -MAX_INDEL_SIZE) eventLength = -MAX_INDEL_SIZE; return Collections.singletonList((Object)eventLength); } catch (Exception e) { return Collections.emptyList(); } } return Collections.emptyList(); }
Example 3
Source File: FastaAlternateReferenceMaker.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
private byte[] handlePosition(SimpleInterval interval, byte base, FeatureContext features) { if (deletionBasesRemaining > 0) { deletionBasesRemaining--; return NO_BASES; } // If we have a mask at this site, use it if ( snpmaskPriority ){ if (isMasked(features) ) return N_BYTES; } // Check to see if we have a called snp for ( final VariantContext vc : features.getValues(variants) ) { if ( vc.isFiltered() || vc.getStart() != interval.getStart() ) continue; if ( vc.isSimpleDeletion()) { deletionBasesRemaining = vc.getReference().length() - 1; // delete the next n bases, not this one return baseToByteArray(base); } else if ( vc.isSimpleInsertion() || vc.isSNP() ) { // Get the first alt allele that is not a spanning deletion. If none present, use the empty allele final Optional<Allele> optionalAllele = getFirstConcreteAltAllele(vc.getAlternateAlleles()); final Allele allele = optionalAllele.orElseGet(() -> Allele.create(EMPTY_BASE, false)); if ( vc.isSimpleInsertion() ) { return allele.getBases(); } else { final String iupacBase = (iupacSample != null) ? getIUPACBase(vc.getGenotype(iupacSample)) : allele.toString(); return iupacBase.getBytes(); } } } if ( !snpmaskPriority ){ if ( isMasked(features)) { return N_BYTES; } } // if we got here then we're just ref return baseToByteArray(base); }