Skip to content
PragashSiva edited this page Mar 2, 2016 · 1 revision

NAME

bamql - Filter SAM/BAM files easily through a chain of filters  

SYNOPSIS

bamql-chain [-b] [-c method] [-I] [-f input.bam] query1 output1.bam query2 output2.bam

 

DESCRIPTION

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.

 

OPTIONS

-b
Opens the input as BAM format, rather than SAM format.
-c method
Arrange the queries. See CHAINING for details.
-f input.bam
The input BAM file.
-I
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.

 

CHAINING

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.

 

EXAMPLE

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

Clone this wiki locally