Tools needed
samtools (if your bam file is not sorted by position), bedtools and ucsc's bedGraphToBigWig in the ucsc command line utilitiesProcedure
samtools sort input.bam input.sorted
mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -e "select chrom, size from hg19.chromInfo" > hg19.genome
bedtools genomecov -ibam input.sorted.bam -bg hg19.genome > input.sorted.bedGraph
bedGraphToBigWig input.sorted.bedGraph hg19.genome input.sorted.bigwig
Unfortunately we can't pipe genomecoverage directly into bedGraphToBigWig because bedGraphToBigWig does a few passes over the file (for improved speed).
Other things to consider:
1) Scaling : setting a scale factor (within bedtools) would normalize your bedgraph/bigwig files (the default=1, no scaling). I generally scale all files to say, 10 million reads (get total reads from eg. samtools flagstat output) so that they can be consistently used throughout different comparisons.
2) -split option should be used for RNA-seq to properly represent spliced reads.
3) -strand option in theory would give you strand-specific files (meaning you'll have a +ve and -ve set) but for my paired-end directional reads, it seems to only work for the first in read pair. I've left out this option until I figure out a solution.
No comments:
Post a Comment