Package picard.util
Class ClippingUtility
- java.lang.Object
-
- picard.util.ClippingUtility
-
public class ClippingUtility extends Object
Utilities to clip the adapter sequence from a SAMRecord read
-
-
Field Summary
Fields Modifier and Type Field Description static double
MAX_ERROR_RATE
The default value used for the maximum error rate when matching read bases to clippable sequence.static double
MAX_PE_ERROR_RATE
The default value used for the maximum error rate when matching paired end read bases to clippable sequence.static int
MIN_MATCH_BASES
The default value used for the minimum number of contiguous bases to match against.static int
MIN_MATCH_PE_BASES
The default value used for the minimum number of contiguous bases to match against in a paired end readstatic int
NO_MATCH
The value returned by methods returning int when no match is found.
-
Constructor Summary
Constructors Constructor Description ClippingUtility()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static AdapterPair
adapterTrimIlluminaPairedReads(htsjdk.samtools.SAMRecord read1, htsjdk.samtools.SAMRecord read2, int minMatchBases, double maxErrorRate, AdapterPair... adapters)
Invokes adapterTrimIlluminaRead with explicit parameters for a pair of reads.static String
adapterTrimIlluminaPairedReads(htsjdk.samtools.SAMRecord read1, htsjdk.samtools.SAMRecord read2, AdapterPair adapters)
Deprecated.Use the varargs version.static AdapterPair
adapterTrimIlluminaPairedReads(htsjdk.samtools.SAMRecord read1, htsjdk.samtools.SAMRecord read2, AdapterPair... adapters)
Invokes adapterTrimIlluminaPairedReads with default less stringent parameters for a pair of reads.static String
adapterTrimIlluminaPairedReads(htsjdk.samtools.SAMRecord read1, htsjdk.samtools.SAMRecord read2, AdapterPair adapters, int minMatchBases, double maxErrorRate)
Deprecated.Use the varargs version.static AdapterPair
adapterTrimIlluminaSingleRead(htsjdk.samtools.SAMRecord read, int minMatchBases, double maxErrorRate, AdapterPair... adapters)
Invokes adapterTrimIlluminRead with explicit matching thresholds for a single read.static void
adapterTrimIlluminaSingleRead(htsjdk.samtools.SAMRecord read, AdapterPair adapter)
Deprecated.Use the varargs version.static AdapterPair
adapterTrimIlluminaSingleRead(htsjdk.samtools.SAMRecord read, AdapterPair... adapters)
Invokes adapterTrimIlluminRead with default parameters for a single read.static void
adapterTrimIlluminaSingleRead(htsjdk.samtools.SAMRecord read, AdapterPair adapter, int minMatchBases, double maxErrorRate)
Deprecated.Use the varargs version.static htsjdk.samtools.util.Tuple<AdapterPair,Integer>
findAdapterPairAndIndexForSingleRead(byte[] read, int minMatchBases, double maxErrorRate, int templateIndex, AdapterPair... adapters)
Return the adapter to be trimmed from a read represented as an array of bytes[]static int
findIndexOfClipSequence(byte[] read, byte[] adapterSequence, int minMatch, double maxErrorRate)
Finds the first index of the adapterSequence sequence in the read sequence requiring at least minMatch bases of pairwise alignment with a maximum number of errors dictated by maxErrorRate.
-
-
-
Field Detail
-
MIN_MATCH_BASES
public static final int MIN_MATCH_BASES
The default value used for the minimum number of contiguous bases to match against.- See Also:
- Constant Field Values
-
MIN_MATCH_PE_BASES
public static final int MIN_MATCH_PE_BASES
The default value used for the minimum number of contiguous bases to match against in a paired end read- See Also:
- Constant Field Values
-
MAX_ERROR_RATE
public static final double MAX_ERROR_RATE
The default value used for the maximum error rate when matching read bases to clippable sequence.- See Also:
- Constant Field Values
-
MAX_PE_ERROR_RATE
public static final double MAX_PE_ERROR_RATE
The default value used for the maximum error rate when matching paired end read bases to clippable sequence.- See Also:
- Constant Field Values
-
NO_MATCH
public static final int NO_MATCH
The value returned by methods returning int when no match is found.- See Also:
- Constant Field Values
-
-
Method Detail
-
adapterTrimIlluminaSingleRead
public static void adapterTrimIlluminaSingleRead(htsjdk.samtools.SAMRecord read, AdapterPair adapter)
Deprecated.Use the varargs version. This no longer returns a warning string..
-
adapterTrimIlluminaSingleRead
public static void adapterTrimIlluminaSingleRead(htsjdk.samtools.SAMRecord read, AdapterPair adapter, int minMatchBases, double maxErrorRate)
Deprecated.Use the varargs version. This no longer returns a warning string..
-
adapterTrimIlluminaSingleRead
public static AdapterPair adapterTrimIlluminaSingleRead(htsjdk.samtools.SAMRecord read, AdapterPair... adapters)
Invokes adapterTrimIlluminRead with default parameters for a single read. If the read is a negative strand, its bases will be reverse complemented Simpler, more common of two overloads. Accepts multiple adapters and tries them all until it finds the first one that matches.- Parameters:
read
- SAM/BAM read to trimadapters
- which adapters to try to use (indexed, paired_end, or single_end)- Returns:
- AdapterPair the AdapterPair matched, or null
-
adapterTrimIlluminaSingleRead
public static AdapterPair adapterTrimIlluminaSingleRead(htsjdk.samtools.SAMRecord read, int minMatchBases, double maxErrorRate, AdapterPair... adapters)
Invokes adapterTrimIlluminRead with explicit matching thresholds for a single read. If the read is a negative strand, a copy of its bases will be reverse complemented. More general form of the two overloads. Accepts multiple adapters and tries them all until it finds the first one that matches.- Parameters:
read
- SAM/BAM read to trimminMatchBases
- minimum number of contiguous bases to match against in a readmaxErrorRate
- maximum error rate when matching read basesadapters
- which adapters to try (indexed, paired_end, or single_end)- Returns:
- AdapterPair the AdapterPair matched, or null
-
findAdapterPairAndIndexForSingleRead
public static htsjdk.samtools.util.Tuple<AdapterPair,Integer> findAdapterPairAndIndexForSingleRead(byte[] read, int minMatchBases, double maxErrorRate, int templateIndex, AdapterPair... adapters)
Return the adapter to be trimmed from a read represented as an array of bytes[]- Parameters:
read
- The byte array of read dataminMatchBases
- The minimum number of base matches required for adapter matchingmaxErrorRate
- The maximum error rate allowed for adapter matchingtemplateIndex
- The paired index of the reads (1 or 2, 1 for single ended reads)adapters
- The set of adapters to search for- Returns:
- The adapter pair that matched the read and its index in the read or null
-
adapterTrimIlluminaPairedReads
public static String adapterTrimIlluminaPairedReads(htsjdk.samtools.SAMRecord read1, htsjdk.samtools.SAMRecord read2, AdapterPair adapters)
Deprecated.Use the varargs version. This no longer returns a warning string..
-
adapterTrimIlluminaPairedReads
public static String adapterTrimIlluminaPairedReads(htsjdk.samtools.SAMRecord read1, htsjdk.samtools.SAMRecord read2, AdapterPair adapters, int minMatchBases, double maxErrorRate)
Deprecated.Use the varargs version. This no longer returns a warning string..
-
adapterTrimIlluminaPairedReads
public static AdapterPair adapterTrimIlluminaPairedReads(htsjdk.samtools.SAMRecord read1, htsjdk.samtools.SAMRecord read2, AdapterPair... adapters)
Invokes adapterTrimIlluminaPairedReads with default less stringent parameters for a pair of reads. If the read is a negative strand, its bases will be reverse complemented Simpler, more common of two overloads.- Parameters:
read1
- first read of the pairread2
- second read of the pairadapters
- which adapters to use (indexed, paired_end, or single_end, nextera), attempted in order- Returns:
- int number of bases trimmed
-
adapterTrimIlluminaPairedReads
public static AdapterPair adapterTrimIlluminaPairedReads(htsjdk.samtools.SAMRecord read1, htsjdk.samtools.SAMRecord read2, int minMatchBases, double maxErrorRate, AdapterPair... adapters)
Invokes adapterTrimIlluminaRead with explicit parameters for a pair of reads. More general form of two overloads. Returns a warning string when the trim positions found differed for each read.- Parameters:
read1
- first read of the pair. If read1 is a negative strand, a copy of its bases will be reverse complemented.read2
- second read of the pair. If read2 is a negative strand, a copy of its bases will be reverse complementedminMatchBases
- minimum number of contiguous bases to match against in a readmaxErrorRate
- maximum error rate when matching read basesadapters
- which adapters to use (indexed, paired_end, or single_end, nextera), attempted in order- Returns:
- int number of bases trimmed
-
findIndexOfClipSequence
public static int findIndexOfClipSequence(byte[] read, byte[] adapterSequence, int minMatch, double maxErrorRate)
Finds the first index of the adapterSequence sequence in the read sequence requiring at least minMatch bases of pairwise alignment with a maximum number of errors dictated by maxErrorRate.- Parameters:
read
-
-
-