Package htsjdk.samtools
Class Cigar
java.lang.Object
htsjdk.samtools.Cigar
- All Implemented Interfaces:
Serializable,Iterable<CigarElement>
A list of CigarElements, which describes how a read aligns with the reference.
E.g. the Cigar string 10M1D25M means
* match or mismatch for 10 bases
* deletion of 1 base
* match or mismatch for 25 bases
c.f. http://samtools.sourceforge.net/SAM1.pdf for complete CIGAR specification.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(CigarElement cigarElement) booleancontainsOperator(CigarOperator operator) returns true if the cigar string contains the given operatorbooleanstatic CigarfromCigarOperators(List<CigarOperator> cigarOperators) build a new Cigar object from a list of cigar operators.getCigarElement(int i) returns the first cigar elementreturns the last cigar elementintintstatic intgetReadLength(List<CigarElement> cigarElements) intinthashCode()booleanreturns true if the cigar is clippedbooleanisEmpty()booleanreturns true if the cigar string starts With a clipping operatorbooleanreturns true if the cigar string ends With a clipping operatorExhaustive validation of CIGAR.iterator()shortcut togetCigarElements().iterator()inttoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
serialVersionUID
public static final long serialVersionUID- See Also:
-
-
Constructor Details
-
Cigar
public Cigar() -
Cigar
-
-
Method Details
-
getCigarElements
-
getCigarElement
-
add
-
numCigarElements
public int numCigarElements() -
isEmpty
public boolean isEmpty() -
getReferenceLength
public int getReferenceLength()- Returns:
- The number of reference bases that the read covers, excluding padding.
-
getPaddedReferenceLength
public int getPaddedReferenceLength()- Returns:
- The number of reference bases that the read covers, including padding.
-
getReadLength
public int getReadLength()- Returns:
- The number of read bases that the read covers.
-
getReadLength
- Returns:
- The number of read bases that the read covers.
-
isValid
Exhaustive validation of CIGAR. Note that this method deliberately returns null rather than Collections.emptyList() if there are no validation errors, because callers tend to assume that if a non-null list is returned, it is modifiable.- Parameters:
readName- For error reporting only. May be null if not known.recordNumber- For error reporting only. May be -1 if not known.- Returns:
- List of validation errors, or null if no errors.
-
equals
-
fromCigarOperators
build a new Cigar object from a list of cigar operators. This can be used if you have the operators associated to each base in the read. e.g: read length =10 with cigar=[M,M,M,M,M,M,M,M,M,M], here fromCigarOperators would generate the cigar '10M' later the user resolved the 'M' to '=' or 'X', the array is now[=,=,=,=,=,X,X,=,=,=]fromCigarOperators would generate the cigar '5M2X3M' -
iterator
shortcut togetCigarElements().iterator()- Specified by:
iteratorin interfaceIterable<CigarElement>
-
containsOperator
returns true if the cigar string contains the given operator -
getFirstCigarElement
returns the first cigar element -
getLastCigarElement
returns the last cigar element -
isLeftClipped
public boolean isLeftClipped()returns true if the cigar string starts With a clipping operator -
isRightClipped
public boolean isRightClipped()returns true if the cigar string ends With a clipping operator -
isClipped
public boolean isClipped()returns true if the cigar is clipped -
hashCode
public int hashCode() -
toString
-