Skip to content

bam2cram.smk

Snakemake workflow for file format conversion from BAM to CRAM to compress the file size.

Note

Please make sure that you have Singularity and Snakemake installed on your system and cloned the SnakeNgs repository.

Workflow

bam2cram.smk rulegraph

The rulegraph was created by snakevision.

  1. Convert BAM files to CRAM files using samtools.
  2. Make CRAM index files (.crai) using samtools.

Usage

1
2
3
4
5
6
7
8
snakemake -s /rhome/naotok/SnakeNgs/Snakefile_bam2cram \
--config \
workdir=/path/to/output \
reference=/path/to/reference_genome.fa \
bam_list=/path/to/bam_list.txt \
--cores <int> \
--use-singularity \
--rerun-incomplete
  • path/to/output is the directory where the log files will be saved.
  • path/to/reference_genome.fa is the reference genome file in FASTA format (e.g., Mus_musculus.GRCm38.dna_sm.primary_assembly.fa for mouse genome).
  • path/to/bam_list.txt is a text file containing the list of BAM files to be converted to CRAM files:
1
2
3
4
5
6
/path/to/SRRXXXXXX.bam
/path/to/SRRYYYYYY.bam
/path/to/SRRZZZZZZ.bam
/path/to/SRRAAAAAA.bam
/path/to/SRRBBBBBB.bam
/path/to/SRRCCCCCC.bam

The CRAM files will be saved in the same directory as the input BAM files with the .cram extension.

Docker image used in the workflow