From Genome Analysis Wiki
Jump to: navigation, search

BamUtil: filter

109 bytes added, 13:18, 2 September 2011
[[Category:libbamBamUtil|filter]][[Category:BAM Software]][[Category:Software]]
== Overview of the <code>filter =</code> function of <code>bamUtil</code> = The <code>filter</code> option on the [[Bam|bam executablebamUtil]] executable writes the alignments , filtering them by clipping ends with too high of a mismatch percentage and by marking reads unmapped if the quality of mismatches is too high.
The following modifications may occur in an alignment:
* FLAG updated to reflect a read is unmapped if it is below the quality of mismatches is too high, or clipping would cause an entire read to be clipped.
=== NOTES ===The POS and FLAG fields of an alignment are reflected in the mate's alignment. Thus, when the mate also needs to be updated.
Also, if the file was sorted, and a POS was changed, the file may no longer be sorted.
'''NOTE: This program does NOT update the mate or resort the file.'''
== Fixing the mate/resorting ==
In order to update the mate, samtools fixmate must be run.
* samtools sort cannot write to pipes.
# Run this program and pipe it into samtools sort by query name
#* <pre>./bam filter --in <your InputFile> --refFile <your reference file> --out -.bam <any other options> | samtools sort -n - tempQuerySort</pre>
#* <pre> samtools fixmate tempQuerySort.bam - | samtools sort - finalResult</pre>
For ===Example:===
~/pipeFilter/bam/bam filter --in ../../originalBamFile.bam --refFile ~/data/human.g1k.v37.fa --out -.bam | samtools sort -n - tempQuerySort; samtools fixmate tempQuerySort.bam - | samtools sort - newResult
=== Parameters ===
Required Parameters:
=== Usage ===
./bam filter --in <inputFilename> --refFile <referenceFilename> --out <outputFilename> [--noeof] [--qualityThreshold <qualThresh>] [--defaultQualityInt <defaultQual>] [--mismatchThreshold <mismatchThresh>] [--params]
=== Return Value ===
* 0: all records are successfully read and written.
* non-0: at least one record was not successfully read or written.
=== Example Output ===
=== FAQ ===
This section contains information about what the filters mean, how they work, etc.
:This is requires a bit more logic...and thus gets its own section: [[Bam Executable: Filter#Mismatch Threshold|Mismatch Threshold]].
==== Mismatch Threshold ====
Mismatch threshold is:

Navigation menu