This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to plot read coverage using genomic ranges

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

1 answer

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.

Log in to answer this question.