Format specifications

The CRAM format specification is available as follows:

CRAM 3.0 specification 

CRAM 2.1 specification

CRAM 1.0 specification

Reporting bugs

Please report any bugs, issues and problems through Github:

https://github.com/enasequence/cramtools/issues

Mailing list

http://sourceforge.net/p/samtools/mailman/samtools-devel/

Download

CRAMTools version 3.0 and later

For more information, please see:

https://github.com/enasequence/cramtools/blob/master/README 

Accessing command line help

General options:

java -jar cramtools-<version>.jar

 

BAM to CRAM conversion options:

java -jar cramtools-<version>.jar bam

 

CRAM to BAM conversion options:

java -jar cramtools-<version>.jar cram 

Reference sequences

The search order to obtain a reference is similar to SAMTools:

  1. Use any local file specified by the command line option --reference-fasta-file or -R.
  2. Look for MD5 via REF_CACHE environment variable.
  3. Look for MD5 in each element of the REF_PATH environment variable.
  4. Look for a local file listed in the UR: header tag.

For details of the REF_CACHE and REF_PATH variables please refer to the SAMTools 1.1.

 

Convert a BAM file to a CRAM file

A typical command to convert a BAM file into a CRAM file is:

java -jar cramtools-<version>.jar cram --input-bam-file <bam file> --reference-fasta-file <reference fasta file> [--output-cram-file <output cram file>] 

 

Input files:

  1. <bam file>: BAM file sorted by reference coordinates
  2. <bam file>.bai: BAM index file created using samtools index <bam file>
  3. <reference fasta file>: Reference sequence in fasta format
  4. <reference fasta file>.fai: Reference sequence index file created using samtools faidx <reference fasta file>

Convert a CRAM file to a BAM file

java -jar cramtools-<version>.jar bam --input-cram-file <cram file> --reference-fasta-file <reference fasta file> --output-bam-file <output bam file>

 

Input files:

  1. <cram file>: CRAM file
  2. <reference fasta file>: Uncompressed reference sequence in fasta format
  3. <reference fasta file>.fai: Reference sequence index file