One of the most frequently used BamTools command is convert.
The basic usage of the BamTools convert is:
$ bamtools convert -format [bed|fasta|fastq|json|pileup|sam|yaml] -in input_alignments.bam -out output_reads.[bed|fasta|fastq|json|pileup|sam|yaml]
Running BamTools convert on Swan with input file input_alignments.bam
and output file output_reads.fastq
is shown below:
bamtools_convert.submit
#!/bin/bash
#SBATCH --job-name=BamTools_Convert
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --time=168:00:00
#SBATCH --mem=10gb
#SBATCH --output=BamTools.%J.out
#SBATCH --error=BamTools.%J.err
module load bamtools/2.4
bamtools convert -format fastq -in input_alignments.bam -out output_reads.fastq
All BamTools commands are single threaded, and therefore both #SBATCH --nodes
and #SBATCH --ntasks-per-node
are set to 1.
The basic usage of the BamTools count is:
$ bamtools count -in input_alignments.bam
The basic usage of the BamTools coverage is:
$ bamtools coverage -in input_alignments.bam -out output_reads_coverage.txt
The basic usage of the BamTools filter is:
$ bamtools filter -in input_alignments.bam -out output_alignments_filtered.bam -length 100
output_alignments_filtered.bam
contains alignments with length longer than 100 base pairs.
The basic usage of the BamTools header is:
$ bamtools header -in input_alignments.bam -out output_alignments_header.txt
The basic usage of the BamTools index is:
$ bamtools index -in input_alignments.bam
input_alignments.bam.bai
file.
The basic usage of the BamTools merge is:
$ bamtools merge -in input_alignments_1.bam -in input_alignments_2.bam -in input_alignments_3.bam -out output_alignments_merged.bam
The basic usage of the BamTools random is:
$ bamtools random -in input_alignments.bam -out output_alignments_100.bam -n 100
-n 100
, 100 randomly chosen alignments are stored in the output file output_alignments_100.bam
.
The basic usage of the BamTools resolve is:
$ bamtools resolve -twoPass -in input_alignments.bam -out output_alignments.bam
-makeStats
, -markPairs
, or -twoPass
.
The basic usage of the BamTools revert is:
$ bamtools revert -in input_alignments.bam -out output_alignments_reverted.bam
The basic usage of the BamTools sort is:
$ bamtools sort -in input_alignments.bam -out output_alignments_sorted.bam -byname
output_alignments_sorted.bam
is the resulting file, where the alignments are sorted by name.
The basic usage of the BamTools split is:
$ bamtools split -in input_alignments.bam -mapped
input_alignments.MAPPED.bam
is produced after -mapped
split option is specified. Beside mapped
, the split option can be: -paired
, -reference
, or -tag <tag_name>
.
The basic usage of the BamTools stats is:
$ bamtools stats -in input_alignments.bam