anvi-get-short-reads-from-bam [program]

Get short reads back from a BAM file with options for compression, splitting of forward and reverse reads, etc.

🔙 To the main page of anvi’o programs and artifacts.


A. Murat Eren (Meren)

Can consume

profile-db contigs-db bin bam-file

Can provide



This script get the short reads (in the form of a short-reads-fasta) out of a bam-file.

A basic run of this program is as follows:

anvi-get-short-reads-from-bam -o path/to/output \ BAM_FILE_1.bam BAM_FILE_2.bam

This will get all of the short reads out of the provided bam files (BAM_FILE_1.bam and BAM_FILE_2.bam) and put them into a single file.

Narrowing the input

You can choose to only return the short reads that are contained within a collection or bin, as so:

anvi-get-short-reads-from-bam -o path/to/output \ -c contigs-db \ -p profile-db \ -C collection \ BAM_FILE_1.bam BAM_FILE_2.bam

Changing the output format

You can split the output based on the directionality of paired-end reads. Adding the tag --split-R1-and-R2 causes the program to create three separate output files: one for R1 (sequences in the forward direction), one for R2 (sequences in the reverse direction; i.e. reverse complement of R1 sequences), and one for unparied reads. When doing this, you can name these three files with a prefix by using the flag -O.

anvi-get-short-reads-from-bam -o path/to/output \ --split-R1-and-R2 \ -O BAM_1_and_BAM_2 \ BAM_FILE_1.bam BAM_FILE_2.bam

You can also compress the output by adding the flag --gzip-output

Edit this file to update this information.

Additional Resources

Are you aware of resources that may help users better understand the utility of this program? Please feel free to edit this file on GitHub. If you are not sure how to do that, find the __resources__ tag in this file to see an example.