Changes

From Genome Analysis Wiki
Jump to navigationJump to search
427 bytes added ,  15:04, 12 March 2015
no edit summary
Line 18: Line 18:  
trimBam will modify the sequences to 'N', and the quality string to '!' unless the optional parameter --clip/-c is specified.  If --clip/-c is specified, the ends will be soft clipped instead of modified.
 
trimBam will modify the sequences to 'N', and the quality string to '!' unless the optional parameter --clip/-c is specified.  If --clip/-c is specified, the ends will be soft clipped instead of modified.
   −
When soft clipping (--clip/-c):
+
 
* if the entire read would be soft clipped, no clipping is done, and instead the read is marked as unmapped
+
== Soft Clipping Notes (--clip/-c) ==
* mate information is not updated (start positions/mapping may change after soft clipping)
+
When soft clipping:
** run samtools fixmate to fix mate information (will first need to sort by read name)
+
:* if the entire read would be soft clipped, no clipping is done, and instead the read is marked as unmapped
* output is not sorted (start positions/mapping may change after soft clipping)
+
:* mate information is not updated (start positions/mapping may change after soft clipping)
** run samtools sort to resort by coordinate (after fixmate)
+
:** run samtools fixmate to fix mate information (will first need to sort by read name)
* soft clips already in the read are maintained or added to
+
:* output is not sorted (start positions/mapping may change after soft clipping)
** if 3 bases were clipped and 2 are specified to be clipped, no change is made to that end
+
:** run samtools sort to resort by coordinate (after fixmate)
** if 3 bases were clipped and 5 are specified to be clipped, 2 additional bases are clipped from that end
+
:* soft clips already in the read are maintained or added to
 +
:** if 3 bases were clipped and 2 are specified to be clipped, no change is made to that end
 +
:** if 3 bases were clipped and 5 are specified to be clipped, 2 additional bases are clipped from that end
 +
 
 +
=== Fixing the mate/resorting ===
 +
In order to update the mate, samtools fixmate must be run.
 +
 
 +
In order to reorder the file, samtools sort must be run.
 +
 
 +
Notes about the samtools programs:
 +
* samtools fixmate requires the file to be sorted by query name.
 +
* samtools sort cannot write to pipes.
 +
 
 +
====Steps====
 +
# Run this program and pipe it into samtools sort by query name
 +
#* <pre>./bam trimBam <your InputFile> - [#basesToTrim] [any other options] -c | samtools sort -n - tempQuerySort</pre>
 +
# Run samtools fixmate and pipe it into samtools sort by position
 +
#* <pre> samtools fixmate tempQuerySort.bam - | samtools sort - finalResult</pre>
 +
 
    
= Parameters =
 
= Parameters =
Line 68: Line 86:     
=== SoftClip the Ends (<code>--clip</code> or <code>-c</code>) ===
 
=== SoftClip the Ends (<code>--clip</code> or <code>-c</code>) ===
Use <code>--clip</code> or <code>-c</code> to soft clip the ends instead of setting to N/!.
+
Use <code>--clip</code> or <code>-c</code> to soft clip the ends instead of setting to N/! (or set to unmapped if the entire read would be soft clipped).
 
  −
When clipping:
  −
* output is not sorted (start positions may change after soft clipping)
  −
* soft clips already in the read are maintained or added to
  −
** if 3 bases were clipped and 2 are specified to be clipped, no change is made to that end
  −
** if 3 bases were clipped and 5 are specified to be clipped, 2 additional bases are clipped from that end
  −
* if the entire read would be soft clipped, no clipping is done, and instead the read is marked as unmapped
      +
See [[#Soft Clipping Notes (--clip/-c)|Soft Clipping Notes]] for more information about clipping and post processing that will need to be done.
    
{{noeofBGZFParameter}}
 
{{noeofBGZFParameter}}

Navigation menu