How to map long Oxford Nanopore reads to reference genome (and view in IGV)

How to map long Oxford Nanopore reads to reference genome (and view in IGV)

Very long Oxford Nanopore reads cause a problem with BAM format. The max. CIGAR operations permitted to store per read are 65535 (https://samtools.github.io/hts-specs/SAMv1.pdf).

So if you want to convert SAM to BAM you get an error.

However, using the newer CRAM format (https://samtools.github.io/hts-specs/CRAMv3.pdf) you can avoid this problem. Also, CRAM has a smaller memory footprint.

Here, I am going to show you how to map ONP reads using Graphmap (https://github.com/isovic/graphmap) and converting to CRAM (using samtools) and then how to see the result in IGV.

    1. graphmap align -r ref.fasta -d reads.fastq -o alignment.sam
    2. To have CRAM support you need a recent samtools version. I am using version 1.6.
      samtools view -T ref.fasta -C -o alignment.cram alignment.sam
    3. Now we sort the CRAM file:
      samtools sort -O CRAM -o sorted_alignment.cram alignment.cram
    4. Let’s index the sorted CRAM file:
      samtools index sorted_alignment.cram
    5. Then you (1) open IGV, (2) open the reference genome (Genomes > Load Genome from File… > Choose reference *.fasta), (3) open alignment (File > Load from File… > Choose sorted CRAM, NOT the index)

Leave a Reply

Your email address will not be published. Required fields are marked *