Mapping reads to phage contigs

Given a file of contigs (contig.fasta), reads will be mapped back against this file to determine the coverage of each contig.

Mapping with bwa mem

Index the file

bwa index -a is contig.fasta

Map the reads R1.fq & R2.fq against the contigs file

bwa mem -t 16 contig.fasta R1.fq R2.fq |samtools view -bS -F4 - |samtools sort - -o contig.bam

Calculate the coverage of contig within the contig.fasta file. Use the script calc_bam_coverage.pl

 perl ~/Documents/scripts/calc_bam_coverage.pl --bam contig.bam --out Contigs.coverage.txt

This will then produce a tab-delimited file that looks liked this:

ContigName MeanCov MedianCov stdev
region1 766.2 716 377.38

Coverage information will be needed for submission of sequences to EBI