From b6c3ed0295395cc07dda28a02c05a619ae1983d8 Mon Sep 17 00:00:00 2001 From: Mauricio Carneiro Date: Fri, 6 Sep 2013 09:30:01 -0400 Subject: [PATCH 1/2] Added REVERT SOFTCLIPPED bases to ClipReads --- .../sting/gatk/walkers/readutils/ClipReads.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/readutils/ClipReads.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/readutils/ClipReads.java index 879022299..dfc36954b 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/readutils/ClipReads.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/readutils/ClipReads.java @@ -305,7 +305,7 @@ public class ClipReads extends ReadWalker Date: Mon, 9 Sep 2013 19:40:03 -0400 Subject: [PATCH 2/2] Clarified docs on using clipping options --- .../gatk/walkers/readutils/ClipReads.java | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/readutils/ClipReads.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/readutils/ClipReads.java index dfc36954b..78029eb85 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/readutils/ClipReads.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/readutils/ClipReads.java @@ -57,36 +57,34 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /** - * This tool provides simple, powerful read clipping capabilities to remove low quality strings of bases, sections of reads, and reads containing user-provided sequences. + * Read clipping based on quality, position or sequence matching * + *

This tool provides simple, powerful read clipping capabilities that allow you to remove low quality strings of bases, sections of reads, and reads containing user-provided sequences.

* - *

- * It allows the user to clip bases in reads with poor quality scores, that match particular - * sequences, or that were generated by particular machine cycles. + *

There are three options for clipping (quality, position and sequence), which can be used alone or in combination. In addition, you can also specify a clipping representation, which determines exactly how ClipReads applies clips to the reads (soft clips, writing Q0 base quality scores, etc.). Please note that you MUST specify at least one of the three clipping options, and specifying a clipping representation is not sufficient. If you do not specify a clipping option, the program will run but it will not do anything to your reads.

* *
*
Quality score based clipping
*
* Clip bases from the read in clipper from - *
argmax_x{ \sum{i = x + 1}^l (qTrimmingThreshold - qual)
- * to the end of the read. This is blatantly stolen from BWA. + *
argmax_x{ \sum{i = x + 1}^l (qTrimmingThreshold - qual)
+ * to the end of the read. This is copied from BWA. * * Walk through the read from the end (in machine cycle order) to the beginning, calculating the * running sum of qTrimmingThreshold - qual. While we do this, we track the maximum value of this * sum where the delta > 0. After the loop, clipPoint is either -1 (don't do anything) or the * clipping index in the read (from the end). - *
+ *
*
Cycle based clipping
*
Clips machine cycles from the read. Accepts a string of ranges of the form start1-end1,start2-end2, etc. * For each start/end pair, removes bases in machine cycles from start to end, inclusive. These are 1-based values (positions). * For example, 1-5,10-12 clips the first 5 bases, and then three bases at cycles 10, 11, and 12. - *
+ *
*
Sequence matching
*
Clips bases from that exactly match one of a number of base sequences. This employs an exact match algorithm, * filtering only bases whose sequence exactly matches SEQ.
*
* - *

* *

Input

*

@@ -99,7 +97,7 @@ import java.util.regex.Pattern; * operation applied to each read. *

*

- *

Summary output

+ *

Summary output (console)

*
  *     Number of examined reads              13
  *     Number of clipped reads               13
@@ -113,16 +111,29 @@ import java.util.regex.Pattern;
  *     
*

* - *

- *

Example clipping

- * Suppose we are given this read: + *

Example

+ *
+ *   java -jar GenomeAnalysisTK.jar \
+ *     -T ClipReads \
+ *     -R reference.fasta \
+ *     -I original.bam \
+ *     -o clipped.bam \
+ *     -XF seqsToClip.fasta \
+ *     -X CCCCC \
+ *     -CT "1-5,11-15" \
+ *     -QT 10
+ * 
+ *

The command line shown above will apply all three options in combination. See the detailed examples below to see how the choice of clipping representation affects the output.

+ * + *

Detailed clipping examples

+ *

Suppose we are given this read:

*
  *     314KGAAXX090507:1:19:1420:1123#0        16      chrM    3116    29      76M     *       *       *
  *          TAGGACCCGGGCCCCCCTCCCCAATCCTCCAACGCATATAGCGGCCGCGCCTTCCCCCGTAAATGATATCATCTCA
  *          #################4?6/?2135;;;'1/=/<'B9;12;68?A79@,@==@9?=AAA3;A@B;A?B54;?ABA
  *     
* - * If we are clipping reads with -QT 10 and -CR WRITE_NS, we get: + *

If we are clipping reads with -QT 10 and -CR WRITE_NS, we get:

* *
  *     314KGAAXX090507:1:19:1420:1123#0        16      chrM    3116    29      76M     *       *       *
@@ -130,26 +141,20 @@ import java.util.regex.Pattern;
  *          #################4?6/?2135;;;'1/=/<'B9;12;68?A79@,@==@9?=AAA3;A@B;A?B54;?ABA
  *     
* - * Whereas with -CR WRITE_Q0S: + *

Whereas with -QT 10 -CR WRITE_Q0S:

*
  *     314KGAAXX090507:1:19:1420:1123#0        16      chrM    3116    29      76M     *       *       *
  *          TAGGACCCGGGCCCCCCTCCCCAATCCTCCAACGCATATAGCGGCCGCGCCTTCCCCCGTAAATGATATCATCTCA
  *          !!!!!!!!!!!!!!!!!4?6/?2135;;;'1/=/<'B9;12;68?A79@,@==@9?=AAA3;A@B;A?B54;?ABA
  *     
* - * Or -CR SOFTCLIP_BASES: + *

Or -QT 10 -CR SOFTCLIP_BASES:

*
  *     314KGAAXX090507:1:19:1420:1123#0        16      chrM    3133    29      17S59M  *       *       *
  *          TAGGACCCGGGCCCCCCTCCCCAATCCTCCAACGCATATAGCGGCCGCGCCTTCCCCCGTAAATGATATCATCTCA
  *          #################4?6/?2135;;;'1/=/<'B9;12;68?A79@,@==@9?=AAA3;A@B;A?B54;?ABA
  *     
- *

* - *

Examples

- *
- *     -T ClipReads -I my.bam -I your.bam -o my_and_your.clipped.bam -R Homo_sapiens_assembly18.fasta \
- *     -XF seqsToClip.fasta -X CCCCC -CT "1-5,11-15" -QT 10
- * 
* @author Mark DePristo * @since 2010 @@ -158,10 +163,9 @@ import java.util.regex.Pattern; @Requires({DataSource.READS}) public class ClipReads extends ReadWalker { /** - * If provided, ClipReads will write summary statistics about the clipping operations applied - * to the reads to this file. + * If provided, ClipReads will write summary statistics about the clipping operations applied to the reads in this file. */ - @Output(fullName = "outputStatistics", shortName = "os", doc = "Write output statistics to this file", required = false, defaultToStdout = false) + @Output(fullName = "outputStatistics", shortName = "os", doc = "File to output statistics", required = false, defaultToStdout = false) PrintStream out = null; /**