KasperSkytte / ampvis2

Tools for visualising microbial community amplicon data
https://kasperskytte.github.io/ampvis2/
GNU General Public License v3.0
66 stars 23 forks source link

Core microbiome list export #115

Closed am750 closed 2 years ago

am750 commented 3 years ago

Hi Kasper,

I would like to export a list of the core microbiome , is that possible?

I am having a problem with the rarefaction curve, I have processed my data through mothur and the taxa I have is only down to genus level and I am getting this error (Error in FUN(X[[i]], ...) : object 'Species' not found), any ideas ?

Last one, is there is any way to use the Venn for more than 3 groups and how to export a list for the shared OTUs ?

Your help will be much appreciated!! Many thanks, AM

KasperSkytte commented 3 years ago

Hi there

If you mean export from amp_core() you can do something like below:

library(ampvis2)
#> Loading required package: ggplot2
coreplot <- amp_core(AalborgWWTPs, group_by = "Plant")
coreplot

coreplot$data[nObs == 2 & nCore == 2]
#>           OTU        Plant   sum    OTUprop cumOTUprop core nObs nCore
#>   1:    OTU_2 Aalborg West 49881 4.94172684   4.941727 TRUE    2     2
#>   2:    OTU_1 Aalborg West 47511 4.70693017   9.648657 TRUE    2     2
#>   3:    OTU_4 Aalborg West 30925 3.06374977  12.712407 TRUE    2     2
#>   4:    OTU_9 Aalborg West 22202 2.19955934  14.911966 TRUE    2     2
#>   5:    OTU_6 Aalborg West 16073 1.59235732  18.142947 TRUE    2     2
#>  ---                                                                  
#> 570:  OTU_268 Aalborg East   398 0.03842648  79.378399 TRUE    2     2
#> 571: OTU_9101 Aalborg East   387 0.03736445  79.604516 TRUE    2     2
#> 572:  OTU_240 Aalborg East   384 0.03707480  79.716030 TRUE    2     2
#> 573:  OTU_314 Aalborg East   384 0.03707480  79.753105 TRUE    2     2
#> 574:  OTU_306 Aalborg East   382 0.03688170  79.863847 TRUE    2     2
#>      totalReads
#>   1:    2045128
#>   2:    2045128
#>   3:    2045128
#>   4:    2045128
#>   5:    2045128
#>  ---           
#> 570:    2045128
#> 571:    2045128
#> 572:    2045128
#> 573:    2045128
#> 574:    2045128

Created on 2021-06-30 by the reprex package (v2.0.0)

to export those from the top right dot.

I need more information regarding the problem with amp_rarecurve(). See the issue template.

No, max number of groups in the venn diagram is 3. It would be too much to plot with more than 3, and the code is old and not optimized for more than 3.

am750 commented 3 years ago

Hi Kasper,

Thank you very much for the prompt response!!

I think my question was not clear, I just need to know which OTUs are the core microbiome and same for Venn diagrams which OTUs are the shared.

The amp_rarecurve() issue, when I run it I get this error (Error in FUN(X[[i]], ...) : object 'Species' not found)

Also, It would be great if you have an updated code for the Venn more than 3 groups.

Your help is much appreciated!!

Many thanks, AMS

KasperSkytte commented 3 years ago

Have you tried the detailed_output option? https://madsalbertsen.github.io/ampvis2/reference/amp_venn.html

An error is not enough for me to help, see the issue template, I need to know exactly what you've done and minimal example data to be able to reproduce.

amp_venn will only support up to 3 groups. You're welcome to experiment and add to the code to suit your own needs https://github.com/MadsAlbertsen/ampvis2/blob/master/R/amp_venn.R