This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is There Software For Generating A Histogram Or Boxplot From Values In Bedgraph Files?

I was wondering if there was software to generate histograms of a set of input bedgraph files so that we could look at the output and compare the signals of the tracks. Our goal is to see if these values are comparable; that the data sets are of a similarity quality.

graphs

2 answers

Here's some R code:

library(rtracklayer)
setwd("mywigdir")
files<-Sys.glob("*.wig")
d<-list()
pdf("hists.pdf")
for( i in 1:length(files))
{
    d[[i]]<-import.wig(files[i])
    hist(d[[i]]$score,breaks=20,xlim=c(-6,6),col='blue')
}
dev.off()

Or you could make a boxplot of the scores:

scores<-lapply(d,function(x){x$score})
boxplot(scores,names=files,las=2,cex.axis=.6)

Thank you. It turns out your solution is technically correct, unfortunately we are now running into the problem that our data sets are extremely large. The signal file itself is 2.5G which takes an unreasonable amount of RAM in R.

Ah, you know, I was wondering about that... You could sample the file somehow ahead of time if you're only interested in the general distribution of scores...

Anything that can generate histograms or box plots should do the job, such as R. In R, a simple "boxplot(y ~ group)" allows you to plot your data by a grouping factor "group".

Log in to answer this question.