calcs
is a command-line tool specifically designed to append a minimap2's cs tag to a SAM file.
Caution
If your SAM file has MD tags, we recommend using cstag-cli
or paftools.js sam2paf
.
Even if your SAM/BAM files do not have MD tags, we recommend using samtools calmd
to add MD tags, and cstag-cli
to add cs tags since calcs
requires computational time.
See the Comparison with other tools section for details.
You can install calcs
using pip:
pip install calcs
Alternatively, you can get calcs
from bioconda:
conda install -c bioconda calcs
calcs [options] <in.sam> -r/--reference <in.fasta>
-l/--long: output a cs tag in the long form
-t/--threads [INT]: number of threads to use (default: 1)
# cs tag (short form)
calcs examples/example.sam --reference examples/ref.fa > example_cs.sam
# cs tag (long form)
calcs examples/example.sam --reference examples/ref.fa --long > example_cslong.sam
# PAF format with cs tag (short form)
calcs examples/example.sam --reference examples/ref.fa --paf > example_cs.paf
# PAF format with cs tag (long form)
calcs examples/example.sam --reference examples/ref.fa --paf --long > example_cslong.paf
# Multiprocessing
calcs examples/example.sam --reference examples/ref.fa --threads 4 > example_cs.sam
If the input file is a BAM/CRAN format, you can use samtools view
.
samtools view examples/example.bam |
calcs -l -r examples/ref.fa |
samtools sort > example_cslong.bam
Here is the brief comparison between calcs
, cstag-cli
, and sam2paf
.
calcs |
cstag-cli |
sam2paf |
|
---|---|---|---|
Input | SAM and FASTA | SAM or BAM with a MD tag | SAM with a MD tag |
Output format | SAM or PAF | SAM or BAM | PAF |
Speed | Slow🐢 | Fast🐇 | Fast🐇 |
Instead of calcs
, we recommend using either cstag-cli
or sam2paf
.
If a SAM file lacks MD tags, you can first add these tags using samtools calmd
and then apply cstag-cli
.