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

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

ADD COMMENTlink modified 8 months ago by Rory Stark2.6k • written 8 months ago by Hesh0
0
gravatar for Rory Stark
8 months ago by
Rory Stark2.6k
CRUK, Cambridge, UK
Rory Stark2.6k 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 8 months ago by Rory Stark2.6k

Thank you! 

ADD REPLYlink written 8 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), 
                        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 REPLYlink modified 7 months ago • written 7 months 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 7 months ago by Rory Stark2.6k
Please log in to add an answer.

Help
Access

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