Question: How to extract overlapping and unique peaks from the Venn Diagram to a csv format in DiffBind?
gravatar for Hesh
3 months ago by
University of Washington
Hesh0 wrote:


I have differential binding analysis performed on a set of samples and plotted a Venn diagram (using DiffBind) to look at overlapping and unique diff. bound sites. Now I want to get those peaks in the Venn Diagram as a list for further analysis and to look on IGV. How can I convert these data to a report / csv file ? "bReturnPeaksets" function is removed it seems.


Thank you


ADD COMMENTlink modified 3 months ago by Rory Stark2.5k • written 3 months ago by Hesh0
gravatar for Rory Stark
3 months ago by
Rory Stark2.5k
CRUK, Cambridge, UK
Rory Stark2.5k wrote:

dba.plotVenn() returns the overlapping peaksets "invisibly", so bReturnPeaksets is no longer needed. Simple assign the return value of dba.plotVenn() to a variable and you will have a list of all the overlapping peaksets (as GRanges), as before.


ADD COMMENTlink written 3 months ago by Rory Stark2.5k

Thank you! 

ADD REPLYlink written 3 months ago by Hesh0

I'm having trouble converting the output GRanges file to a CSV file. I did try a couple different methods to convert the GRanges to a CSV or BED file but I keep getting errors. Highly appreciate if you can let me know how to get the output in CSV format. 

Thank you!


This is what I tried: 

gr <- GRanges(seqnames = Rle(Venn_2$name),
              ranges = IRanges(Venn_2$start, end=Venn_2$stop),
              strand = Rle(strand(c(rep("*", length(Venn_2$name))))),
              Conc = Venn_2$Conc)
venn_2_df <- data.frame(seqnames=seqnames(gr), 
                        names=c(rep(".", length(gr))),
                        scores=c(rep(".", length(gr))),
write.table(venn_2_df, file="Venn_c123_th1.bed", quote=F, sep="\t", row.names=F, col.names = F)


ADD REPLYlink modified 12 weeks ago • written 12 weeks ago by Hesh0

Actually you can just call write.csv() on a GRanges object. You will get a column with the strand, which you may not want.

Another way is to convert a GRanges to a data.frame by calling data.frame(myGRanges), then write that out with write.csv() including/deleting the columns you are/aren't interested in.

ADD REPLYlink written 12 weeks ago by Rory Stark2.5k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 256 users visited in the last hour