Skip to contents

Return taxonomic IDs for a vector of sequence IDs or all sequences in a cluster. User can specify what rank the IDs should be returned. If NULL, the lowest level is returned.

Usage

get_txids(
  phylota,
  cid = NULL,
  sid = NULL,
  txids = NULL,
  rnk = NULL,
  keep_higher = FALSE
)

Arguments

phylota

Phylota object

cid

Cluster ID

sid

Sequence ID(s)

txids

Vector of txids

rnk

Taxonomic rank

keep_higher

Keep higher taxonomic IDs?

Value

vector

Details

txids can either be provided by user or they can be determined for a vector of sids or for a cid. If keep_higher is TRUE, any sequence that has a identity that is higher than the given rank will be returned. If FALSE, these sequences will return ''.

Examples

data('bromeliads')
# get all the genus IDs and names
genus_ids <- get_txids(phylota = bromeliads, txids = bromeliads@txids,
                       rnk = 'genus')
genus_ids <- unique(genus_ids)
# drop empty IDs -- this happens if a given lineage has no ID for specified rank
genus_ids <- genus_ids[genus_ids != '']
# get names
(get_tx_slot(phylota = bromeliads, txid = genus_ids, slt_nm = 'scnm'))
#>              100680             2184933             2184932             2184931 
#>      "Cottendorfia"         "Sincoraea"       "Rokautskyia"  "Hoplocryptanthus" 
#>             1387303             1349361              796805              713961 
#>         "Lapanthus"      "Canistropsis"      "Disteganthus"         "Eduandrea" 
#>              326799              326795              326788              213064 
#>            "Portea"   "Hohenbergiopsis"          "Fernseea"          "Edmundoa" 
#>              106462              106458              106452              106447 
#>         "Ochagavia"      "Neoglaziovia"           "Greigia"      "Fascicularia" 
#>              106440              106438              106430              106424 
#>      "Deinacanthon"        "Chevaliera"        "Androlepis"    "Acanthostachys" 
#>               49536               49531               49529               49522 
#>        "Wittrockia"        "Ronnbergia"         "Quesnelia"       "Orthophytum" 
#>               49520               49512               49496               49493 
#>        "Nidularium"           "Lymania"       "Cryptanthus"         "Canistrum" 
#>               49491               49476               15119               15114 
#>       "Hohenbergia"       "Araeococcus"        "Billbergia"           "Aechmea" 
#>                4616                4614               15164               49487 
#>          "Bromelia"            "Ananas"              "Puya"        "Fosterella" 
#>               49526               49485               49483              100682 
#>        "Pitcairnia"       "Encholirium"            "Dyckia"     "Deuterocohnia" 
#>               49516              222987               15141              261216 
#>             "Navia"         "Brewcaria"           "Hechtia"         "Lindmania" 
#>              106432               49479              106428              213045 
#>           "Ayensua"        "Brocchinia"        "Alcantarea"          "Werauhia" 
#>             1908698               49518               49534             1908703 
#>           "Goudaea"        "Neoregelia"           "Vriesea"          "Lutheria" 
#>               49514             1908700             2002971             1908705 
#>      "Mezobromelia"         "Jagrantia"         "Waltillia"       "Stigmatodon" 
#>             1908701             1908706               15170              106471 
#>         "Josemania"           "Zizkaea"        "Tillandsia"          "Racinaea" 
#>             1908553             1908702             1908697             1908704 
#>          "Wallisia"        "Lemeltonia"         "Barfussia"   "Pseudalcantarea" 
#>               49489             1908699               15123               15137 
#>          "Guzmania"       "Gregbrownia"          "Catopsis" "Glomeropitcairnia"