GithubHelp home page GithubHelp logo

rusda's Introduction

rusda

Interface to USDA databases

Description

An interface to the web service methods provided by the United States Department of Agriculture (USDA). The Agricultural Research Service (ARS) provides a large set of databases. The current version of the package holds interfaces to the Systematic Mycology and Microbiology Laboratory (SMML), which consists of four databases: Fungus-Host Distributions, Specimens, Literature and the Nomenclature database. It provides functions for querying these databases. The main function is \code{associations}, which allows searching for fungus-host combinations.

Get rusda

From CRAN

install.packages("rusda")

or from rOpenSci

install.packages("devtools")
library("devtools")

install_github("ropensci/rusda")

And load rusda

library("rusda")

Example 1

In the following case we want to search for the host of a fungus (Rosellinia ligniaria) and the fungal associations for a give host (Fagus sylvatica). From our expert knowledge we already know that these two species are associated. Let's see if the Fungus-Hosts Distributions database from the USDA confirms this hypothesis. We first specify the input species vectors. In this case they they are only one element long (they are allowed to be longer, too).

host <- c("Fagus sylvatica")
fungus <- c("Rosellinia aquila")

Then we search for the associations and look at the output. Since we are interested in "real" species names we choose the 'clean' output. We want the full possible list of associations so we choose 'synonyms=TRUE'.

fungi <- associations(host, database="both", clean=TRUE, syn_include=TRUE, spec_type="plant", process=TRUE)
hosts <- associations(fungus, database="both", clean=TRUE, syn_include=TRUE, spec_type="fungus",process=TRUE)

head(fungi$association$`Fagus sylvatica`)
head(hosts$association$`Rosellinia aquila`)
## > head(fungi$association$`Fagus sylvatica`)
## [1] "Polyporus squamosus"       "Absidia glauca"            "Acia stenodon"            
## [4] "Acrogenospora megalospora" "Actinocladium rhodosporum" "Actinonema fagicola"

## > head(hosts$association$`Rosellinia aquila`)
## [1] "Acer pseudoplatanus" "Acer rubrum"         "Acer sp."            "Alnus incana"       
## [5] "Alnus rubra"         "Asclepias sp." 

Now we want to check if our initial knowledge is correct:

is.element("Rosellinia aquila", pathogens$association[[1]])
is.element("Fagus sylvatica", hosts$association[[1]])
## > is.element("Rosellinia aquila", pathogens$association[[1]])
## [1] TRUE
## > is.element("Fagus sylvatica", hosts$association[[1]])
## [1] TRUE

We were right. Now we can be happy and search for other associations ;-).

Example 2

We want to know the mean number of associations for a group, e.g. the Polyporales. Lets create a species input vector with Linnean species names derived from GenBank. In a first step we might want to check how many species are deposited in the database.

polyporus <- c("Polyporus_admirabilis", "Polyporus_alveoaris", "Polyporus_americanus", "Polyporus_arcularius", "Polyporus_brumalis", "Polyporus_chozeniae", "Polyporus_ciliatus", "Polyporus_corylinus", "Polyporus_craterellus", "Polyporus_dictyopus", "Polyporus_favescens", "Polyporus_fraxineus", "Polyporus_gayanus", "Polyporus_grammocephalus", "Polyporus_guianensis", "Polyporus_lepideus", "Polyporus_leprieurii", "Polyporus_leptocephalus", "Polyporus_longiporus", "Polyporus_melanopus", "Polyporus_meridionalis", "Polyporus_pinsitus", "Polyporus_pseudobetulinus", "Polyporus_radicatus", "Polyporus_rhizophilus", "Polyporus_squamosus", "Polyporus_squamulosus", "Polyporus_submelanopus", "Polyporus_subvarius", "Polyporus_tenuiculus", "Polyporus_tessellatus", "Polyporus_tricholoma", "Polyporus_tuberaster", "Polyporus_tubiformis", "Polyporus_udus", "Polyporus_umbellatus", "Polyporus_varius", "Polyporus_virgatus")

poly_meta <- meta.smml(polyporus, process=TRUE, spec_type="fungus")
head(poly_meta)
## > head(poly_meta)
##                      Nomenclature Specimens Host_Fungus Literature
## Polyporus_admirabilis            1         1           1          1
## Polyporus_alveoaris              0         0           0          0
## Polyporus_americanus             0         0           0          0
## Polyporus_arcularius             1         1           1          1
## Polyporus_brumalis               1         1           1          1
## Polyporus_chozeniae              0         0           0          0

Do we need to query associations for all Polyporus species?

length(polyporus)                             # 38 all species
nrow(poly_meta[rowSums(poly_meta)>0,])        # 27 with data species

No, only 27 species are supported with data...

polyporus <- rownames(poly_meta[rowSums(poly_meta)>0,])
polyporus_ass <- associations(polyporus, database="both", clean=TRUE, syn.include=TRUE,
spec.type="fungus", process=TRUE)
mean(unlist(lapply(polyporus_ass[[2]], length)))

So within the genus Polyporus the mean number of host associations is:

## > mean(unlist(lapply(polyporus_ass[[2]], length)))
## [1] 23.25926

ropensci_footer

rusda's People

Contributors

franzkrah avatar

Watchers

James Cloos avatar Josh Herr avatar

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.