You can skip all the bed stuff and just load a sorted and indexed bam file directly into IGV. It shows a coverage track along with the reads, so it should give you the same result with fewer steps.
I am interested in finding out at how well my genome is covered (depth of coverage) by the reads I got out on an Illumina run to determine if there are loci that are under-represented, or missing (i.e. large deletion) or over-represented. Is there any script that can do that? I already aligned the reads using BWA.
Thank you.
3 answers
You probably have a file in SAM format. Convert to BAM (samtools):
samtools view -bS -F 4 data.sam > data.bam
Convert from BAM to BED (bedtools command):
bamToBed -i data.bam > data.bed
BED to Sorted BED (unix system command):
sort -k1,1 data.bed > data.sorted
Sorted BED to BedGraph (bedtools command):
genomeCoverageBed -bga -i data.sorted -g chrom.sizes > data.bedGraph
Convert to bigwig for fast viewing (UCSC utilities):
bedGraphToBigWig data.bedGraph chrom.sizes data.bw
Finally, use a program like IGV to view it. On a Mac, it's as easy as selecting the right genome, then drag and drop the bigwig file into the window. You can now explore your underrepresented features.
Note that the chrom.sizes file is a tab delimited file with the format: <chromosome name><tab><number of bases in chromosome>
Here are other ways to do it! http://onetipperday.blogspot.com/2012/07/three-ways-to-convert-bambed-file-to.html
If you want to eyeball coverage, one easy way is with IGV, from the Broad institute.
Thank you, that worked!
Log in to answer this question.