R语言【taxa】——从taxa 定义的类中获取组分信息

Package taxa version 0.4.2


tax_auth(x)

在拥有对应信息的对象中设置和获取类群所有权信息。

复制代码
> x <- taxon(name = c('Homo sapiens', 'Bacillus', 'Ascomycota', 'Ericaceae'),
+            rank = c('species', 'genus', 'phylum', 'family'),
+            id = taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi'),
+            auth = c('Linnaeus, 1758', 'Cohn 1872', NA, 'Juss., 1789'))

> tax_auth(x)
<taxon_authority[4]>
[1] Linnaeus 1758 Cohn 1872     NA            Juss. 1789   

> tax_auth(x) <- tolower(tax_auth(x))
> tax_auth(x)[1] <- 'Billy'
> x
<taxon[4]>
[1] 9606|Homo sapiens Billy |species 1386|Bacillus cohn 1872|genus   
[3] 4890|Ascomycota na  |phylum      4345|Ericaceae juss. 1789|family
Rank levels: phylum < family < genus < species

tax_author(x)

设置和获取分类群的作者信息。

复制代码
> x <- taxon_authority(c('Cham. & Schldl.', 'L.'),
+                      date = c('1827', '1753'))

> tax_author(x)
[1] "Cham. & Schldl." "L."     
        
> tax_author(x)[1] <- "Billy"
> tax_author(x) <- tolower(tax_author(x))
> tax_author(x)
[1] "billy" "l." 

tax_cite(x)

设置和获取分类群的引用信息。

复制代码
> x <- taxon_authority(c('Cham. & Schldl.', 'L.'),
+                      date = c('1827', '1753'),
+                      citation = c(NA, 'Species Plantarum'))

> tax_cite(x)
[1] NA                  "Species Plantarum"

> tax_cite(x)[1] <- "Cham. et al 1984"
> tax_cite(x)
[1] "Cham. et al 1984"  "Species Plantarum"

tax_date(x)

设置和获取分类群的日期信息。

复制代码
> x <- taxon_authority(c('Cham. & Schldl.', 'L.'),
+                      date = c('1827', '1753'))

> tax_date(x)
[1] "1827" "1753"

> tax_date(x)[1] <- "1984"
> tax_date(x) <- c(NA, '1800')
> tax_date(x)
[1] NA     "1800"

tax_db(x)

设置和获取分类群的数据库信息。

复制代码
> x <- taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi')

> tax_db(x)
<taxon_db[4]>
[1] ncbi ncbi ncbi ncbi

> tax_db(x) <- 'nbn'
> tax_db(x)[2] <- 'itis'
> tax_db(x)
<taxon_db[4]>
[1]  nbn itis  nbn  nbn

tax_id(x)

设置和获取类群的ID。

复制代码
> x <- taxon(name = c('Homo sapiens', 'Bacillus', 'Ascomycota', 'Ericaceae'),
+            rank = c('species', 'genus', 'phylum', 'family'),
+            id = taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi'),
+            auth = c('Linnaeus, 1758', 'Cohn 1872', NA, 'Juss., 1789'))

> tax_id(x)
<taxon_id[4]>
[1] 9606 (ncbi) 1386 (ncbi) 4890 (ncbi) 4345 (ncbi)

> tax_id(x) <- paste0('00', tax_id(x))
> tax_id(x)[1] <- '00000'
> tax_id(x)
<taxon_id[4]>
[1] 00000  001386 004890 004345

tax_name(x)

设置和获取分类群名称。

复制代码
> x <- taxon(name = c('Homo sapiens', 'Bacillus', 'Ascomycota', 'Ericaceae'),
+            rank = c('species', 'genus', 'phylum', 'family'),
+            id = taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi'),
+            auth = c('Linnaeus, 1758', 'Cohn 1872', NA, 'Juss., 1789'))

> tax_name(x)
[1] "Homo sapiens" "Bacillus"     "Ascomycota"   "Ericaceae"   

> tax_name(x) <- tolower(tax_name(x))
> tax_name(x)[1] <- 'Billy'
> tax_name(x)
[1] "Billy"      "bacillus"   "ascomycota" "ericaceae"

tax_rank(x)

设置和获取类群等级。

复制代码
> x <- taxon(name = c('Homo sapiens', 'Bacillus', 'Ascomycota', 'Ericaceae'),
+            rank = c('species', 'genus', 'phylum', 'family'),
+            id = taxon_id(c('9606', '1386', '4890', '4345'), db = 'ncbi'),
+            auth = c('Linnaeus, 1758', 'Cohn 1872', NA, 'Juss., 1789'))

> tax_rank(x)
<taxon_rank[4]>
[1] species genus   phylum  family 
Rank levels: phylum < family < genus < species

> tax_rank(x) <- 'species'
> tax_rank(x)[1] <- taxon_rank('family')
> tax_rank(x)
<taxon_rank[4]>
[1] family  species species species
Rank levels: family < species
相关推荐
炼丹师小米3 分钟前
Ubuntu24.04.1系统下VideoMamba环境配置
python·环境配置·videomamba
GFCGUO9 分钟前
ubuntu18.04运行OpenPCDet出现的问题
linux·python·学习·ubuntu·conda·pip
快乐就好ya34 分钟前
Java多线程
java·开发语言
CS_GaoMing1 小时前
Centos7 JDK 多版本管理与 Maven 构建问题和注意!
java·开发语言·maven·centos7·java多版本
985小水博一枚呀2 小时前
【深度学习基础模型】神经图灵机(Neural Turing Machines, NTM)详细理解并附实现代码。
人工智能·python·rnn·深度学习·lstm·ntm
2401_858120532 小时前
Spring Boot框架下的大学生就业招聘平台
java·开发语言
转调2 小时前
每日一练:地下城游戏
开发语言·c++·算法·leetcode
Java探秘者2 小时前
Maven下载、安装与环境配置详解:从零开始搭建高效Java开发环境
java·开发语言·数据库·spring boot·spring cloud·maven·idea
2303_812044463 小时前
Bean,看到P188没看了与maven
java·开发语言
秋夫人3 小时前
idea 同一个项目不同模块如何设置不同的jdk版本
java·开发语言·intellij-idea