Giter Club home page Giter Club logo

funguildr's Introduction

FUNGuildR

R-CMD-check Codecov test coverage

FUNGuildR is a tool for assigning trait information based on matching to a taxonomic classification, using the FUNGuild database. In normal use, the database is queried for each use, because FUNGuild are continually updated as new information is submitted. However, FUNGuildR also includes functions to download the database and store it as an R object to speed up repeated queries, make queries reproducible over time, and allow local queries without internet access.

Installation

For the moment, FUNGuildR can only be installed from GitHub. To install, be sure you have installed the devtools package, and then type:

devtools::install_github("brendanf/FUNGuildR")

Guild assignment

The main function is funguild_assign(). It takes as its only required argument a data.frame, which should contain a character column named “Taxonomy”. It returns a version of the same data.frame (as a tibble) with additional columns:

taxon: The name of the matched taxon.
guid: Globally Unique Identifier for the database record.
mbNumber: The MycoBank number of the taxon.
taxonomicLevel: A numeric representation of the taxonomic rank; higher numbers are lower ranks.
trophicMode: A very general overview of how the organism gets its nutrition; one or more of Saprotroph, Pathotroph, and Symbiotroph.
guild: One or more narrower categories for how the organism gets its nutrition.
confidenceRanking: The confidence level of the guild assignment; Possible, Probable, or Highly Probable.
growthForm: The general growth morphology of the organism (or its fruiting body). Multiple values may be given.
trait: Additional traits about the organism, such as wood decay type or toxicity.
note: Additional notes about the entry.
citationSource: Citation(s) for the information about the taxon.

That’s it!

Here’s how it works on a sample database (scroll to see additional columns):

