jianhong / ChIPpeakAnno

11 stars 4 forks source link

makeVennDiagram fails with error 'Unexpected parameter length for "col"' #28

Closed joshua-theisen closed 1 year ago

joshua-theisen commented 1 year ago

I have a list beds where each element of the list is a GR object generated by ChIPpeakAnno::toGRanges. When I run ChIPpeakAnno::findOverlapsOfPeaks and ChIPpeakAnno::makeVennDiagram on just two elements, I get a Venn diagram as expected. When I try to run these functions with three elements of beds I get the following error:

ol <- ChIPpeakAnno::findOverlapsOfPeaks(
+   beds[[1]], 
+   beds[[2]], 
+   beds[[3]],
+   maxgap = 500
+ )
> ChIPpeakAnno::makeVennDiagram(
+   ol,
+   fill = c("pink", "lightblue"), # circle fill color
+   col = c("red", "blue"), #circle border color
+   cat.col = c("red", "blue")
+ )
Missing totalTest! totalTest is required for HyperG test. 
If totalTest is missing, pvalue will be calculated by estimating 
the total binding sites of encoding region of human.
totalTest = humanGenomeSize * (2%(codingDNA) + 
             1%(regulationRegion)) / ( 2 * averagePeakWidth )
          = 3.3e+9 * 0.03 / ( 2 * averagePeakWidth)
          = 5e+7 /averagePeakWidth
Error in VennDiagram::draw.triple.venn(area1 = length(A), area2 = length(B),  : 
  Unexpected parameter length for "col"

What does this error mean, and how can I fix it? Thanks.

jianhong commented 1 year ago

Could you please try the following code?

ChIPpeakAnno::makeVennDiagram(
        ol,
        col = ("pink", "lightblue", "lightgreen"),
    fill = c("red", "blue", "green"),
    cat.col = c("darkred", "darkblue", "darkgreen")
)

for more intormation, please ref ?venn.diagram

joshua-theisen commented 1 year ago

that was it. sorry for asking about such a stupid mistake. thanks for your help.

jianhong commented 1 year ago

Not your fault. I did not make the documentation clear.

joshua-theisen commented 1 year ago

That is very gracious of you. I should have searched harder for the col argument, but I think I got distracted by the rest of the error/warning text. Thanks again!