Skip to contents

Find all common names recorded for a taxa in the NCBI taxonomy. Use getTaxonomy for scientific names.

Usage

getCommon(taxa, sqlFile = "nameNode.sqlite", types = NULL)

Arguments

taxa

a vector of accession numbers

sqlFile

a string giving the path to a SQLite file containing a names tables

types

a vector of strings giving the type of names desired e.g. "common name". If NULL then all types are returned

Value

a named list of data.frames where each element corresponds to the query taxa IDs. Each data.frame contains columns name and type and each gives an available names and its name type

Examples

namesText<-"9894\t|\tGiraffa camelopardalis (Linnaeus, 1758)\t|\t\t|\tauthority\t|
9894\t|\tGiraffa camelopardalis\t|\t\t|\tscientific name\t|
9894\t|\tgiraffe\t|\t\t|\tgenbank common name\t|
9909\t|\taurochs\t|\t\t|\tgenbank common name\t|
9909\t|\tBos primigenius Bojanus, 1827\t|\t\t|\tauthority\t|
9909\t|\tBos primigenius\t|\t\t|\tscientific name\t|
9913\t|\tBos bovis\t|\t\t|\tsynonym\t|
9913\t|\tBos primigenius taurus\t|\t\t|\tsynonym\t|
9913\t|\tBos taurus Linnaeus, 1758\t|\t\t|\tauthority\t|
9913\t|\tBos taurus\t|\t\t|\tscientific name\t|
9913\t|\tBovidae sp. Adi Nefas\t|\t\t|\tincludes\t|
9913\t|\tbovine\t|\t\t|\tcommon name\t|
9913\t|\tcattle\t|\t\t|\tgenbank common name\t|
9913\t|\tcow\t|\t\t|\tcommon name\t|
9913\t|\tdairy cow\t|\t\t|\tcommon name\t|
9913\t|\tdomestic cattle\t|\t\t|\tcommon name\t|
9913\t|\tdomestic cow\t|\t\t|\tcommon name\t|
9913\t|\tox\t|\t\t|\tcommon name\t|
9913\t|\toxen\t|\t\t|\tcommon name\t|
9916\t|\tBoselaphus\t|\t\t|\tscientific name\t|"
tmpFile<-tempfile()
writeLines(namesText,tmpFile)
sqlFile<-tempfile()
read.names.sql(tmpFile,sqlFile)
getCommon(9909,sqlFile)
#> [[1]]
#>                            name                type
#> 1                       aurochs genbank common name
#> 2 Bos primigenius Bojanus, 1827           authority
#> 3               Bos primigenius     scientific name
#> 
sapply(getCommon(c(9894,9913),sqlFile),function(xx)paste(xx$name,collapse='; '))
#> [1] "Giraffa camelopardalis (Linnaeus, 1758); Giraffa camelopardalis; giraffe"                                                                                                
#> [2] "Bos bovis; Bos primigenius taurus; Bos taurus Linnaeus, 1758; Bos taurus; Bovidae sp. Adi Nefas; bovine; cattle; cow; dairy cow; domestic cattle; domestic cow; ox; oxen"
getCommon(c(9999999,9916,9894,9913),sqlFile,c("common name","genbank common name"))
#> [[1]]
#> NULL
#> 
#> [[2]]
#> NULL
#> 
#> [[3]]
#>      name                type
#> 1 giraffe genbank common name
#> 
#> [[4]]
#>              name                type
#> 1          bovine         common name
#> 2          cattle genbank common name
#> 3             cow         common name
#> 4       dairy cow         common name
#> 5 domestic cattle         common name
#> 6    domestic cow         common name
#> 7              ox         common name
#> 8            oxen         common name
#>