How to plot read coverage using genomic ranges
1
0
Entering edit mode
6.4 years ago
MAPK ★ 2.1k

I have a dataframe mydf with chromosome, start position, and number of reads at that position. I was using genomicranges to follow the method discussed here, but I was not able to plot it as in the figure below. Could you please help me plot this. Thank you for your help.

mydf<- structure(list(chr = structure(c(2L, 2L, 2L, 4L, 4L, 4L, 5L, 
5L, 5L), .Label = c("Ch1", "Ch10", "Ch11", "Ch12", "Ch13", "Ch14", 
"Ch15", "Ch16", "Ch2", "Ch3", "Ch4", "Ch5", "Ch6", "Ch7", "Ch8", 
"Ch9"), class = "factor"), start = c(1000940, 1001133, 1001566, 
1060328, 1060590, 1060887, 1495099, 1497788, 1497980), read.counts = c(7, 
2, 1, 14, 8, 6, 62, 15, 7)), .Names = c("chr", "start", "read.counts"
), class = "data.frame", row.names = c(NA, -9L))

This is how I want my plot to look like(but for all chromosomes):https://ibb.co/nrbLLG

coverage plot r • 2.0k views
ADD COMMENT
1
Entering edit mode
6.4 years ago

Just do a simple plot like this using base R code: C: Histogram showing overlap between 2 bed files

The tutorial that you're following uses a custom plotCoverage function that behaves unusually and doesn't fit well with most objects in R. Your mydf certainly won't be compatible with it.

ADD COMMENT

Login before adding your answer.

Traffic: 1971 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6