Line 1: |
Line 1: |
− | [[Category:libbam]] | + | [[Category:BamUtil|filter]] |
| + | [[Category:BAM Software]] |
| + | [[Category:Software]] |
| | | |
− | == filter == | + | = Overview of the <code>filter</code> function of <code>bamUtil</code> = |
− | | + | The <code>filter</code> option on the [[bamUtil]] 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 <code>filter</code> option on the [[Bam|bam 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: | | The following modifications may occur in an alignment: |
Line 10: |
Line 11: |
| * 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. | | * 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, the mate also needs to be updated. |
− | 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. | | Also, if the file was sorted, and a POS was changed, the file may no longer be sorted. |
Line 17: |
Line 17: |
| '''NOTE: This program does NOT update the mate or resort the file.''' | | '''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. | | In order to update the mate, samtools fixmate must be run. |
| | | |
Line 25: |
Line 26: |
| * samtools sort cannot write to pipes. | | * samtools sort cannot write to pipes. |
| | | |
− | Steps: | + | ===Steps=== |
| # Run this program and pipe it into samtools sort by query name | | # 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>./bam filter --in <your InputFile> --refFile <your reference file> --out -.bam <any other options> | samtools sort -n - tempQuerySort</pre> |
Line 31: |
Line 32: |
| #* <pre> samtools fixmate tempQuerySort.bam - | samtools sort - finalResult</pre> | | #* <pre> samtools fixmate tempQuerySort.bam - | samtools sort - finalResult</pre> |
| | | |
− | For Example:
| + | ===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 | | ~/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 ===
| + | = Parameters = |
| <pre> | | <pre> |
| Required Parameters: | | Required Parameters: |
Line 53: |
Line 54: |
| </pre> | | </pre> |
| | | |
− | === Usage ===
| + | = Usage = |
| | | |
| ./bam filter --in <inputFilename> --refFile <referenceFilename> --out <outputFilename> [--noeof] [--qualityThreshold <qualThresh>] [--defaultQualityInt <defaultQual>] [--mismatchThreshold <mismatchThresh>] [--params] | | ./bam filter --in <inputFilename> --refFile <referenceFilename> --out <outputFilename> [--noeof] [--qualityThreshold <qualThresh>] [--defaultQualityInt <defaultQual>] [--mismatchThreshold <mismatchThresh>] [--params] |
| | | |
− | === Return Value ===
| + | = Return Value = |
| * 0: all records are successfully read and written. | | * 0: all records are successfully read and written. |
| * non-0: at least one record was not successfully read or written. | | * non-0: at least one record was not successfully read or written. |
| | | |
− | === Example Output ===
| + | = Example Output = |
| <pre> | | <pre> |
| | | |
Line 73: |
Line 74: |
| | | |
| | | |
− | === FAQ ===
| + | = FAQ = |
| This section contains information about what the filters mean, how they work, etc. | | This section contains information about what the filters mean, how they work, etc. |
| | | |
Line 96: |
Line 97: |
| :This is requires a bit more logic...and thus gets its own section: [[Bam Executable: Filter#Mismatch Threshold|Mismatch Threshold]]. | | :This is requires a bit more logic...and thus gets its own section: [[Bam Executable: Filter#Mismatch Threshold|Mismatch Threshold]]. |
| | | |
− | ==== Mismatch Threshold ====
| + | = Mismatch Threshold = |
| | | |
| Mismatch threshold is: | | Mismatch threshold is: |