How to extract overlapping and unique peaks from the Venn Diagram to a csv format in DiffBind?
1
0
Entering edit mode
Hesh ▴ 10
@hesh-14437
Last seen 4.1 years ago
University of Washington

Hi, 

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

Hesh

DiffBind plotvenn • 2.1k views
ADD COMMENT
0
Entering edit mode
Rory Stark ★ 5.2k
@rory-stark-5741
Last seen 8 weeks ago
Cambridge, UK

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 COMMENT
0
Entering edit mode

Thank you! 

ADD REPLY
0
Entering edit mode

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), 
                        starts=start(gr)-1,
                        ends=end(gr),
                        names=c(rep(".", length(gr))),
                        scores=c(rep(".", length(gr))),
                        strands=strand(gr))
write.table(venn_2_df, file="Venn_c123_th1.bed", quote=F, sep="\t", row.names=F, col.names = F)

 

ADD REPLY
0
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 753 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