Description Usage Arguments Details Author(s) Examples
View source: R/genomeCoverageBed.R
For each specified bed or bam file, apply the bedtools genomeCoverageBed function to get a bedgraph file with histogram of coverage values.
1 2 3 | genomeCoverageBed(filenames, genomeSizeFile,
bedtoolsPath = "/opt/bedtools2/bin/", samtoolsPath = "~/anaconda2/bin/",
outDest = "./", outSuffix = "", norm = FALSE, strand = NULL)
|
filenames |
Character - List of BAM files |
genomeSizeFile |
String - Filename (with path) to text file containing genome size information |
bedtoolsPath |
String - Path to bedtools executables |
samtoolsPath |
String - Path to samtools exectuables |
outDest |
String - Directory where bedgraph files should be written |
outSuffix |
String - will be appended to original filename |
norm |
Logical - whether to normalize read counts to RPM (requires BAM input) |
strand |
String - For paired-end data; only do forward- or only do reverse-strand reads ("+" or "-"): "plus" or "minus" will be appended to filename |
For each specified bed or bam file, apply the bedtools genomeCoverageBed function to get a bedgraph file with histogram of coverage values. Requires bedtools and samtools to be installed. Requires tools package. Note that it's a bit faster with bed than bam input files. But if you do "norm", you have to give it a BAM file, not a bed file. TIME: ~2.5m for 600 MB bam file; ~4m for an 815 MB bam file. Slightly shorter starting from bed file (2 and 3m). IMPROVE: Make it time calculating scaling factors too. And give total time for each file and for all files. Command line examples: $ /opt/bedtools2/bin/genomeCoverageBed -g /path/to/genome_size.tab.txt -i samplename.bed -bg -split > samplename.gencov.bedgraph Or, for bam input: $ /opt/bedtools2/bin/genomeCoverageBed -g /path/to/genome_size.tab.txt -ibam samplename.bam -bg -split > samplename.gencov.bedgraph To normalize by reads per million: $ uniqueReads=$(samtools view -F 0x904 -c samplename.bam) # those flags in the samtools view command get the number of uniquely mapped reads in BAM $ /opt/bedtools2/bin/genomeCoverageBed -g /path/to/genome_size.tab.txt -ibam samplename.bam -bg -scale 1000000/uniqueReads > samplename.gencov.bedgraph
Emma Myers
1 | genomeCoverageBed('samplename.filtered.bed', '/path/to/genome_size.tab.txt', outSuffix = 'unscaled', bedtoolsPath='/opt/bedtools2/bin/')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.