-
Notifications
You must be signed in to change notification settings - Fork 6
BAMQL chain
bamql - Filter SAM/BAM files easily through a chain of filters
bamql-chain [-b] [-c method] [-I] [-f input.bam] query1 output1.bam query2 output2.bam
BAMQL filters SAM or BAM files using a simple query language that is more expressive than the view options available in samtools .
The query language is described in bamql_queries .
Unlike bamql (1),this sends each read down a collection of queries, either in parallel, the default, or in another configuration using the -c option.
If the output of a particular query is uninteresting, it can be discarded by specifying - for the output file name.
- -b
- -c method
- -f input.bam
- -I
Opens the input as BAM format, rather than SAM format.
Arrange the queries. See CHAINING for details.
The input BAM file.
Ignore the index, if present. BAM files can be indexed, allowing more efficient searching of the file. If an index is found, it will be automatically used. This switch ignore the index even if it is present; it makes no difference if it is not.
Chains of queries can be put into several configurations.
- parallel
- This is the default. Each read is independently given to all queries.
- series
- A read is given to the first query. If it passes the query, it is saved and only then, passed to the next query.
- shuttle
-
A read is given to the first query. If it passes the query, it is saved and processing stops. If it fails, it is passed to the next query.
This extracts all the reads on chromosome 7 and all the paired reads:
bamql-chain -b -f genome.bam 'chr(7)' chromo7.bam 'paired?' paired.bam
This extracts all the reads on chromosome 7 and all the paired reads on chromosome 7:
bamql-chain -b -f genome.bam -c series 'chr(7)' chromo7.bam 'paired?' chromo7_paired.bam
This extracts all the reads on chromosome 7 and all the paired reads that are on other chromosomes:
bamql-chain -b -f genome.bam -c shuttle 'chr(7)' chromo7.bam 'paired?' paired_except_chr7.bam