Package htsjdk.samtools.util
Class CigarUtil
java.lang.Object
htsjdk.samtools.util.CigarUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Cigar
addClippedBasesToEndsOfCigar
(Cigar cigar, boolean negativeStrand, int threePrimeEnd, int fivePrimeEnd, CigarOperator clippingOperator) Adds additional soft-clipped bases at the 3' and/or 5' end of the cigar.static Cigar
addSoftClippedBasesToEndsOfCigar
(Cigar cigar, boolean negativeStrand, int threePrimeEnd, int fivePrimeEnd) Adds additional soft-clipped bases at the 3' and/or 5' end of the cigar.static char[]
cigarArrayFromElements
(List<CigarElement> cigar) static char[]
cigarArrayFromString
(String cigar) static String
cigarStringFromArray
(char[] cigar) static void
clip3PrimeEndOfRead
(SAMRecord rec, int clipFrom, CigarOperator clippingOperator) Adds a soft- or hard-clip, based onclipFrom
andclippingOperator
, to the SAM record's existing cigar and, for negative strands, also adjusts the SAM record's start position.static List<CigarElement>
clipEndOfRead
(int clipFrom, List<CigarElement> oldCigar, CigarOperator clippingOperator) Adjust the cigar based on adapter clipping.static void
softClip3PrimeEndOfRead
(SAMRecord rec, int clipFrom) Adjust the cigar ofrec
based on adapter clipping using soft-clippingstatic List<CigarElement>
softClipEndOfRead
(int clipFrom, List<CigarElement> oldCigar) Adjust the cigar based on adapter clipping
-
Constructor Details
-
CigarUtil
public CigarUtil()
-
-
Method Details
-
clipEndOfRead
public static List<CigarElement> clipEndOfRead(int clipFrom, List<CigarElement> oldCigar, CigarOperator clippingOperator) Adjust the cigar based on adapter clipping. TODO: If there is hard clipping at the end of the input CIGAR, it is lost. It should not be. *- Parameters:
clipFrom
- 1-based position where the clipping startsoldCigar
- The existing unclipped cigarclippingOperator
- Type of clipping to use, either soft or hard. If non-clipping operator is used an exception is thrown- Returns:
- New adjusted list of cigar elements
-
softClipEndOfRead
Adjust the cigar based on adapter clipping- Parameters:
clipFrom
- 1-based position where the clipping startsoldCigar
- The existing unclipped cigar- Returns:
- New adjusted list of cigar elements
-
softClip3PrimeEndOfRead
Adjust the cigar ofrec
based on adapter clipping using soft-clipping- Parameters:
clipFrom
- 1-based position where the soft-clipping starts
-
clip3PrimeEndOfRead
Adds a soft- or hard-clip, based onclipFrom
andclippingOperator
, to the SAM record's existing cigar and, for negative strands, also adjusts the SAM record's start position. If clipping changes the number of unclipped bases, the the NM, MD, and UQ tags will be invalidated. Clips the end of the read as the read came off the sequencer.- Parameters:
rec
- SAMRecord to clipclipFrom
- Position to clip fromclippingOperator
- Type of clipping to use, either soft or hard. If non-clipping operator is used an exception is thrown
-
addClippedBasesToEndsOfCigar
public static Cigar addClippedBasesToEndsOfCigar(Cigar cigar, boolean negativeStrand, int threePrimeEnd, int fivePrimeEnd, CigarOperator clippingOperator) Adds additional soft-clipped bases at the 3' and/or 5' end of the cigar. Does not change the existing cigar except to merge the newly added soft-clipped bases if the element at the end of the cigar being modified is also a soft-clip.- Parameters:
cigar
- The cigar on which to base the new cigarnegativeStrand
- Whether the read is on the negative strandthreePrimeEnd
- number of soft-clipped bases to add to the 3' end of the readfivePrimeEnd
- number of soft-clipped bases to add to the 5' end of the readclippingOperator
- Type of clipping to use, either soft or hard. If non-clipping operator is used an exception is thrown
-
addSoftClippedBasesToEndsOfCigar
public static Cigar addSoftClippedBasesToEndsOfCigar(Cigar cigar, boolean negativeStrand, int threePrimeEnd, int fivePrimeEnd) Adds additional soft-clipped bases at the 3' and/or 5' end of the cigar. Does not change the existing cigar except to merge the newly added soft-clipped bases if the element at the end of the cigar being modified is also a soft-clip.- Parameters:
cigar
- The cigar on which to base the new cigarnegativeStrand
- Whether the read is on the negative strandthreePrimeEnd
- number of soft-clipped bases to add to the 3' end of the readfivePrimeEnd
- number of soft-clipped bases to add to the 5' end of the read- Returns:
- New cigar with additional soft-clipped bases
-
cigarArrayFromElements
-
cigarArrayFromString
-
cigarStringFromArray
-