Skip to content
PragashSiva edited this page Mar 2, 2016 · 8 revisions

 

NAME

bamql - Filter SAM/BAM files easily  

SYNOPSIS

bamql [-b] [-I] [-o accepted_output.bam] [-O rejected_output.bam] -f input.bam {-q query.bamql | query}

 

DESCRIPTION

BAMQL filters SAM or BAM files using a simple query language that is more expressive than the view options available in samtools(1). The query language is described in bamql_queries.

 

OPTIONS

-b
Opens the input as BAM format, rather than SAM format.
-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.
-o accepted_output.bam
Any reads which are accepted by the query, that is, for which the query is true, will be placed in this file. If omitted, the number of queries will be tallied, but discarded
-O rejected_output.bam
Any reads which are rejected by the query, that is, for which the query is false, will be placed in this file. If omitted, the number of queries will be tallied, but discarded
-q query.bamql
Read the query from a file. This allows the query to be put in a file with a first line of #!/usr/bin/bamql -q such that it can be invoked from the shell.

 

EXAMPLE

This extracts all the reads on chromosome 7:

`bamql -o chromo7.bam -b -f genome.bam 'chr(7)'`

Clone this wiki locally