From dd49d771baa12117171d89a1b4b548c21bf3f724 Mon Sep 17 00:00:00 2001 From: Scott Chamberlain Date: Fri, 22 Sep 2017 13:42:34 -0700 Subject: [PATCH] update vignettes --- .gitignore | 1 + inst/vign/betydb.md | 56 ++-- inst/vign/traits_intro.Rmd | 75 +---- inst/vign/traits_intro.md | 491 ++++++++++----------------------- inst/vign/vigncache/__packages | 12 + vignettes/betydb.Rmd | 296 ++------------------ vignettes/traits_intro.Rmd | 491 ++++++++++----------------------- 7 files changed, 351 insertions(+), 1071 deletions(-) diff --git a/.gitignore b/.gitignore index 20ddf29..acbf9d1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .Rproj.user plantatt.pdf inst/PLANTATT_19_Nov_08/* +inst/vign/vigncache diff --git a/inst/vign/betydb.md b/inst/vign/betydb.md index d57d32a..c74fc5c 100644 --- a/inst/vign/betydb.md +++ b/inst/vign/betydb.md @@ -40,20 +40,20 @@ out %>% ``` ``` -## Source: local data frame [509 x 2] -## +## # A tibble: 449 x 2 ## id mean_result -## 1 1666 27.36 -## 2 16845 27.00 -## 3 1669 26.36 -## 4 16518 26.00 -## 5 1663 25.35 -## 6 16742 25.00 -## 7 1594 24.78 -## 8 1674 22.71 -## 9 1606 22.54 +## +## 1 1666 27.36 +## 2 16845 27.00 +## 3 1669 26.36 +## 4 16518 26.00 +## 5 1663 25.35 +## 6 16742 25.00 +## 7 1594 24.78 +## 8 1674 22.71 +## 9 1606 22.54 ## 10 1665 22.46 -## .. ... ... +## # ... with 439 more rows ``` Single trait @@ -64,18 +64,12 @@ betydb_trait(id = 10) ``` ``` -## $created_at -## NULL -## ## $description ## [1] "Leaf Percent Nitrogen" ## ## $id ## [1] 10 ## -## $label -## NULL -## ## $max ## [1] "10" ## @@ -88,12 +82,6 @@ betydb_trait(id = 10) ## $notes ## [1] "" ## -## $standard_name -## NULL -## -## $standard_units -## NULL -## ## $units ## [1] "percent" ## @@ -111,15 +99,12 @@ betydb_specie(id = 10) ``` ``` -## $AcceptedSymbol +## $acceptedsymbol ## [1] "ACKA2" ## ## $commonname ## [1] "karroothorn" ## -## $created_at -## NULL -## ## $genus ## [1] "Acacia" ## @@ -132,9 +117,6 @@ betydb_specie(id = 10) ## $scientificname ## [1] "Acacia karroo" ## -## $spcd -## NULL -## ## $species ## [1] "karroo" ## @@ -155,9 +137,6 @@ betydb_citation(10) ## $author ## [1] "Casler" ## -## $created_at -## NULL -## ## $doi ## [1] "10.2135/cropsci2003.2226" ## @@ -176,15 +155,9 @@ betydb_citation(10) ## $title ## [1] "Cultivar X environment interactions in switchgrass" ## -## $updated_at -## NULL -## ## $url ## [1] "http://crop.scijournals.org/cgi/content/abstract/43/6/2226" ## -## $user_id -## NULL -## ## $vol ## [1] 43 ## @@ -222,4 +195,7 @@ betydb_site(id = 1) ## ## $state ## [1] "" +## +## $time_zone +## [1] "Europe/Athens" ``` diff --git a/inst/vign/traits_intro.Rmd b/inst/vign/traits_intro.Rmd index d7c6e38..d568a24 100644 --- a/inst/vign/traits_intro.Rmd +++ b/inst/vign/traits_intro.Rmd @@ -27,7 +27,7 @@ Get trait data for Willow (_Salix_ spp.) ```{r} (salix <- betydb_search("Salix Vcmax")) -# equivalent: +# equivalent: # (out <- betydb_search("willow")) ``` @@ -50,7 +50,7 @@ salix %>% Get sequences by id ```{r} -ncbi_byid(ids = "360040093", format = "fasta") +ncbi_byid(ids = "360040093") ``` Get sequences searching by taxonomic name @@ -60,69 +60,35 @@ out <- ncbi_searcher(taxa = "Umbra limi", seqrange = "1:2000") head(out) ``` -## GISD invasive species data - -```{r} -sp <- c("Carpobrotus edulis", "Rosmarinus officinalis") -g_invasive(sp) -``` - -Or as simplified output - -```{r} -g_invasive(sp, simplify = TRUE) -``` - -## EOL invasive species data - -```{r} -eol_invasive_('Brassica oleracea', dataset = 'gisd') -``` - -Another example, with more species, and from - -```{r} -eol_invasive_(c('Lymantria dispar','Cygnus olor','Hydrilla verticillata','Pinus concolor'), - dataset = 'i3n') -``` - ## EOL's traitbank trait data -Searching for _Mesoplodon bidens_, page id `328566` +Searching for _Balaenoptera musculus_ (blue whale), page id `328574` -```{r cache=TRUE} -res <- traitbank(trait = 328566) -res$graph %>% - select(dwc.measurementtype..id, dwc.measurementtype.rdfs.label.en, dwc.measurementvalue) %>% - filter(!is.na(dwc.measurementvalue)) +```{r} +res <- traitbank(328574) +res$graph %>% + select(`dwc:measurementtype`) %>% + filter(!is.na(`dwc:measurementtype`)) ``` ## Coral Get the species list and their ids -```{r cache=TRUE} +```{r} coral_species() ``` Get data by taxon -```{r cache=TRUE} +```{r} coral_taxa(80) ``` Get data by trait -```{r cache=TRUE} -coral_traits(105) -``` - -## Flora Europaea - ```{r} -sp <- c("Lavandula stoechas", "Carpobrotus edulis", "Rhododendron ponticum", - "Alkanna lutea", "Anchusa arvensis") -sapply(sp, fe_native, simplify = FALSE) +coral_traits(105) ``` ## Birdlife International @@ -138,22 +104,3 @@ Threats data ```{r} birdlife_threats(22721692) ``` - -## Nativity - -```{r} -sp <- c("Lavandula stoechas", "Carpobrotus edulis", "Rhododendron ponticum", - "Alkanna lutea", "Anchusa arvensis") -``` - -Native in the continental USA? - -```{r} -sapply(sp, is_native, where = "Continental US", region = "america") -``` - -Native on Islas Baleares? - -```{r} -sapply(sp, is_native, where = "Islas_Baleares", region = "europe") -``` diff --git a/inst/vign/traits_intro.md b/inst/vign/traits_intro.md index d34a65c..26148ec 100644 --- a/inst/vign/traits_intro.md +++ b/inst/vign/traits_intro.md @@ -21,30 +21,32 @@ Get trait data for Willow (_Salix_ spp.) ```r (salix <- betydb_search("Salix Vcmax")) -#> Source: local data frame [14 x 30] -#> -#> access_level author citation_id citation_year city commonname -#> 1 4 Merilo 430 2005 Saare basket willow -#> 2 4 Merilo 430 2005 Saare basket willow -#> 3 4 Merilo 430 2005 Saare basket willow -#> 4 4 Merilo 430 2005 Saare basket willow -#> 5 4 Wullschleger 51 1993 NA willow -#> 6 4 Merilo 430 2005 Saare basket willow -#> 7 4 Merilo 430 2005 Saare basket willow -#> 8 4 Merilo 430 2005 Saare basket willow -#> 9 4 Merilo 430 2005 Saare basket willow -#> 10 4 Merilo 430 2005 Saare willow -#> 11 4 Merilo 430 2005 Saare willow -#> 12 4 Merilo 430 2005 Saare willow -#> 13 4 Merilo 430 2005 Saare willow -#> 14 4 Wang 381 2010 NA -#> Variables not shown: cultivar_id (int), date (chr), dateloc (chr), genus -#> (chr), id (int), lat (dbl), lon (dbl), mean (chr), month (dbl), n (int), -#> notes (chr), result_type (chr), scientificname (chr), site_id (int), -#> sitename (chr), species_id (int), stat (chr), statname (chr), trait -#> (chr), trait_description (chr), treatment (chr), treatment_id (int), -#> units (chr), year (dbl) -# equivalent: +#> # A tibble: 14 x 36 +#> access_level author checked citation_id citation_year city +#> * +#> 1 4 Wullschleger 1 51 1993 +#> 2 4 Wang 1 381 2010 +#> 3 4 Merilo 1 430 2005 Saare +#> 4 4 Merilo 1 430 2005 Saare +#> 5 4 Merilo 1 430 2005 Saare +#> 6 4 Merilo 1 430 2005 Saare +#> 7 4 Merilo 1 430 2005 Saare +#> 8 4 Merilo 1 430 2005 Saare +#> 9 4 Merilo 1 430 2005 Saare +#> 10 4 Merilo 1 430 2005 Saare +#> 11 4 Merilo 1 430 2005 Saare +#> 12 4 Merilo 1 430 2005 Saare +#> 13 4 Merilo 1 430 2005 Saare +#> 14 4 Merilo 1 430 2005 Saare +#> # ... with 30 more variables: commonname , cultivar , +#> # cultivar_id , date , dateloc , entity , +#> # genus , id , lat , lon , mean , +#> # method_name , month , n , notes , raw_date , +#> # result_type , scientificname , site_id , +#> # sitename , species_id , stat , statname , +#> # time , trait , trait_description , treatment , +#> # treatment_id , units , year +# equivalent: # (out <- betydb_search("willow")) ``` @@ -60,14 +62,14 @@ salix %>% min = round(min(.mean, na.rm = TRUE), 2), max = round(max(.mean, na.rm = TRUE), 2), n = length(n)) -#> Source: local data frame [4 x 6] -#> Groups: scientificname -#> -#> scientificname trait mean min max n -#> 1 Salix Vcmax 65.00 65.00 65.00 1 -#> 2 Salix dasyclados Vcmax 46.08 34.30 56.68 4 -#> 3 Salix sachalinensis × miyabeana Vcmax 79.28 79.28 79.28 1 -#> 4 Salix viminalis Vcmax 43.04 19.99 61.29 8 +#> # A tibble: 4 x 6 +#> # Groups: scientificname [?] +#> scientificname trait mean min max n +#> +#> 1 Salix Vcmax 65.00 65.00 65.00 1 +#> 2 Salix dasyclados Vcmax 46.08 34.30 56.68 4 +#> 3 Salix sachalinensis × miyabeana Vcmax 79.28 79.28 79.28 1 +#> 4 Salix viminalis Vcmax 43.04 19.99 61.29 8 ``` ## NCBI sequence data @@ -76,15 +78,15 @@ Get sequences by id ```r -ncbi_byid(ids = "360040093", format = "fasta") +ncbi_byid(ids = "360040093") #> taxon #> 1 Eristalis transversa -#> gene_desc -#> 1 Eristalis transversa voucher CNC:Diptera:102013 cytochrome oxidase subunit 1 (COI) gene, partial cds; mitochondrial +#> gene_desc +#> 1 Eristalis transversa voucher CNC:Diptera:102013 cytochrome oxidase subunit 1 (COI) gene, partial cds; mitochondrial #> gi_no acc_no length #> 1 360040093 JN991986.1 658 #> sequence -#> 1 TACTTTATATTTTGTATTTGGAACATGAGCGGGTATAGTAGGAACTTCATTAAGAATTTTAATTCGAGCTGAATTAGGTCATCCAGGTGCATTAATTGGTGATGATCAAATTTATAATGTTATTGTAACAGCTCATGCTTTTGTTATAATTTTTTTTATAGTAATACCTATTATAATTGGAGGATTTGGAAATTGATTAGTACCACTTATATTAGGAGCTCCAGATATAGCATTCCCTCGAATAAATAATATAAGTTTCTGATTATTACCTCCTTCTTTAACTCTATTATTAGTAAGAAGTATAGTAGAAAATGGGGCTGGAACAGGATGAACAGTTTATCCTCCATTATCAAGTAATATTGCACATGGAGGAGCCTCAGTTGATTTAGCAATTTTTTCACTTCACTTATCAGGAATATCATCTATTTTAGGTGCAGTAAATTTTATTACAACAGTTATTAATATACGATCAACAGGAATTACTTATGATCGTATACCTTTATTTGTTTGATCTGTTGCTATTACAGCTTTATTATTATTATTATCATTACCAGTACTAGCAGGAGCTATTACAATATTATTAACTGATCGAAATTTAAATACATCATTCTTTGATCCAGCAGGAGGAGGAGACCCTATCCTGTACCAACACTTATTC +#> 1 tactttatattttgtatttggaacatgagcgggtatagtaggaacttcattaagaattttaattcgagctgaattaggtcatccaggtgcattaattggtgatgatcaaatttataatgttattgtaacagctcatgcttttgttataattttttttatagtaatacctattataattggaggatttggaaattgattagtaccacttatattaggagctccagatatagcattccctcgaataaataatataagtttctgattattacctccttctttaactctattattagtaagaagtatagtagaaaatggggctggaacaggatgaacagtttatcctccattatcaagtaatattgcacatggaggagcctcagttgatttagcaattttttcacttcacttatcaggaatatcatctattttaggtgcagtaaattttattacaacagttattaatatacgatcaacaggaattacttatgatcgtatacctttatttgtttgatctgttgctattacagctttattattattattatcattaccagtactagcaggagctattacaatattattaactgatcgaaatttaaatacatcattctttgatccagcaggaggaggagaccctatcctgtaccaacacttattc ``` Get sequences searching by taxonomic name @@ -94,104 +96,52 @@ Get sequences searching by taxonomic name out <- ncbi_searcher(taxa = "Umbra limi", seqrange = "1:2000") head(out) #> taxon length -#> 1 Umbra limi 412 -#> 2 Umbra limi 315 -#> 3 Umbra limi 200 -#> 4 Umbra limi 333 -#> 5 Umbra limi 242 -#> 6 Umbra limi 386 -#> gene_desc -#> 1 tRNA-Glu gene, partial sequence; and cytochrome b (CYTB) gene, partial cds; mitochondrial -#> 2 16S ribosomal RNA gene, partial sequence; mitochondrial -#> 3 16S ribosomal RNA gene, partial sequence; mitochondrial -#> 4 16S ribosomal RNA gene, partial sequence; mitochondrial -#> 5 12S ribosomal RNA gene, partial sequence; mitochondrial -#> 6 12S ribosomal RNA gene, partial sequence; mitochondrial -#> acc_no gi_no -#> 1 KM523322 725542537 -#> 2 KM435059 725542420 -#> 3 KM434991 725542361 -#> 4 KM282516 725542294 -#> 5 KM282453 725542240 -#> 6 KM273864 725542182 -``` - -## GISD invasive species data - - -```r -sp <- c("Carpobrotus edulis", "Rosmarinus officinalis") -g_invasive(sp) -#> species -#> 1 Carpobrotus edulis -#> 2 Rosmarinus officinalis -#> status -#> 1 Carpobrotus edulis is a mat-forming succulent native to South Africa which is invasive primarily in coastal habitats in many parts of the world. It was often introduced as an ornamental plant or used for planting along roadsides, from which it has spread to become invasive. Its main impacts are smothering, reduced regeneration of native flora and changes to soil pH and nutrient regimes.; (succulent); Common Names: balsamo, Cape fig, figue marine, freeway iceplant, ghaukum, ghoenavy, highway ice plant, higo del Cabo, higo marino, Hottentosvy, hottentot fig, Hottentottenfeige, iceplant, ikhambi-lamabulawo, Kaapsevy, patata frita, perdevy, pigface, rankvy, sea fig, sour fig, suurvy, umgongozi, vyerank; Synonyms: Mesembryanthemum edule L., Mesembryanthemum edulis -#> 2 Not in GISD -``` - -Or as simplified output - - -```r -g_invasive(sp, simplify = TRUE) -#> species status -#> 1 Carpobrotus edulis Invasive -#> 2 Rosmarinus officinalis Not in GISD -``` - -## EOL invasive species data - - -```r -eol_invasive_('Brassica oleracea', dataset = 'gisd') -#> searched_name name eol_object_id db -#> 1 Brassica oleracea Brassica oleracea NaN gisd -``` - -Another example, with more species, and from - - -```r -eol_invasive_(c('Lymantria dispar','Cygnus olor','Hydrilla verticillata','Pinus concolor'), - dataset = 'i3n') -#> searched_name name eol_object_id -#> 1 Lymantria dispar Lymantria dispar NaN -#> 2 Cygnus olor Cygnus olor (Gmelin 1789) 913227 -#> 3 Hydrilla verticillata Hydrilla verticillata (L. f.) Royle 1088921 -#> 4 Pinus concolor Pinus concolor NaN -#> db -#> 1 i3n -#> 2 i3n -#> 3 i3n -#> 4 i3n +#> 1 Umbra limi 761 +#> 2 Umbra limi 765 +#> 3 Umbra limi 764 +#> 4 Umbra limi 743 +#> 5 Umbra limi 758 +#> 6 Umbra limi 653 +#> gene_desc +#> 1 Umbra limi voucher NXG2012264 rhodopsin (Rho) gene, partial cds +#> 2 Umbra limi voucher NXG201250 rhodopsin (Rho) gene, partial cds +#> 3 Umbra limi voucher NXG2012183 rhodopsin (Rho) gene, partial cds +#> 4 Umbra limi voucher NXG201252 rhodopsin (Rho) gene, partial cds +#> 5 Umbra limi voucher NXG2012231 rhodopsin (Rho) gene, partial cds +#> 6 Umbra limi voucher NXG201250 cytochrome oxidase subunit 1 (COI) gene, partial cds; mitochondrial +#> acc_no gi_no +#> 1 KX146134 1049488959 +#> 2 KX146015 1049488721 +#> 3 KX145969 1049488629 +#> 4 KX145777 1049488245 +#> 5 KX145759 1049488209 +#> 6 KX145415 1049487591 ``` ## EOL's traitbank trait data -Searching for _Mesoplodon bidens_, page id `328566` +Searching for _Balaenoptera musculus_ (blue whale), page id `328574` ```r -res <- traitbank(trait = 328566) -res$graph %>% - select(dwc.measurementtype..id, dwc.measurementtype.rdfs.label.en, dwc.measurementvalue) %>% - filter(!is.na(dwc.measurementvalue)) -#> Source: local data frame [59 x 3] -#> -#> dwc.measurementtype..id dwc.measurementtype.rdfs.label.en -#> 1 http://iucn.org/population_trend population trend -#> 2 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 3 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 4 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 5 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 6 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 7 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 8 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 9 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 10 http://rs.tdwg.org/dwc/terms/habitat habitat -#> .. ... ... -#> Variables not shown: dwc.measurementvalue (chr) +res <- traitbank(328574) +res$graph %>% + select(`dwc:measurementtype`) %>% + filter(!is.na(`dwc:measurementtype`)) +#> # A tibble: 181 x 1 +#> `dwc:measurementtype` +#> +#> 1 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 2 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 3 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 4 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 5 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 6 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 7 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 8 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 9 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 10 http://eol.org/schema/terms/MineralCompositionOfMilk +#> # ... with 171 more rows ``` ## Coral @@ -201,20 +151,20 @@ Get the species list and their ids ```r coral_species() -#> Source: local data frame [1,547 x 2] -#> -#> name id -#> 1 Acanthastrea brevis 3 -#> 2 Acanthastrea echinata 4 -#> 3 Acanthastrea hemprichi 6 -#> 4 Acanthastrea ishigakiensis 8 -#> 5 Acanthastrea regularis 12 -#> 6 Acanthastrea rotundoflora 13 -#> 7 Acanthastrea subechinata 14 -#> 8 Acropora abrolhosensis 16 -#> 9 Acropora abrotanoides 17 -#> 10 Acropora aculeus 18 -#> .. ... .. +#> # A tibble: 1,548 x 2 +#> name id +#> +#> 1 Acanthastrea brevis 3 +#> 2 Acanthastrea echinata 4 +#> 3 Acanthastrea hemprichi 6 +#> 4 Acanthastrea ishigakiensis 8 +#> 5 Acanthastrea regularis 12 +#> 6 Acanthastrea rotundoflora 13 +#> 7 Acanthastrea subechinata 14 +#> 8 Acropora abrolhosensis 16 +#> 9 Acropora abrotanoides 17 +#> 10 Acropora aculeus 18 +#> # ... with 1,538 more rows ``` Get data by taxon @@ -222,26 +172,26 @@ Get data by taxon ```r coral_taxa(80) -#> Source: local data frame [3,084 x 25] -#> +#> # A tibble: 3,540 x 25 #> observation_id access user_id specie_id specie_name location_id -#> 1 109330 1 2 80 Acropora hyacinthus 1 -#> 2 88793 1 14 80 Acropora hyacinthus 0 -#> 3 115791 1 10 80 Acropora hyacinthus 1 -#> 4 115792 1 10 80 Acropora hyacinthus 1 -#> 5 5694 1 2 80 Acropora hyacinthus 1 -#> 6 5696 1 2 80 Acropora hyacinthus 1 -#> 7 5741 1 1 80 Acropora hyacinthus 1 -#> 8 5751 1 1 80 Acropora hyacinthus 1 -#> 9 5787 1 1 80 Acropora hyacinthus 1 -#> 10 5766 1 1 80 Acropora hyacinthus 1 -#> .. ... ... ... ... ... ... -#> Variables not shown: location_name (chr), latitude (dbl), longitude (dbl), -#> resource_id (int), resource_secondary_id (int), measurement_id (int), -#> trait_id (int), trait_name (chr), standard_id (int), standard_unit -#> (chr), methodology_id (int), methodology_name (chr), value (chr), -#> value_type (chr), precision (lgl), precision_type (lgl), precision_upper -#> (lgl), replicates (lgl), notes (lgl) +#> +#> 1 157133 1 10 80 Acropora hyacinthus 1 +#> 2 156961 1 14 80 Acropora hyacinthus 409 +#> 3 5781 1 1 80 Acropora hyacinthus 1 +#> 4 156610 1 2 80 Acropora hyacinthus 500 +#> 5 158118 1 10 80 Acropora hyacinthus 409 +#> 6 119211 1 49 80 Acropora hyacinthus 1 +#> 7 158211 1 10 80 Acropora hyacinthus 413 +#> 8 90294 1 15 80 Acropora hyacinthus 341 +#> 9 90294 1 15 80 Acropora hyacinthus 341 +#> 10 90294 1 15 80 Acropora hyacinthus 341 +#> # ... with 3,530 more rows, and 19 more variables: location_name , +#> # latitude , longitude , resource_id , +#> # resource_secondary_id , measurement_id , trait_id , +#> # trait_name , standard_id , standard_unit , +#> # methodology_id , methodology_name , value , +#> # value_type , precision , precision_type , +#> # precision_upper , replicates , notes ``` Get data by trait @@ -249,139 +199,15 @@ Get data by trait ```r coral_traits(105) -#> Source: local data frame [1,491 x 25] -#> -#> observation_id access user_id specie_id specie_name -#> 1 155 1 8 3 Acanthastrea brevis -#> 2 236 1 1 4 Acanthastrea echinata -#> 3 364 1 8 6 Acanthastrea hemprichi -#> 4 495 1 1 8 Acanthastrea ishigakiensis -#> 5 738 1 8 12 Acanthastrea regularis -#> 6 804 1 8 13 Acanthastrea rotundoflora -#> 7 865 1 1 14 Acanthastrea subechinata -#> 8 981 1 8 16 Acropora abrolhosensis -#> 9 1061 1 8 17 Acropora abrotanoides -#> 10 90549 1 8 18 Acropora aculeus -#> .. ... ... ... ... ... -#> Variables not shown: location_id (int), location_name (chr), latitude -#> (lgl), longitude (lgl), resource_id (int), resource_secondary_id (lgl), -#> measurement_id (int), trait_id (int), trait_name (chr), standard_id -#> (int), standard_unit (chr), methodology_id (lgl), methodology_name -#> (lgl), value (chr), value_type (chr), precision (lgl), precision_type -#> (lgl), precision_upper (lgl), replicates (lgl), notes (chr) -``` - -## Flora Europaea - - -```r -sp <- c("Lavandula stoechas", "Carpobrotus edulis", "Rhododendron ponticum", - "Alkanna lutea", "Anchusa arvensis") -sapply(sp, fe_native, simplify = FALSE) -#> $`Lavandula stoechas` -#> $`Lavandula stoechas`$native -#> [1] "Islas_Baleares" "Corse" "Kriti" "France" -#> [5] "Greece" "Spain" "Italy" "Portugal" -#> [9] "Sardegna" "Sicilia" "Turkey" -#> -#> $`Lavandula stoechas`$exotic -#> [1] NA -#> -#> $`Lavandula stoechas`$status_doubtful -#> [1] NA -#> -#> $`Lavandula stoechas`$occurrence_doubtful -#> [1] NA -#> -#> $`Lavandula stoechas`$extinct -#> [1] NA -#> -#> -#> $`Carpobrotus edulis` -#> $`Carpobrotus edulis`$native -#> [1] NA -#> -#> $`Carpobrotus edulis`$exotic -#> [1] "Albania" "Azores" "Belgium" "Islas_Baleares" -#> [5] "Britain" "Corse" "France" "Greece" -#> [9] "Ireland" "Spain" "Italy" "Portugal" -#> [13] "Sicilia" -#> -#> $`Carpobrotus edulis`$status_doubtful -#> [1] NA -#> -#> $`Carpobrotus edulis`$occurrence_doubtful -#> [1] NA -#> -#> $`Carpobrotus edulis`$extinct -#> [1] NA -#> -#> -#> $`Rhododendron ponticum` -#> $`Rhododendron ponticum`$native -#> [1] "Bulgaria" "Spain" "Portugal" "Turkey" -#> -#> $`Rhododendron ponticum`$exotic -#> [1] "Belgium" "Britain" "France" "Ireland" -#> -#> $`Rhododendron ponticum`$status_doubtful -#> [1] NA -#> -#> $`Rhododendron ponticum`$occurrence_doubtful -#> [1] NA -#> -#> $`Rhododendron ponticum`$extinct -#> [1] NA -#> -#> -#> $`Alkanna lutea` -#> $`Alkanna lutea`$native -#> [1] "Islas_Baleares" "Corse" "France" "Spain" -#> [5] "Italy" "Sardegna" -#> -#> $`Alkanna lutea`$exotic -#> [1] NA -#> -#> $`Alkanna lutea`$status_doubtful -#> [1] NA -#> -#> $`Alkanna lutea`$occurrence_doubtful -#> [1] "Portugal" -#> -#> $`Alkanna lutea`$extinct -#> [1] NA -#> -#> -#> $`Anchusa arvensis` -#> $`Anchusa arvensis`$native -#> [1] "Albania" "Austria" -#> [3] "Belgium" "Islas_Baleares" -#> [5] "Britain" "Bulgaria" -#> [7] "Corse" "Czechoslovakia" -#> [9] "Denmark" "Finland" -#> [11] "France" "Germany" -#> [13] "Greece" "Switzerland" -#> [15] "Netherlands" "Spain" -#> [17] "Hungary" "Italy" -#> [19] "Jugoslavia" "Portugal" -#> [21] "Norway" "Poland" -#> [23] "Romania" "USSR" -#> [25] "USSR_Northern_Division" "USSR_Baltic_Division" -#> [27] "USSR_Central_Division" "USSR_South_western" -#> [29] "USSR_Krym" "USSRSouth_eastern_Division" -#> [31] "Sicilia" "Sweden" -#> -#> $`Anchusa arvensis`$exotic -#> [1] "Faroer" -#> -#> $`Anchusa arvensis`$status_doubtful -#> [1] "Ireland" "Sardegna" -#> -#> $`Anchusa arvensis`$occurrence_doubtful -#> [1] NA -#> -#> $`Anchusa arvensis`$extinct -#> [1] NA +#> # A tibble: 0 x 25 +#> # ... with 25 variables: observation_id , access , +#> # user_id , specie_id , specie_name , location_id , +#> # location_name , latitude , longitude , +#> # resource_id , resource_secondary_id , measurement_id , +#> # trait_id , trait_name , standard_id , +#> # standard_unit , methodology_id , methodology_name , +#> # value , value_type , precision , precision_type , +#> # precision_upper , replicates , notes ``` ## Birdlife International @@ -415,55 +241,32 @@ birdlife_threats(22721692) #> 4 22721692 Energy production & mining #> 5 22721692 Invasive and other problematic species, genes & diseases #> 6 22721692 Residential & commercial development -#> threat2 -#> 1 Annual & perennial non-timber crops / Agro-industry farming -#> 2 Annual & perennial non-timber crops / Small-holder farming -#> 3 Logging & wood harvesting / Unintentional effects: (subsistence/small scale) [harvest] -#> 4 Mining & quarrying -#> 5 Problematic native species/diseases -#> 6 Housing & urban areas -#> stresses timing scope -#> 1 Ecosystem degradation, Ecosystem conversion Ongoing Majority (50-90%) -#> 2 Ecosystem degradation, Ecosystem conversion Ongoing Majority (50-90%) -#> 3 Ecosystem degradation Ongoing Majority (50-90%) -#> 4 Ecosystem degradation, Ecosystem conversion Ongoing Majority (50-90%) -#> 5 Species mortality Ongoing Minority ( -#> 6 Ecosystem degradation, Ecosystem conversion Ongoing Minority ( -#> severity impact -#> 1 Slow, Significant Decline Medium Impact: 6 -#> 2 Slow, Significant Decline Medium Impact: 6 -#> 3 Slow, Significant Decline Medium Impact: 6 -#> 4 Slow, Significant Decline Medium Impact: 6 -#> 5 No decline Low Impact: 4 -#> 6 Slow, Significant Decline Low Impact: 5 -``` - -## Nativity - - -```r -sp <- c("Lavandula stoechas", "Carpobrotus edulis", "Rhododendron ponticum", - "Alkanna lutea", "Anchusa arvensis") -``` - -Native in the continental USA? - - -```r -sapply(sp, is_native, where = "Continental US", region = "america") -#> Lavandula stoechas Carpobrotus edulis Rhododendron ponticum -#> "Introduced" "Introduced" "species not in itis" -#> Alkanna lutea Anchusa arvensis -#> "species not in itis" "Introduced" -``` - -Native on Islas Baleares? - - -```r -sapply(sp, is_native, where = "Islas_Baleares", region = "europe") -#> Lavandula stoechas Carpobrotus edulis Rhododendron ponticum -#> "Native" "Introduced" "Not found" -#> Alkanna lutea Anchusa arvensis -#> "Native" "Native" +#> threat2 +#> 1 Annual & perennial non-timber crops +#> 2 Annual & perennial non-timber crops +#> 3 Logging & wood harvesting +#> 4 Mining & quarrying +#> 5 Problematic native species/diseases +#> 6 Housing & urban areas +#> stresses +#> 1 Ecosystem degradation, Ecosystem conversion +#> 2 Ecosystem degradation, Ecosystem conversion +#> 3 Ecosystem degradation +#> 4 Ecosystem degradation, Ecosystem conversion +#> 5 Species mortality +#> 6 Ecosystem degradation, Ecosystem conversion +#> timing +#> 1 Agriculture & aquaculture +#> 2 Agriculture & aquaculture +#> 3 Biological resource use +#> 4 Energy production & mining +#> 5 Invasive and other problematic species, genes & diseases +#> 6 Residential & commercial development +#> scope severity impact +#> 1 Annual & perennial non-timber crops Ongoing Ongoing +#> 2 Annual & perennial non-timber crops Ongoing Ongoing +#> 3 Logging & wood harvesting Ongoing Ongoing +#> 4 Mining & quarrying Ongoing Ongoing +#> 5 Problematic native species/diseases Ongoing Ongoing +#> 6 Housing & urban areas Ongoing Ongoing ``` diff --git a/inst/vign/vigncache/__packages b/inst/vign/vigncache/__packages index f0d51d6..9743abf 100644 --- a/inst/vign/vigncache/__packages +++ b/inst/vign/vigncache/__packages @@ -4,3 +4,15 @@ sacbox scimapClient dplyr traits +xml2 +rvest +httr +tibble +data.table +taxize +jsonlite +readr +hoardr +crul +testthat +bindrcpp diff --git a/vignettes/betydb.Rmd b/vignettes/betydb.Rmd index e9b9867..c74fc5c 100644 --- a/vignettes/betydb.Rmd +++ b/vignettes/betydb.Rmd @@ -8,7 +8,7 @@ [BETYdb](https://www.betydb.org/) is the _Biofuel Ecophysiological Traits and Yields Database_. You can get many different types of data from this database, including trait data. -Function setup: All functions are prefixed with `betydb_`. Plural function names like `betydb_traits()` accept parameters and always give back a data.frame, while singular function names like `betydb_trait()` accept an ID and give back a list. +Function setup: All functions are prefixed with `betydb_`. Plural function names like `betydb_traits()` accept parameters and always give back a data.frame, while singlur function names like `betydb_trait()` accept an ID and give back a list. The idea with the functions with plural names is to search for either traits, species, etc., and with the singular function names to get data by one or more IDs. @@ -40,20 +40,20 @@ out %>% ``` ``` -## Source: local data frame [509 x 2] -## +## # A tibble: 449 x 2 ## id mean_result -## 1 1666 27.36 -## 2 16845 27.00 -## 3 1669 26.36 -## 4 16518 26.00 -## 5 1663 25.35 -## 6 16742 25.00 -## 7 1594 24.78 -## 8 1674 22.71 -## 9 1606 22.54 +## +## 1 1666 27.36 +## 2 16845 27.00 +## 3 1669 26.36 +## 4 16518 26.00 +## 5 1663 25.35 +## 6 16742 25.00 +## 7 1594 24.78 +## 8 1674 22.71 +## 9 1606 22.54 ## 10 1665 22.46 -## .. ... ... +## # ... with 439 more rows ``` Single trait @@ -64,18 +64,12 @@ betydb_trait(id = 10) ``` ``` -## $created_at -## NULL -## ## $description ## [1] "Leaf Percent Nitrogen" ## ## $id ## [1] 10 ## -## $label -## NULL -## ## $max ## [1] "10" ## @@ -88,12 +82,6 @@ betydb_trait(id = 10) ## $notes ## [1] "" ## -## $standard_name -## NULL -## -## $standard_units -## NULL -## ## $units ## [1] "percent" ## @@ -111,15 +99,12 @@ betydb_specie(id = 10) ``` ``` -## $AcceptedSymbol +## $acceptedsymbol ## [1] "ACKA2" ## ## $commonname ## [1] "karroothorn" ## -## $created_at -## NULL -## ## $genus ## [1] "Acacia" ## @@ -132,9 +117,6 @@ betydb_specie(id = 10) ## $scientificname ## [1] "Acacia karroo" ## -## $spcd -## NULL -## ## $species ## [1] "karroo" ## @@ -155,9 +137,6 @@ betydb_citation(10) ## $author ## [1] "Casler" ## -## $created_at -## NULL -## ## $doi ## [1] "10.2135/cropsci2003.2226" ## @@ -176,15 +155,9 @@ betydb_citation(10) ## $title ## [1] "Cultivar X environment interactions in switchgrass" ## -## $updated_at -## NULL -## ## $url ## [1] "http://crop.scijournals.org/cgi/content/abstract/43/6/2226" ## -## $user_id -## NULL -## ## $vol ## [1] 43 ## @@ -222,242 +195,7 @@ betydb_site(id = 1) ## ## $state ## [1] "" -``` - -## Queries - -For more detailed control over your search, use `betydb_query` to specify columns from any table of the database. If you don't specify a table, the yields and tables view (AKA the `/search` endpoint) is used by default. - -```r -betydb_query(genus="Miscanthus") -``` - -``` -## # A tibble: 6 × 36 -## access_level author checked citation_id citation_year -## -## 1 4 Clifton-Brown 1 189 2002 -## 2 4 Clifton-Brown 1 189 2002 -## 3 4 Clifton-Brown 1 189 2002 -## 4 4 Clifton-Brown 1 189 2002 -## 5 4 Clifton-Brown 1 189 2002 -## 6 4 Clifton-Brown 1 189 2002 -## # ... with 31 more variables: city , commonname , -## # cultivar , cultivar_id , date , dateloc , -## # entity , genus , id , lat , lon , -## # mean , method_name , month , n , -## # notes , raw_date , result_type , -## # scientificname , site_id , sitename , -## # species_id , stat , statname , time , -## # trait , trait_description , treatment , -## # treatment_id , units , year -``` - -```r -betydb_query(genus="Miscanthus", table="species") -``` - -``` -## # A tibble: 6 × 10 -## acceptedsymbol commonname -## -## 1 -## 2 MISA Amur silvergrass -## 3 MISI Chinese silvergrass -## 4 MISCA silvergrass -## 5 MICA16 silvergrass -## 6 MIFL3 Pacific Island silvergrass -## # ... with 8 more variables: created_at , genus , -## # id , notes , scientificname , spcd , -## # species , updated_at -``` - -```r -betydb_query(table = 'variables', name = 'Vcmax', betyurl = 'https://www.betydb.org//') -``` - -``` -## # A tibble: 1 × 13 -## created_at description id label -## * -## 1 NA maximum rubisco carboxylation capacity 4 NA -## # ... with 9 more variables: max , min , name , -## # notes , standard_name , standard_units , -## # type , units , updated_at -``` - -Each query term you provide restricts the one before it. This includes zero: passing no query terms will retrieve the whole table. - -```r -betydb_query(table = 'citations') -``` - -``` -## # A tibble: 814 × 13 -## author created_at -## * -## 1 Balasko -## 2 Price -## 3 Townsend 2016-04-11T17:24:35-05:00 -## 4 Berdahl -## 5 Shiklomanov 2015-07-13T10:21:23-05:00 -## 6 Baldocchi 2016-07-12T12:36:53-05:00 -## 7 Liu, Changming 2016-07-12T12:44:22-05:00 -## 8 Clegg, Max 2016-07-12T12:49:42-05:00 -## 9 Wertin 2016-07-12T17:18:39-05:00 -## 10 Missaoui -## # ... with 804 more rows, and 11 more variables: doi , -## # id , journal , pdf , pg , title , -## # updated_at , url , user_id , vol , -## # year -``` - -```r -betydb_query(table = 'citations', author = 'Aasamaa') -``` -``` -## # A tibble: 2 × 13 -## author created_at -## * -## 1 Aasamaa 2011-07-13T14:46:00-05:00 -## 2 Aasamaa 2010-09-02T13:44:07-05:00 -## # ... with 11 more variables: doi , id , journal , -## # pdf , pg , title , updated_at , -## # url , user_id , vol , year -``` - -```r -betydb_query(table = 'citations', author = 'Aasamaa', year="2010") -``` - -``` -## # A tibble: 1 × 13 -## author created_at -## * -## 1 Aasamaa 2011-07-13T14:46:00-05:00 -## # ... with 11 more variables: doi , id , journal , -## # pdf , pg , title , updated_at , -## # url , user_id , vol , year -``` - -Passing an ID should only ever match one result. Note that this is similar, but not identical, to the single-item view from the matching singular bety_ function. For example, compare `bety_citation(id=1)` and `betydb_query(id = 1, table = 'citations')`. - -If using the new API, regular expression search works... - -```r -betydb_query(distn= "~norm", table = 'priors', api_version="beta") -``` - -``` -## # A tibble: 116 × 15 -## id citation_id variable_id phylogeny distn parama paramb -## * -## 1 40 51 4 lnorm 4.510 0.640 -## 2 287 838 568 grass lnorm 0.180 0.430 -## 3 288 840 492 Miscanthus lnorm -2.300 0.550 -## 4 10 203 22 C3 grass lnorm 1.240 0.900 -## 5 48 195 39 C4 crops norm 0.057 0.006 -## 6 69 NA 26 lnorm 1.760 0.380 -## 7 49 195 39 CAM norm 0.033 0.020 -## 8 75 NA 21 lnorm 0.210 0.600 -## 9 90 276 37 C4 grass norm 10.000 5.000 -## 10 20 277 26 lnorm 2.300 1.000 -## # ... with 106 more rows, and 8 more variables: paramc , -## # n , notes , created_at , updated_at , -## # `number of associated pfts` , view_url , -## # edit_url -``` - -...including, perversely but sometimes usefully, regular expressions treating numeric values as if they were strings! - -```r -betydb_query(parama = "~0.0", table = 'priors', api_version="beta") -``` - -``` -## # A tibble: 34 × 15 -## id citation_id variable_id phylogeny distn parama -## * -## 1 48 195 39 C4 crops norm 0.0570 -## 2 49 195 39 CAM norm 0.0330 -## 3 171 223 198 tree unif 0.0010 -## 4 238 561 46 trees unif 0.0200 -## 5 240 561 500 trees unif 0.0100 -## 6 241 561 501 trees unif 0.0100 -## 7 242 561 502 trees unif 0.0100 -## 8 243 561 503 trees unif 0.0100 -## 9 131 223 40 evergreen unif 0.0400 -## 10 146 439 195 tundra evergreen norm 0.0004 -## # ... with 24 more rows, and 9 more variables: paramb , -## # paramc , n , notes , created_at , -## # updated_at , `number of associated pfts` , -## # view_url , edit_url -``` - -## Changing which results you see - -There are three special query terms that can limit which matching rows are returned: `limit`, `offset`, and `include_unchecked`. - -### limit and offset - -These parameters apply to the beta API only. The v0 API always returns all rows that match your query. This can be slow for large result sets, so newer API versions provide control over the number of rows retrieved at a time. By default, the API will return no more than 200 results when `limit` is unset. If you're sure you want all results in one request, use `limit = "none"`. - -```r -options(betydb_api_version="beta") - -sla <- betydb_search("Maple SLA") -# Warning message: -# In betydb_GET(url, args = list(...), key = key, user = NULL, pwd = NULL, : -# The 40370-row result set exceeds the default 200 row limit. Showing the first 200 results only. Set an explicit limit to show more results. - -sla2 <- betydb_search("Maple SLA", limit=300) -sla3 <- betydb_search("Maple SLA", limit=100, offset=200) -identical(sla2$id, c(sla$id, sla3$id)) -# [1] TRUE -``` - -### include_unchecked - -By default, BETY only shows results that have been checked for quality by an administrator. However, the tables `search`, `traits`, and `yields` contain many observations that are not checked but may still be of scientific interest. To query all values, add `include_unchecked="true"` to your query, then sort or filter the unchecked values as you see fit by using the flags in the `checked` column of the result. - -```r -misc_dur_checked <- betydb_query(table="search", genus="Miscanthus", sitename="Durmersheim") -misc_dur_checked %>% group_by(year) %>% summarize(n()) -# # A tibble: 3 × 2 -# year `n()` -# -# 1 1994 4 -# 2 1995 24 -# 3 NA 2 - -misc_dur_all <- betydb_query(table="search", genus="Miscanthus", sitename="Durmersheim", include_unchecked=TRUE) -misc_dur_all %>% group_by(year, checked) %>% summarize(n()) -# Source: local data frame [6 x 3] -# Groups: year [?] -# -# year checked `n()` -# -# 1 1994 0 5 -# 2 1994 1 4 -# 3 1995 0 12 -# 4 1995 1 24 -# 5 1996 0 2 -# 6 NA 1 2 -``` - -You can also query the `checked` column directly. This is possible even without `include_unchecked`, though in that case the result is predictable: - -```r -betydb_search("Miscanthus Durmersheim", checked=0) -# NULL -betydb_search("Miscanthus Durmersheim", checked=0, include_unchecked=TRUE) -# # A tibble: 19 × 36 -# access_level author checked citation_id citation_year -# * -# 1 4 Lewandowski 0 158 1997 -# 2 4 Lewandowski 0 158 1997 -# 3 4 Lewandowski 0 158 1997 -# 4 4 Lewandowski 0 158 1997 -# 5 4 Lewandowski 0 158 1997 -# ... +## +## $time_zone +## [1] "Europe/Athens" ``` diff --git a/vignettes/traits_intro.Rmd b/vignettes/traits_intro.Rmd index d34a65c..26148ec 100644 --- a/vignettes/traits_intro.Rmd +++ b/vignettes/traits_intro.Rmd @@ -21,30 +21,32 @@ Get trait data for Willow (_Salix_ spp.) ```r (salix <- betydb_search("Salix Vcmax")) -#> Source: local data frame [14 x 30] -#> -#> access_level author citation_id citation_year city commonname -#> 1 4 Merilo 430 2005 Saare basket willow -#> 2 4 Merilo 430 2005 Saare basket willow -#> 3 4 Merilo 430 2005 Saare basket willow -#> 4 4 Merilo 430 2005 Saare basket willow -#> 5 4 Wullschleger 51 1993 NA willow -#> 6 4 Merilo 430 2005 Saare basket willow -#> 7 4 Merilo 430 2005 Saare basket willow -#> 8 4 Merilo 430 2005 Saare basket willow -#> 9 4 Merilo 430 2005 Saare basket willow -#> 10 4 Merilo 430 2005 Saare willow -#> 11 4 Merilo 430 2005 Saare willow -#> 12 4 Merilo 430 2005 Saare willow -#> 13 4 Merilo 430 2005 Saare willow -#> 14 4 Wang 381 2010 NA -#> Variables not shown: cultivar_id (int), date (chr), dateloc (chr), genus -#> (chr), id (int), lat (dbl), lon (dbl), mean (chr), month (dbl), n (int), -#> notes (chr), result_type (chr), scientificname (chr), site_id (int), -#> sitename (chr), species_id (int), stat (chr), statname (chr), trait -#> (chr), trait_description (chr), treatment (chr), treatment_id (int), -#> units (chr), year (dbl) -# equivalent: +#> # A tibble: 14 x 36 +#> access_level author checked citation_id citation_year city +#> * +#> 1 4 Wullschleger 1 51 1993 +#> 2 4 Wang 1 381 2010 +#> 3 4 Merilo 1 430 2005 Saare +#> 4 4 Merilo 1 430 2005 Saare +#> 5 4 Merilo 1 430 2005 Saare +#> 6 4 Merilo 1 430 2005 Saare +#> 7 4 Merilo 1 430 2005 Saare +#> 8 4 Merilo 1 430 2005 Saare +#> 9 4 Merilo 1 430 2005 Saare +#> 10 4 Merilo 1 430 2005 Saare +#> 11 4 Merilo 1 430 2005 Saare +#> 12 4 Merilo 1 430 2005 Saare +#> 13 4 Merilo 1 430 2005 Saare +#> 14 4 Merilo 1 430 2005 Saare +#> # ... with 30 more variables: commonname , cultivar , +#> # cultivar_id , date , dateloc , entity , +#> # genus , id , lat , lon , mean , +#> # method_name , month , n , notes , raw_date , +#> # result_type , scientificname , site_id , +#> # sitename , species_id , stat , statname , +#> # time , trait , trait_description , treatment , +#> # treatment_id , units , year +# equivalent: # (out <- betydb_search("willow")) ``` @@ -60,14 +62,14 @@ salix %>% min = round(min(.mean, na.rm = TRUE), 2), max = round(max(.mean, na.rm = TRUE), 2), n = length(n)) -#> Source: local data frame [4 x 6] -#> Groups: scientificname -#> -#> scientificname trait mean min max n -#> 1 Salix Vcmax 65.00 65.00 65.00 1 -#> 2 Salix dasyclados Vcmax 46.08 34.30 56.68 4 -#> 3 Salix sachalinensis × miyabeana Vcmax 79.28 79.28 79.28 1 -#> 4 Salix viminalis Vcmax 43.04 19.99 61.29 8 +#> # A tibble: 4 x 6 +#> # Groups: scientificname [?] +#> scientificname trait mean min max n +#> +#> 1 Salix Vcmax 65.00 65.00 65.00 1 +#> 2 Salix dasyclados Vcmax 46.08 34.30 56.68 4 +#> 3 Salix sachalinensis × miyabeana Vcmax 79.28 79.28 79.28 1 +#> 4 Salix viminalis Vcmax 43.04 19.99 61.29 8 ``` ## NCBI sequence data @@ -76,15 +78,15 @@ Get sequences by id ```r -ncbi_byid(ids = "360040093", format = "fasta") +ncbi_byid(ids = "360040093") #> taxon #> 1 Eristalis transversa -#> gene_desc -#> 1 Eristalis transversa voucher CNC:Diptera:102013 cytochrome oxidase subunit 1 (COI) gene, partial cds; mitochondrial +#> gene_desc +#> 1 Eristalis transversa voucher CNC:Diptera:102013 cytochrome oxidase subunit 1 (COI) gene, partial cds; mitochondrial #> gi_no acc_no length #> 1 360040093 JN991986.1 658 #> sequence -#> 1 TACTTTATATTTTGTATTTGGAACATGAGCGGGTATAGTAGGAACTTCATTAAGAATTTTAATTCGAGCTGAATTAGGTCATCCAGGTGCATTAATTGGTGATGATCAAATTTATAATGTTATTGTAACAGCTCATGCTTTTGTTATAATTTTTTTTATAGTAATACCTATTATAATTGGAGGATTTGGAAATTGATTAGTACCACTTATATTAGGAGCTCCAGATATAGCATTCCCTCGAATAAATAATATAAGTTTCTGATTATTACCTCCTTCTTTAACTCTATTATTAGTAAGAAGTATAGTAGAAAATGGGGCTGGAACAGGATGAACAGTTTATCCTCCATTATCAAGTAATATTGCACATGGAGGAGCCTCAGTTGATTTAGCAATTTTTTCACTTCACTTATCAGGAATATCATCTATTTTAGGTGCAGTAAATTTTATTACAACAGTTATTAATATACGATCAACAGGAATTACTTATGATCGTATACCTTTATTTGTTTGATCTGTTGCTATTACAGCTTTATTATTATTATTATCATTACCAGTACTAGCAGGAGCTATTACAATATTATTAACTGATCGAAATTTAAATACATCATTCTTTGATCCAGCAGGAGGAGGAGACCCTATCCTGTACCAACACTTATTC +#> 1 tactttatattttgtatttggaacatgagcgggtatagtaggaacttcattaagaattttaattcgagctgaattaggtcatccaggtgcattaattggtgatgatcaaatttataatgttattgtaacagctcatgcttttgttataattttttttatagtaatacctattataattggaggatttggaaattgattagtaccacttatattaggagctccagatatagcattccctcgaataaataatataagtttctgattattacctccttctttaactctattattagtaagaagtatagtagaaaatggggctggaacaggatgaacagtttatcctccattatcaagtaatattgcacatggaggagcctcagttgatttagcaattttttcacttcacttatcaggaatatcatctattttaggtgcagtaaattttattacaacagttattaatatacgatcaacaggaattacttatgatcgtatacctttatttgtttgatctgttgctattacagctttattattattattatcattaccagtactagcaggagctattacaatattattaactgatcgaaatttaaatacatcattctttgatccagcaggaggaggagaccctatcctgtaccaacacttattc ``` Get sequences searching by taxonomic name @@ -94,104 +96,52 @@ Get sequences searching by taxonomic name out <- ncbi_searcher(taxa = "Umbra limi", seqrange = "1:2000") head(out) #> taxon length -#> 1 Umbra limi 412 -#> 2 Umbra limi 315 -#> 3 Umbra limi 200 -#> 4 Umbra limi 333 -#> 5 Umbra limi 242 -#> 6 Umbra limi 386 -#> gene_desc -#> 1 tRNA-Glu gene, partial sequence; and cytochrome b (CYTB) gene, partial cds; mitochondrial -#> 2 16S ribosomal RNA gene, partial sequence; mitochondrial -#> 3 16S ribosomal RNA gene, partial sequence; mitochondrial -#> 4 16S ribosomal RNA gene, partial sequence; mitochondrial -#> 5 12S ribosomal RNA gene, partial sequence; mitochondrial -#> 6 12S ribosomal RNA gene, partial sequence; mitochondrial -#> acc_no gi_no -#> 1 KM523322 725542537 -#> 2 KM435059 725542420 -#> 3 KM434991 725542361 -#> 4 KM282516 725542294 -#> 5 KM282453 725542240 -#> 6 KM273864 725542182 -``` - -## GISD invasive species data - - -```r -sp <- c("Carpobrotus edulis", "Rosmarinus officinalis") -g_invasive(sp) -#> species -#> 1 Carpobrotus edulis -#> 2 Rosmarinus officinalis -#> status -#> 1 Carpobrotus edulis is a mat-forming succulent native to South Africa which is invasive primarily in coastal habitats in many parts of the world. It was often introduced as an ornamental plant or used for planting along roadsides, from which it has spread to become invasive. Its main impacts are smothering, reduced regeneration of native flora and changes to soil pH and nutrient regimes.; (succulent); Common Names: balsamo, Cape fig, figue marine, freeway iceplant, ghaukum, ghoenavy, highway ice plant, higo del Cabo, higo marino, Hottentosvy, hottentot fig, Hottentottenfeige, iceplant, ikhambi-lamabulawo, Kaapsevy, patata frita, perdevy, pigface, rankvy, sea fig, sour fig, suurvy, umgongozi, vyerank; Synonyms: Mesembryanthemum edule L., Mesembryanthemum edulis -#> 2 Not in GISD -``` - -Or as simplified output - - -```r -g_invasive(sp, simplify = TRUE) -#> species status -#> 1 Carpobrotus edulis Invasive -#> 2 Rosmarinus officinalis Not in GISD -``` - -## EOL invasive species data - - -```r -eol_invasive_('Brassica oleracea', dataset = 'gisd') -#> searched_name name eol_object_id db -#> 1 Brassica oleracea Brassica oleracea NaN gisd -``` - -Another example, with more species, and from - - -```r -eol_invasive_(c('Lymantria dispar','Cygnus olor','Hydrilla verticillata','Pinus concolor'), - dataset = 'i3n') -#> searched_name name eol_object_id -#> 1 Lymantria dispar Lymantria dispar NaN -#> 2 Cygnus olor Cygnus olor (Gmelin 1789) 913227 -#> 3 Hydrilla verticillata Hydrilla verticillata (L. f.) Royle 1088921 -#> 4 Pinus concolor Pinus concolor NaN -#> db -#> 1 i3n -#> 2 i3n -#> 3 i3n -#> 4 i3n +#> 1 Umbra limi 761 +#> 2 Umbra limi 765 +#> 3 Umbra limi 764 +#> 4 Umbra limi 743 +#> 5 Umbra limi 758 +#> 6 Umbra limi 653 +#> gene_desc +#> 1 Umbra limi voucher NXG2012264 rhodopsin (Rho) gene, partial cds +#> 2 Umbra limi voucher NXG201250 rhodopsin (Rho) gene, partial cds +#> 3 Umbra limi voucher NXG2012183 rhodopsin (Rho) gene, partial cds +#> 4 Umbra limi voucher NXG201252 rhodopsin (Rho) gene, partial cds +#> 5 Umbra limi voucher NXG2012231 rhodopsin (Rho) gene, partial cds +#> 6 Umbra limi voucher NXG201250 cytochrome oxidase subunit 1 (COI) gene, partial cds; mitochondrial +#> acc_no gi_no +#> 1 KX146134 1049488959 +#> 2 KX146015 1049488721 +#> 3 KX145969 1049488629 +#> 4 KX145777 1049488245 +#> 5 KX145759 1049488209 +#> 6 KX145415 1049487591 ``` ## EOL's traitbank trait data -Searching for _Mesoplodon bidens_, page id `328566` +Searching for _Balaenoptera musculus_ (blue whale), page id `328574` ```r -res <- traitbank(trait = 328566) -res$graph %>% - select(dwc.measurementtype..id, dwc.measurementtype.rdfs.label.en, dwc.measurementvalue) %>% - filter(!is.na(dwc.measurementvalue)) -#> Source: local data frame [59 x 3] -#> -#> dwc.measurementtype..id dwc.measurementtype.rdfs.label.en -#> 1 http://iucn.org/population_trend population trend -#> 2 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 3 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 4 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 5 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 6 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 7 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 8 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 9 http://rs.tdwg.org/dwc/terms/habitat habitat -#> 10 http://rs.tdwg.org/dwc/terms/habitat habitat -#> .. ... ... -#> Variables not shown: dwc.measurementvalue (chr) +res <- traitbank(328574) +res$graph %>% + select(`dwc:measurementtype`) %>% + filter(!is.na(`dwc:measurementtype`)) +#> # A tibble: 181 x 1 +#> `dwc:measurementtype` +#> +#> 1 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 2 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 3 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 4 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 5 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 6 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 7 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 8 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 9 http://eol.org/schema/terms/MineralCompositionOfMilk +#> 10 http://eol.org/schema/terms/MineralCompositionOfMilk +#> # ... with 171 more rows ``` ## Coral @@ -201,20 +151,20 @@ Get the species list and their ids ```r coral_species() -#> Source: local data frame [1,547 x 2] -#> -#> name id -#> 1 Acanthastrea brevis 3 -#> 2 Acanthastrea echinata 4 -#> 3 Acanthastrea hemprichi 6 -#> 4 Acanthastrea ishigakiensis 8 -#> 5 Acanthastrea regularis 12 -#> 6 Acanthastrea rotundoflora 13 -#> 7 Acanthastrea subechinata 14 -#> 8 Acropora abrolhosensis 16 -#> 9 Acropora abrotanoides 17 -#> 10 Acropora aculeus 18 -#> .. ... .. +#> # A tibble: 1,548 x 2 +#> name id +#> +#> 1 Acanthastrea brevis 3 +#> 2 Acanthastrea echinata 4 +#> 3 Acanthastrea hemprichi 6 +#> 4 Acanthastrea ishigakiensis 8 +#> 5 Acanthastrea regularis 12 +#> 6 Acanthastrea rotundoflora 13 +#> 7 Acanthastrea subechinata 14 +#> 8 Acropora abrolhosensis 16 +#> 9 Acropora abrotanoides 17 +#> 10 Acropora aculeus 18 +#> # ... with 1,538 more rows ``` Get data by taxon @@ -222,26 +172,26 @@ Get data by taxon ```r coral_taxa(80) -#> Source: local data frame [3,084 x 25] -#> +#> # A tibble: 3,540 x 25 #> observation_id access user_id specie_id specie_name location_id -#> 1 109330 1 2 80 Acropora hyacinthus 1 -#> 2 88793 1 14 80 Acropora hyacinthus 0 -#> 3 115791 1 10 80 Acropora hyacinthus 1 -#> 4 115792 1 10 80 Acropora hyacinthus 1 -#> 5 5694 1 2 80 Acropora hyacinthus 1 -#> 6 5696 1 2 80 Acropora hyacinthus 1 -#> 7 5741 1 1 80 Acropora hyacinthus 1 -#> 8 5751 1 1 80 Acropora hyacinthus 1 -#> 9 5787 1 1 80 Acropora hyacinthus 1 -#> 10 5766 1 1 80 Acropora hyacinthus 1 -#> .. ... ... ... ... ... ... -#> Variables not shown: location_name (chr), latitude (dbl), longitude (dbl), -#> resource_id (int), resource_secondary_id (int), measurement_id (int), -#> trait_id (int), trait_name (chr), standard_id (int), standard_unit -#> (chr), methodology_id (int), methodology_name (chr), value (chr), -#> value_type (chr), precision (lgl), precision_type (lgl), precision_upper -#> (lgl), replicates (lgl), notes (lgl) +#> +#> 1 157133 1 10 80 Acropora hyacinthus 1 +#> 2 156961 1 14 80 Acropora hyacinthus 409 +#> 3 5781 1 1 80 Acropora hyacinthus 1 +#> 4 156610 1 2 80 Acropora hyacinthus 500 +#> 5 158118 1 10 80 Acropora hyacinthus 409 +#> 6 119211 1 49 80 Acropora hyacinthus 1 +#> 7 158211 1 10 80 Acropora hyacinthus 413 +#> 8 90294 1 15 80 Acropora hyacinthus 341 +#> 9 90294 1 15 80 Acropora hyacinthus 341 +#> 10 90294 1 15 80 Acropora hyacinthus 341 +#> # ... with 3,530 more rows, and 19 more variables: location_name , +#> # latitude , longitude , resource_id , +#> # resource_secondary_id , measurement_id , trait_id , +#> # trait_name , standard_id , standard_unit , +#> # methodology_id , methodology_name , value , +#> # value_type , precision , precision_type , +#> # precision_upper , replicates , notes ``` Get data by trait @@ -249,139 +199,15 @@ Get data by trait ```r coral_traits(105) -#> Source: local data frame [1,491 x 25] -#> -#> observation_id access user_id specie_id specie_name -#> 1 155 1 8 3 Acanthastrea brevis -#> 2 236 1 1 4 Acanthastrea echinata -#> 3 364 1 8 6 Acanthastrea hemprichi -#> 4 495 1 1 8 Acanthastrea ishigakiensis -#> 5 738 1 8 12 Acanthastrea regularis -#> 6 804 1 8 13 Acanthastrea rotundoflora -#> 7 865 1 1 14 Acanthastrea subechinata -#> 8 981 1 8 16 Acropora abrolhosensis -#> 9 1061 1 8 17 Acropora abrotanoides -#> 10 90549 1 8 18 Acropora aculeus -#> .. ... ... ... ... ... -#> Variables not shown: location_id (int), location_name (chr), latitude -#> (lgl), longitude (lgl), resource_id (int), resource_secondary_id (lgl), -#> measurement_id (int), trait_id (int), trait_name (chr), standard_id -#> (int), standard_unit (chr), methodology_id (lgl), methodology_name -#> (lgl), value (chr), value_type (chr), precision (lgl), precision_type -#> (lgl), precision_upper (lgl), replicates (lgl), notes (chr) -``` - -## Flora Europaea - - -```r -sp <- c("Lavandula stoechas", "Carpobrotus edulis", "Rhododendron ponticum", - "Alkanna lutea", "Anchusa arvensis") -sapply(sp, fe_native, simplify = FALSE) -#> $`Lavandula stoechas` -#> $`Lavandula stoechas`$native -#> [1] "Islas_Baleares" "Corse" "Kriti" "France" -#> [5] "Greece" "Spain" "Italy" "Portugal" -#> [9] "Sardegna" "Sicilia" "Turkey" -#> -#> $`Lavandula stoechas`$exotic -#> [1] NA -#> -#> $`Lavandula stoechas`$status_doubtful -#> [1] NA -#> -#> $`Lavandula stoechas`$occurrence_doubtful -#> [1] NA -#> -#> $`Lavandula stoechas`$extinct -#> [1] NA -#> -#> -#> $`Carpobrotus edulis` -#> $`Carpobrotus edulis`$native -#> [1] NA -#> -#> $`Carpobrotus edulis`$exotic -#> [1] "Albania" "Azores" "Belgium" "Islas_Baleares" -#> [5] "Britain" "Corse" "France" "Greece" -#> [9] "Ireland" "Spain" "Italy" "Portugal" -#> [13] "Sicilia" -#> -#> $`Carpobrotus edulis`$status_doubtful -#> [1] NA -#> -#> $`Carpobrotus edulis`$occurrence_doubtful -#> [1] NA -#> -#> $`Carpobrotus edulis`$extinct -#> [1] NA -#> -#> -#> $`Rhododendron ponticum` -#> $`Rhododendron ponticum`$native -#> [1] "Bulgaria" "Spain" "Portugal" "Turkey" -#> -#> $`Rhododendron ponticum`$exotic -#> [1] "Belgium" "Britain" "France" "Ireland" -#> -#> $`Rhododendron ponticum`$status_doubtful -#> [1] NA -#> -#> $`Rhododendron ponticum`$occurrence_doubtful -#> [1] NA -#> -#> $`Rhododendron ponticum`$extinct -#> [1] NA -#> -#> -#> $`Alkanna lutea` -#> $`Alkanna lutea`$native -#> [1] "Islas_Baleares" "Corse" "France" "Spain" -#> [5] "Italy" "Sardegna" -#> -#> $`Alkanna lutea`$exotic -#> [1] NA -#> -#> $`Alkanna lutea`$status_doubtful -#> [1] NA -#> -#> $`Alkanna lutea`$occurrence_doubtful -#> [1] "Portugal" -#> -#> $`Alkanna lutea`$extinct -#> [1] NA -#> -#> -#> $`Anchusa arvensis` -#> $`Anchusa arvensis`$native -#> [1] "Albania" "Austria" -#> [3] "Belgium" "Islas_Baleares" -#> [5] "Britain" "Bulgaria" -#> [7] "Corse" "Czechoslovakia" -#> [9] "Denmark" "Finland" -#> [11] "France" "Germany" -#> [13] "Greece" "Switzerland" -#> [15] "Netherlands" "Spain" -#> [17] "Hungary" "Italy" -#> [19] "Jugoslavia" "Portugal" -#> [21] "Norway" "Poland" -#> [23] "Romania" "USSR" -#> [25] "USSR_Northern_Division" "USSR_Baltic_Division" -#> [27] "USSR_Central_Division" "USSR_South_western" -#> [29] "USSR_Krym" "USSRSouth_eastern_Division" -#> [31] "Sicilia" "Sweden" -#> -#> $`Anchusa arvensis`$exotic -#> [1] "Faroer" -#> -#> $`Anchusa arvensis`$status_doubtful -#> [1] "Ireland" "Sardegna" -#> -#> $`Anchusa arvensis`$occurrence_doubtful -#> [1] NA -#> -#> $`Anchusa arvensis`$extinct -#> [1] NA +#> # A tibble: 0 x 25 +#> # ... with 25 variables: observation_id , access , +#> # user_id , specie_id , specie_name , location_id , +#> # location_name , latitude , longitude , +#> # resource_id , resource_secondary_id , measurement_id , +#> # trait_id , trait_name , standard_id , +#> # standard_unit , methodology_id , methodology_name , +#> # value , value_type , precision , precision_type , +#> # precision_upper , replicates , notes ``` ## Birdlife International @@ -415,55 +241,32 @@ birdlife_threats(22721692) #> 4 22721692 Energy production & mining #> 5 22721692 Invasive and other problematic species, genes & diseases #> 6 22721692 Residential & commercial development -#> threat2 -#> 1 Annual & perennial non-timber crops / Agro-industry farming -#> 2 Annual & perennial non-timber crops / Small-holder farming -#> 3 Logging & wood harvesting / Unintentional effects: (subsistence/small scale) [harvest] -#> 4 Mining & quarrying -#> 5 Problematic native species/diseases -#> 6 Housing & urban areas -#> stresses timing scope -#> 1 Ecosystem degradation, Ecosystem conversion Ongoing Majority (50-90%) -#> 2 Ecosystem degradation, Ecosystem conversion Ongoing Majority (50-90%) -#> 3 Ecosystem degradation Ongoing Majority (50-90%) -#> 4 Ecosystem degradation, Ecosystem conversion Ongoing Majority (50-90%) -#> 5 Species mortality Ongoing Minority ( -#> 6 Ecosystem degradation, Ecosystem conversion Ongoing Minority ( -#> severity impact -#> 1 Slow, Significant Decline Medium Impact: 6 -#> 2 Slow, Significant Decline Medium Impact: 6 -#> 3 Slow, Significant Decline Medium Impact: 6 -#> 4 Slow, Significant Decline Medium Impact: 6 -#> 5 No decline Low Impact: 4 -#> 6 Slow, Significant Decline Low Impact: 5 -``` - -## Nativity - - -```r -sp <- c("Lavandula stoechas", "Carpobrotus edulis", "Rhododendron ponticum", - "Alkanna lutea", "Anchusa arvensis") -``` - -Native in the continental USA? - - -```r -sapply(sp, is_native, where = "Continental US", region = "america") -#> Lavandula stoechas Carpobrotus edulis Rhododendron ponticum -#> "Introduced" "Introduced" "species not in itis" -#> Alkanna lutea Anchusa arvensis -#> "species not in itis" "Introduced" -``` - -Native on Islas Baleares? - - -```r -sapply(sp, is_native, where = "Islas_Baleares", region = "europe") -#> Lavandula stoechas Carpobrotus edulis Rhododendron ponticum -#> "Native" "Introduced" "Not found" -#> Alkanna lutea Anchusa arvensis -#> "Native" "Native" +#> threat2 +#> 1 Annual & perennial non-timber crops +#> 2 Annual & perennial non-timber crops +#> 3 Logging & wood harvesting +#> 4 Mining & quarrying +#> 5 Problematic native species/diseases +#> 6 Housing & urban areas +#> stresses +#> 1 Ecosystem degradation, Ecosystem conversion +#> 2 Ecosystem degradation, Ecosystem conversion +#> 3 Ecosystem degradation +#> 4 Ecosystem degradation, Ecosystem conversion +#> 5 Species mortality +#> 6 Ecosystem degradation, Ecosystem conversion +#> timing +#> 1 Agriculture & aquaculture +#> 2 Agriculture & aquaculture +#> 3 Biological resource use +#> 4 Energy production & mining +#> 5 Invasive and other problematic species, genes & diseases +#> 6 Residential & commercial development +#> scope severity impact +#> 1 Annual & perennial non-timber crops Ongoing Ongoing +#> 2 Annual & perennial non-timber crops Ongoing Ongoing +#> 3 Logging & wood harvesting Ongoing Ongoing +#> 4 Mining & quarrying Ongoing Ongoing +#> 5 Problematic native species/diseases Ongoing Ongoing +#> 6 Housing & urban areas Ongoing Ongoing ```