Difference between revisions of "BamUtil: trimBam"
m (moved TrimBam to BamUtil: trimBam) |
|||
Line 5: | Line 5: | ||
= Usage = | = Usage = | ||
./bam trimBam [inFile] [outFile] [num-bases-to-trim-on-each-side] | ./bam trimBam [inFile] [outFile] [num-bases-to-trim-on-each-side] | ||
+ | Alternately, the number of bases from each side can be specified (either or both -L/-R (--left/--right) can be specified): | ||
+ | ./bam trimBam [inFile] [outFile] -L [num-bases-to-trim-from-left] -R [num-bases-to-trim-from-right] | ||
+ | By default Left/Right is as the reads are in the SAM/BAM file. | ||
+ | |||
+ | Optionally --reverse/-r can be specified to reverse the left/right for reverse reads | ||
+ | |||
+ | trimBam will modify the sequences to 'N', and the quality string to '!' | ||
Line 13: | Line 20: | ||
outFile : the SAM/BAM file to be written | outFile : the SAM/BAM file to be written | ||
num-bases-to-trim-on-each-side : the number of bases/qualities to trim from each side | num-bases-to-trim-on-each-side : the number of bases/qualities to trim from each side | ||
+ | Instead of num-bases-to-trim-on-each-side, -L/-R can be specified to indicate the number of bases to trim from the left/right | ||
+ | Optional Parameters: | ||
+ | --reverse : reverse the left/right for reverse reads | ||
</pre> | </pre> | ||
Line 20: | Line 30: | ||
= Example Output = | = Example Output = | ||
+ | |||
+ | If the number to trim from each side is the same: | ||
+ | <pre> | ||
+ | Arguments in effect: | ||
+ | Input file : testFiles/testSam.sam | ||
+ | Output file : results/trimSam.sam | ||
+ | #Bases to trim from each side : 2 | ||
+ | |||
+ | Number of records read = 10 | ||
+ | Number of records written = 10 | ||
+ | </pre> | ||
+ | |||
+ | If the number to trim from each side is different (but left/right is the same for forward/reverse): | ||
<pre> | <pre> | ||
Arguments in effect: | Arguments in effect: | ||
Input file : testFiles/testSam.sam | Input file : testFiles/testSam.sam | ||
Output file : results/trimSam.sam | Output file : results/trimSam.sam | ||
− | # | + | #Bases to trim from the left of forward strands : 1 |
+ | #Bases to trim from the right of forward strands: 2 | ||
+ | #Bases to trim from the left of reverse strands : 1 | ||
+ | #Bases to trim from the right of reverse strands : 2 | ||
Number of records read = 10 | Number of records read = 10 | ||
Number of records written = 10 | Number of records written = 10 | ||
</pre> | </pre> | ||
+ | |||
+ | |||
+ | If the number to trim from each side is different and the reverse option is used(left/right is opposite for reverse): | ||
+ | <pre> | ||
+ | Arguments in effect: | ||
+ | Input file : testFiles/testSam.sam | ||
+ | Output file : results/trimSam.sam | ||
+ | #Bases to trim from the left of forward strands : 1 | ||
+ | #Bases to trim from the right of forward strands: 2 | ||
+ | #Bases to trim from the left of reverse strands : 2 | ||
+ | #Bases to trim from the right of reverse strands : 1 | ||
+ | |||
+ | Number of records read = 10 | ||
+ | Number of records written = 10 | ||
+ | </pre> | ||
+ | |||
[[Category:BamUtil|trimBam]] | [[Category:BamUtil|trimBam]] | ||
[[Category:BAM Software]] | [[Category:BAM Software]] | ||
[[Category:Software]] | [[Category:Software]] |
Revision as of 15:42, 14 November 2012
Overview of the trimBam
function of bamUtil
The trimBam
option on the bamUtil executable trims the end of reads in a SAM/BAM file, changing read ends to ‘N’ and quality to ‘!’.
Usage
./bam trimBam [inFile] [outFile] [num-bases-to-trim-on-each-side]
Alternately, the number of bases from each side can be specified (either or both -L/-R (--left/--right) can be specified):
./bam trimBam [inFile] [outFile] -L [num-bases-to-trim-from-left] -R [num-bases-to-trim-from-right]
By default Left/Right is as the reads are in the SAM/BAM file.
Optionally --reverse/-r can be specified to reverse the left/right for reverse reads
trimBam will modify the sequences to 'N', and the quality string to '!'
Parameters
Required Parameters: inFile : the SAM/BAM file to be read outFile : the SAM/BAM file to be written num-bases-to-trim-on-each-side : the number of bases/qualities to trim from each side Instead of num-bases-to-trim-on-each-side, -L/-R can be specified to indicate the number of bases to trim from the left/right Optional Parameters: --reverse : reverse the left/right for reverse reads
Return Value
Returns the SamStatus for the reads/writes. 0 on success.
Example Output
If the number to trim from each side is the same:
Arguments in effect: Input file : testFiles/testSam.sam Output file : results/trimSam.sam #Bases to trim from each side : 2 Number of records read = 10 Number of records written = 10
If the number to trim from each side is different (but left/right is the same for forward/reverse):
Arguments in effect: Input file : testFiles/testSam.sam Output file : results/trimSam.sam #Bases to trim from the left of forward strands : 1 #Bases to trim from the right of forward strands: 2 #Bases to trim from the left of reverse strands : 1 #Bases to trim from the right of reverse strands : 2 Number of records read = 10 Number of records written = 10
If the number to trim from each side is different and the reverse option is used(left/right is opposite for reverse):
Arguments in effect: Input file : testFiles/testSam.sam Output file : results/trimSam.sam #Bases to trim from the left of forward strands : 1 #Bases to trim from the right of forward strands: 2 #Bases to trim from the left of reverse strands : 2 #Bases to trim from the right of reverse strands : 1 Number of records read = 10 Number of records written = 10