sample_fungi
Common.Name Species Taxonomy
Button mushroom Agaricus bisporus Fungi;Basidiomycota;Agaricomycetes;Agaricales;Agaricaceae;Agaricus;Agaricus bisporus
Death Cap Amanita phalloides Fungi;Basidiomycota;Agaricomycetes;Agaricales;Amanitaceae;Amanita;Amanita phalloides
Beer Yeast Saccharomyces cerevisiae Fungi;Ascomycota;Saccharomycetes;Saccharomycetales;Saccharomycetaceae;Saccharomyces;Saccharomyces cerevisiae
Rhizophagus Rhizophagus irregularis Fungi;Glomeromycota;Glomeromycetes;Glomerales;Glomeraceae;Rhizophagus;Rhizophagus irregularis
Dry rot Serpula lacrymans Fungi;Basidiomycota;Agaricomycetes;Boletales;Serpulaceae;Serpula;Serpula lacrymans
Cryptococcus Cryptococcus neoformans Fungi;Basidiomycota;Tremellomycetes;Tremellales;Tremellaceae;Cryptococcus;Cryptococcus neoformans
Dung Cannon Pilobolus crystallinus Fungi;Zygomycota;Mucoromycetes;Mucorales;Pilobolaceae;Pilobolus;Pilobolus crystallinus
sample_guilds <- funguild_assign(sample_fungi)
sample_guilds
Common.Name Species Taxonomy taxon guid mbNumber taxonomicLevel trophicMode guild confidenceRanking growthForm trait notes citationSource
Button mushroom Agaricus bisporus Fungi;Basidiomycota;Agaricomycetes;Agaricales;Agaricaceae;Agaricus;Agaricus bisporus Agaricaceae 1CB1CCAB-36B9-11D5-9548-00D0592D548C 80434 9 Saprotroph Undefined Saprotroph Probable Agaricoid-Gasteroid-Secotioid NULL Primarily saprobes in grassland and woodland situations (Cannon & Kirk 2007) Cannon PF, Kirk PM. 2007. Fungal Families of the World. CAB International, Cambridge (ISBN: 978-0851998275)
Death Cap Amanita phalloides Fungi;Basidiomycota;Agaricomycetes;Agaricales;Amanitaceae;Amanita;Amanita phalloides Agaricales 715D162F-5F0E-40C8-A7DC-79D488D3F937 90508 7 Pathotroph-Saprotroph-Symbiotroph Bryophyte Parasite-Dung Saprotroph-Ectomycorrhizal-Fungal Parasite-Leaf Saprotroph-Plant Parasite-Undefined Saprotroph-Wood Saprotroph Possible Agaricoid-Gasteroid-Microfungus-Secotioid-Yeast NULL Mushrooms and toadstools, Gill fungi, Agarics… lignicolous, sometimes muscicolous or fungicolous, saprobic, mycorrhizal, rarely parasitic on plants or fungi (Kirk et al. 2008) Kirk PM et al. 2008. Dictionary of the Fungi. Tenth Edition. CAB International, Wallingford (ISBN: 978-0851998268)
Beer Yeast Saccharomyces cerevisiae Fungi;Ascomycota;Saccharomycetes;Saccharomycetales;Saccharomycetaceae;Saccharomyces;Saccharomyces cerevisiae Saccharomyces cerevisiae C140119E-2E48-43E7-A77A-3C749D931D94 492348 20 Saprotroph Undefined Saprotroph Probable Yeast NULL NULL James TY, et al. 2006. Nature 443:818-822 ((https://doi.org/10.1038/nature05110))
Rhizophagus Rhizophagus irregularis Fungi;Glomeromycota;Glomeromycetes;Glomerales;Glomeraceae;Rhizophagus;Rhizophagus irregularis Glomeraceae 1CB1CD2A-36B9-11D5-9548-00D0592D548C 82026 9 Symbiotroph Arbuscular Mycorrhizal Highly Probable Microfungus NULL NULL Redecker D, et al. 2013. Mycorrhiza 23:515-531 ((https://doi.org/10.1007/s00572-013-0486-y))
Dry rot Serpula lacrymans Fungi;Basidiomycota;Agaricomycetes;Boletales;Serpulaceae;Serpula;Serpula lacrymans Serpula lacrymans 1CB1A2AB-36B9-11D5-9548-00D0592D548C 102458 20 Saprotroph Wood Saprotroph Probable Corticioid Brown Rot An aggressive brown-rot (dry rot) fungus that causes very significant economic losses through degradation of wooden parts of buildings (Cannon & Kirk 2007) Cannon PF, Kirk PM. 2007. Fungal Families of the World. CAB International, Cambridge (ISBN: 978-0851998275)
Cryptococcus Cryptococcus neoformans Fungi;Basidiomycota;Tremellomycetes;Tremellales;Tremellaceae;Cryptococcus;Cryptococcus neoformans Cryptococcus neoformans 1CB1BA14-36B9-11D5-9548-00D0592D548C 119294 20 Pathotroph Animal Pathogen Highly Probable Dimorphic Yeast NULL Likely opportunistic human pathogen (Irinyi et al. 2015) Kurtzman CP, et al. (eds.) 2011. The Yeasts, a Taxonomic Study. Fifth Edition. Vols 1-3. Elsevier, San Diego (ISBN: 9780444521491); Irinyi L, et al. 2015. Medical Mycology 53:313-337 ((https://doi.org/10.1093/mmy/myv008))
Dung Cannon Pilobolus crystallinus Fungi;Zygomycota;Mucoromycetes;Mucorales;Pilobolaceae;Pilobolus;Pilobolus crystallinus Pilobolus 1CB1CA1E-36B9-11D5-9548-00D0592D548C 20420 13 Saprotroph Dung Saprotroph Highly Probable NULL NULL NULL Bell A. 1983. Dung Fungi: An Illustrated Guide to Coprophilous Fungi in New Zealand. Victoria University Press, Wellington (ISBN: 978-0864730015); Tedersoo L, et al. 2014. Science 346:e1256688 ((https://doi.org/10.1126/science.1256688))

For more information about the meaning of the new columns, see the FUNGuild manual.

Input data format

Each value in the Taxonomy column of the input data.frame should consist of a comma-, colon-, underscore-, or semicolon-delimited list of taxa which the organism on that row belongs to. You can see examples in the sample_fungi data presented above. Taxonomy strings which include taxonomic rank indicators in the styles used by Sintax (“k:”, “p:”…) or Unite (“k__,”p__“, …) are also accepted.

Such taxonomic classifications are frequently arranged from the most inclusive taxon (e.g., Kingdom) to the least inclusive taxon (e.g., Species), but this is not actually required for FUNGuild. Not all taxonomic ranks are required; for each row, the algorithm returns results only for the least inclusive taxon which is present in the database.

Database caching

By default, funguild_assign() downloads the FUNGuild database each time they are invoked. In many analysis workflows, where guilds need to be assigned only once, this is not a problem; because the databases are continuously updated, it is good to use the most current version. However, if you are going to call the functions many times, or if you plan to assign guilds in a situation where you have no internet access, you can cache the database(s) locally using the functions get_funguild_db(). This returns the database as a tibble, which can be passed as a second argument to funguild_assign().

fung <- get_funguild_db()

# This isn't necessary for a single query, but it works.
fung_guilds <- funguild_assign(sample_fungi, db = fung)

# It might be more useful in this situation
data_guilds <- lapply(many_datasets, funguild_assign, db = fung)

# Or you can save it for later offline use
saveRDS(fung, "funguild.rds")

#And then load it again
fung <- loadRDS("funguild.rds")

This strategy can also be used for reproduceable research, to store the same version of the database which was used in the original analysis.

Database queries

From the current development version, FUNGuildR also allows queries to the FUNGuild web API. The fields taxon, guid, mbNumber, trophicMode, guild, growthForm, and trait are searchable. For instance, to find all fungi annotated as causing brown rot (a kind of wood decay):

brownrotters <- funguild_query("brown rot", "trait")
nrow(brownrotters)
#> [1] 93

Here are the first few:

head(brownrotters)
taxon guid mbNumber taxonomicLevel trophicMode guild confidenceRanking growthForm trait notes citationSource
Amylocorticiellum 01898B69-3447-4EAC-B250-646F4B3D5CF8 28664 13 Saprotroph Undefined Saprotroph Probable Corticioid Brown Rot NULL Tedersoo L, et al. 2014. Science 346:e1256688 ((https://doi.org/10.1126/science.1256688))
Amylocorticium 1CB1C472-36B9-11D5-9548-00D0592D548C 17064 13 Saprotroph Undefined Saprotroph Probable NULL Brown Rot NULL Tedersoo L, et al. 2014. Science 346:e1256688 ((https://doi.org/10.1126/science.1256688))
Amylocystis 1CB1C473-36B9-11D5-9548-00D0592D548C 17065 13 Saprotroph Wood Saprotroph Highly Probable Polyporoid Brown Rot NULL Gilbertson RL, Ryvarden L. 1987-1987. North American Polypores. Fungiflora, Oslo (ISBN: 978-0945345060)
Amylosporus 1CB1C475-36B9-11D5-9548-00D0592D548C 17072 13 Saprotroph Wood Saprotroph Highly Probable Polyporoid Brown Rot NULL Gilbertson RL, Ryvarden L. 1987-1987. North American Polypores. Fungiflora, Oslo (ISBN: 978-0945345060)
Anomoporia 1CB1C482-36B9-11D5-9548-00D0592D548C 17080 13 Saprotroph Wood Saprotroph Highly Probable Corticioid Brown Rot NULL Gilbertson RL, Ryvarden L. 1987-1987. North American Polypores. Fungiflora, Oslo (ISBN: 978-0945345060)
Antrodia 1CB17DB2-36B9-11D5-9548-00D0592D548C 17083 13 Saprotroph Wood Saprotroph Highly Probable Corticioid Brown Rot NULL Gilbertson RL, Ryvarden L. 1987-1987. North American Polypores. Fungiflora, Oslo (ISBN: 978-0945345060)

The characters “%” and “*” can be used as wildcards. For instance, we can search for all fungi where the wood decay type is listed:

allrotters <- funguild_query("* rot", "trait")
nrow(allrotters)
#> [1] 656
unique(allrotters$trait)
#> [1] "White Rot"            "Soft Rot"             "Brown Rot; White Rot"
#> [4] "Brown Rot"            "Brown Rot-White Rot"

Queries can also be run against a locally cached database.

fungi <- get_funguild_database()
allrotters <- funguild_query("* rot", "trait", db = fungi)

NEMAGuild

As of April 2021, the NEMAGuild database is temporarily offline. However, FUNGuildR has functions nemaguild_assign() and get_nemaguild_db() to access it in exactly the same ways as the FUNGuild database. These functions will not work for the time being (unless you already have a cached local copy of NEMAGuild!) but they should work again when NEMAGuild is back online.

funguildr's People

Contributors

brendanf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

funguildr's Issues

Error: lexical error: invalid char in json text.

I'm really new to using R for microbiome data analysis, so sorry in advance if i am not using the language properly.

Last week I succesfully installed FUNGuildR by using this:

install.packages("remotes")
remotes::install_github("brendanf/FUNGuildR")
library(FUNGuildR)

and when using the function funguild_assign () I succesfully obtained a new table with trophicModes, guild, growthForm, ....

Today, i'm trying to analyze new data but i am not capable to obtain anything.

The error that I get when running the funguild_assign function is this:

otu_fun<- funguild_assign(otu_mat, db = get_funguild_db(), tax_col = "Taxonomy")
Error: lexical error: invalid char in json text.

                                   </body>
                 (right here) ------^

Does anybody knows what the problem is?
Thank you.

FUNGuild databased down

Hi,
I am having trouble downloading the database/running the code. I am wondering if the FUNGuild database is down at the moment and if there is an ETA for when it will be back online.
Thanks.

Troubleshooting funguild code/dataframe in R

I'm running the funguild database to my dataset in R using this code:

fung <- get_funguild_db()
data_guilds <- lapply(ITS.taxonomy1, funguild_assign, db = fung)
funguild<- funguild_assign(ITS.taxonomy1, db = funguild_testdb)

However, my output has nothing but NAs for functional guilds, etc. Any idea what's going on here? I'm almost positive it's how I've set up my data frame, but I'm not sure where I went wrong. See screenshot below.

Screenshot 2023-12-15 at 9 03 39 AM

Problem connecting to the server

Hello, I'm having some problems connecting to the server, using both funguild_assign() and get_funguild_db().
The error that appears is this:
Error in curl::curl_fetch_memory(url, handle = handle) :
Failed to connect to www.stbates.org port 80 after 2 ms: Couldn't connect to server

Is this a permanent problem or just a temporary one?

Thank you!

error when runing get_funguild_db()

Hello,
I am trying to use FUNguildR,
but I get the following error, with both the function
get_funguild_db() and funguild_assign
for example:

get_funguild_db()
Error: lexical error: invalid char in json text.

(right here) ------^

help appreciated!!
Thanks for your work!!!

Gabri

Resulting dataframe filled with <NA>

Hi,

Thank you for creating this package, I think it will be very useful! I am trying use it now but I am having an issue where the resulting table is filled with e.g.:
Taxonomy taxon guid mbNumber taxonomicLevel trophicMode guild confidenceRanking growthForm trait notes citationSource
1 Acanthobasidium delicatum
2 Acephala NA

I tried manually downloading the database to see if that helped but no luck, this is the code I ran:
guilds <- funguild_assign(taxonomy, db = fung)

Still ran into the same issue. As a sanity check I did make sure that my species are in the database and after checking a few they definitely are.

The only error message I have had is the following during package install:
Warning messages:
1: In file.copy(savedcopy, lib, recursive = TRUE) :
problem copying C:\Users\Brandon\AppData\Local\R\win-library\4.3\00LOCK\vctrs\libs\x64\vctrs.dll to C:\Users\Brandon\AppData\Local\R\win-library\4.3\vctrs\libs\x64\vctrs.dll: Permission denied
2: In file.copy(savedcopy, lib, recursive = TRUE) :
problem copying C:\Users\Brandon\AppData\Local\R\win-library\4.3\00LOCK\fansi\libs\x64\fansi.dll to C:\Users\Brandon\AppData\Local\R\win-library\4.3\fansi\libs\x64\fansi.dll: Permission denied
3: In file.copy(savedcopy, lib, recursive = TRUE) :
problem copying C:\Users\Brandon\AppData\Local\R\win-library\4.3\00LOCK\purrr\libs\x64\purrr.dll to C:\Users\Brandon\AppData\Local\R\win-library\4.3\purrr\libs\x64\purrr.dll: Permission denied
4: In file.copy(savedcopy, lib, recursive = TRUE) :
problem copying C:\Users\Brandon\AppData\Local\R\win-library\4.3\00LOCK\dplyr\libs\x64\dplyr.dll to C:\Users\Brandon\AppData\Local\R\win-library\4.3\dplyr\libs\x64\dplyr.dll: Permission denied
5: In file.copy(savedcopy, lib, recursive = TRUE) :
problem copying C:\Users\Brandon\AppData\Local\R\win-library\4.3\00LOCK\jsonlite\libs\x64\jsonlite.dll to C:\Users\Brandon\AppData\Local\R\win-library\4.3\jsonlite\libs\x64\jsonlite.dll: Permission denied
6: In file.copy(savedcopy, lib, recursive = TRUE) :
problem copying C:\Users\Brandon\AppData\Local\R\win-library\4.3\00LOCK\curl\libs\x64\curl.dll to C:\Users\Brandon\AppData\Local\R\win-library\4.3\curl\libs\x64\curl.dll: Permission denied

Thank you for any help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.