yanlinlin82 / ggvenn

Venn Diagram by ggplot2, with really easy-to-use API.
Other
167 stars 25 forks source link

Zero (0) or NA values are recognized. #35

Closed ricmedveterinario closed 1 year ago

ricmedveterinario commented 1 year ago

Is there a way, that values like 0 and NA are not recognized in an intersection in a list? I believe that zero should be recognized as nothing, or null.

yanlinlin82 commented 1 year ago

That depends on how to explain the field which contains the 0/NA values. A preprocessing step of filtering out 0/NA values before plotting by ggvenn would help if required.

By the way, could you provide an example to make the issue clearer?

amy-houseman commented 1 year ago

Hello,

I am having the same problem - I have three columns but two are shorter than the other so end up having blank cells at the end of their last values - therefore these are appearing as common values between the two groups. I have tried to delete these cells prior to uploading to R but this hasn't worked.

I am not sure how to make an example for you but it was uploaded as a csv - sorry if that isn't enough info! Thanks, Amy

yanlinlin82 commented 1 year ago

Hi, @amy-houseman

If you have loaded the csv into R as variable 'a', you can try dput(a) to get the construction command. If the file is too big, I suggest you simplify it first. We just need a minimal case to show the problem.

amy-houseman commented 1 year ago

Hi,

Thanks for you reply! I managed to fix my problem with

df[df == ''] <- NA
df <- na.omit(df)

Before turning it into a list for ggvenn! Thank you :))

yanlinlin82 commented 1 year ago

Thank you very much for the useful sharing. I think I can close this issue now.

amy-houseman commented 1 year ago

Hello,

Sorry, me again! I was able to use df[df == ''] <- NA to add na to the blanks but actually df <- na.omit(df) was removing the entire row from being used in the Venn diagram.

csv file uploaded = TEST_overlapping_GOF_LOF_2_plus_denovo

Code:

a <- TEST_overlapping_GOF_LOF_2_plus_denovo
a[a == ''] <- NA
a <- na.omit(a)

library(ggvenn)
a <- list('LOF_2_or_more_list'= a$LOF_2_or_more_list,
          'GOF_2_or_more_list' = a$GOF_2_or_more_list,
          'De_novo' = a$De_novo)

ggvenn(a, c("LOF_2_or_more_list", "GOF_2_or_more_list", "De_novo"),  fill_color = c("pink", "lightblue3", "mediumseagreen"))

I tired to dput(a) but I think it misses out the end of the file which is where the problems occur - I have made a small version of the file attached TEST_overlapping_GOF_LOF_2_plus_denovo.csv

To produce the venn:

a <- TEST_overlapping_GOF_LOF_2_plus_denovo

library(ggvenn)
a <- list('LOF_2_or_more_list'= a$LOF_2_or_more_list,
          'GOF_2_or_more_list' = a$GOF_2_or_more_list,
          'De_novo' = a$De_novo)
ggvenn(a, c("LOF_2_or_more_list", "GOF_2_or_more_list", "De_novo"),  fill_color = c("pink", "lightblue3", "mediumseagreen"))

As you can see from this example, there should be: LOF_2_or_more_list Vs De_novo = 3 overlaps (A,B,C). LOF_2_or_more_list should have 2 of its own values (D,E). and GOF_2_or_more_list should not overlap with anything but have 1 of its own values (H).

But as you can see: LOF_2_or_more_list Vs De_novo = 3 LOF_2_or_more_list = 2 own values GOF_2_or_more_list = 1 of its own GOF_2_or_more_list Vs De_novo = 1

Image 31-03-2023 at 00 26

This GOF_2_or_more_list Vs De_novo = 1 is caused by the GOF_2_or_more_list and De_novo list both having blank cells which are being detected as shared values.

Do you know what can stop these blanks being detected as values?

Thanks! Amy

yanlinlin82 commented 1 year ago

Yes, you're right. NA should not be counted in such cases. That is indeed a bug. I will fix it soon.

yanlinlin82 commented 1 year ago

Hi, @amy-houseman

I have fixed this issue in this commit, and published a new release (v0.1.10), as well as on CRAN.

You may upgrade to the new version by either

devtools::install_github("yanlinlin82/ggvenn")

or

install.package("ggvenn")
amy-houseman commented 1 year ago

Hi, I have installed the new version but I'm still not sure its working - could I send you my file via email for you to test? Thanks! Sorry to be a pain! Amy

yanlinlin82 commented 1 year ago

Hi, I have installed the new version but I'm still not sure its working - could I send you my file via email for you to test? Thanks! Sorry to be a pain! Amy

ok

ricmedveterinario commented 1 year ago

Hello @yanlinlin82 ,

Thank you for updating the package,

I will test again soon,

Sorry, but I believe I missed the updates for this discussion,

Best Regards,