获取生物物种名录信息的R程序包SP2000
SP2000: An open-sourced R package for querying the Catalogue of Life
通讯作者: *E-mail:chzhding@ynu.edu.cn;dmhe@ynu.edu.cn
编委: 张健
收稿日期: 2020-06-11 接受日期: 2020-08-12 网络出版日期: 2021-01-20
基金资助: |
|
Received: 2020-06-11 Accepted: 2020-08-12 Online: 2021-01-20
物种名录为衡量区域和全球生物多样性提供了数据基础。随着互联网的兴起与发展, 人们将地球上已知的动物、植物、微生物等类群的物种名录信息存储到公共数据平台中, 并对物种名录进行快速及时地更新, 这极大地促进了分类学、保护生物学和宏观生态学等学科的发展, 成为政府或国际组织开展物种保育现状评估、红色名录编撰和生物多样性保护的重要依据。物种2000中国节点(
关键词:
Aims: The Catalogue of Life provides the basis for understanding both regional and global biodiversity. With the invention and development of the internet, the up-to-date species checklists stored in the public databases has greatly promoted the development of taxonomy, conservation biology, and macroecology. Public species checklists play an indispensable role in biodiversity conservation and aid in the assessment of species’ conversation status. The Species 2000 China Node (
Method: To address this issue, we developed the package SP2000 using the R programming language.
Application: SP2000 is an open-source, cross-platform, and user-friendly package which aims to help users query and download the checklist of organisms (including animals, plants, fungi, and microbes) from within and outside China. Here we introduce and describe the usage of SP2000 including installation, and configuration of parameters.
Keywords:
本文引用格式
丁刘勇, 李昊, 陶捐, 张金龙, 黄敏睿, 杨科, 王军, 丁城志, 何大明 (2021)
Liuyong Ding, Hao Li, Juan Tao, Jinlong Zhang, Minrui Huang, Ke Yang, Jun Wang, Chengzhi Ding, Daming He (2021)
物种名录是人们评估生物多样性状况、开展生物多样性保护和管理的基础(Reichhardt, 1999; Banki et al, 2019; Ower & Roskov, 2019)。随着互联网的发展, 人们将地球上已知的动物、植物和微生物的物种名录信息存储到公共数据平台中, 并对物种名录进行快速及时(如年度、季度和月度)的更新, 这极大地促进了分类学、保护生物学和宏观生态学等学科的发展(蒋志刚等, 2015)。目前, 这些数据库已经成为开展物种保育现状评估、红色名录编撰和生物多样性保护的重要依据。
物种2000中国节点(Species 2000 China Node,
针对以上问题, 我们选取R编程语言(R Core Team, 2020), 开发了SP2000程序包(
1 SP2000的基本原理
R程序包SP2000的编写基于物种2000中国节点网站提供的API服务(
2 SP2000的特点
相比其他生物物种名录获取工具, 如浏览器插件(Catalogue of Life Search Plugin,
3 SP2000的使用指南
3.1 版本与安装
R语言编写的程序包SP2000已被R语言官网接收(https://cran.r-project.org/package=SP2000/), 源代码详见https://github.com/Otoliths/SP2000/。用户可直接通过R命令install.packages("SP2000")安装, 也可以通过devtools::install_github("Otoliths/SP2000")安装。当前发行的SP2000程序包版本为0.1.0, 主要包含8个函数: set_search_key、search_family_id、search_taxon_id、search_checklist、get_redlist_china、get_col_global、find_synonyms和get_col_taiwan。其详细使用指南见附录1。
3.2 set_search_key设置Species 2000密钥
函数set_search_key只有1个参数key。在运行函数search_*之前需先申请“Species 2000”密钥, 注册物种2000中国节点网站, 点击“用户信息”便可获取一个自己独享的API密钥服务, 然后调用一次函数set_search_key("your key"), 便可运行所有search_*函数(即search_family_id、search_taxon_id和search_checklist)。
3.3 search_family_id查询中国生物物种名录的科id
科是生物学分类中最常用的分类等级, 通过科可更方便查询到种或种下的分类单位。物种2000中国节点数据平台对分类单位科、种(种下)都编写了id, 具有唯一性, 保证了数据查询的准确率。函数search_family_id提供了查询科id集合的功能, 它有4个参数: query、start、limit和mc.cores。(1)参数query输入中国生物的科名或科名的一部分、或科拉丁名和中文名, 支持单个或多个变量查询; (2)参数start设置单次查询开始的页数, 默认值为1; (3)参数limit设置单次查询返回的记录, 默认值为20; (4)参数mc.cores设置计算机的内核数量, 缩短查询时间, 默认值为2。以“鳗鲡科(Anguillidae)”为例, 调用方式为search_family_id (query = "Anguillidae", mc.cores = 2)。
3.4 search_taxon_id查询中国生物物种名录的种id
通过科id可以直接获取种或种下的id (唯一性)列表, 然后使用函数search_checklist获取物种名录的详细信息。函数search_taxon_id支持科id、物种学名和中文名查询种或种的id, 它有5个参数: query、name、start、limit和mc.cores。(1)参数query输入函数search_family_id查询返回的科名id、或中国生物物种的学名和中文名, 支持单个或多个变量查询; (2)参数name设置查询方式, 与参数query配合使用, 可选择参数有“familyID”, “scientificName”和“commonName”, 默认值为“scientificName”; (3)参数start设置单次查询开始的页数, 默认值为1; (4)参数limit设置单次查询返回的记录, 默认值为20; (5)参数mc.cores设置同3.3。函数search_taxon_id可以与search_family_id配合使用, 以“鳗鲡科(Anguillidae)”为例, R代码如下:
## 加载包
library ("SP2000")
## 设置“Species 2000”密钥
set_search_key <- "your apikey"
## 根据科名查询, 返回科id集合
familyid <- search_family_id (query = "Anguillidae")
## 根据科id返回种或种下的id列表
query <- familyid$Anguillidae$data$record_id
taxonid <- search_taxon_id (query = query, name = "familyID")
3.5 search_checklist查询中国生物物种名录信息
函数search_checklist的主要功能是通过种或种下id(唯一性)查询返回物种的详细信息, 包括科学名、同物异名、别名、文献、分类系统、分布区等数据, 以及中文名和中文名的汉语拼音等内容。该函数需要与函数search_family_id和search_taxon_id配合使用, 有2个参数: query和mc.cores。(1)参数query输入函数search_taxon_id查询返回的种或种下id集合, 支持单个或多个变量查询; (2)参数mc.cores同3.3。
以3.4查询结果taxonid为例, 调用方式为:
query <- taxonid[["3851c5311bed46c19529cb155d37aa9b"]][["data"]][["namecode"]]
search_checklist (query = query)
3.6 get_redlist_china查询中国物种红色名录信息
函数get_redlist_china有4个参数: query、option、group和viewDT。(1)参数query输入科学名或中文名; (2)参数option设置查询方式, 与参数query配合使用, 可选择参数有“Chinese Names”和“Scientific Names”, 默认值为“Scientific Names”; (3)参数group设置查询类群, 可选择参数包括“Amphibians”, “Birds”, “Mammals”, “Inland Fishes”, “Reptiles”, “Plants”和“Fungi”, 分别是两栖类、鸟类、哺乳类、内陆鱼类、爬行类、植物和真菌; (4)参数viewDT是逻辑值, 与参数group配合使用, 如果viewDT = TRUE, 查询结果显示一个交互性页面, 以“内陆鱼类(Inland Fishes)”为例, 调用方式为get_redlist_china (…, group = "Inland Fishes", viewDT = TRUE)。
以“鳗鲡属(Anguilla)”查询为例, R代码如下:
## 加载包
library ("SP2000")
## 查询鳗鲡属的中国红色名录信息
get_redlist_china (query = "Anguilla", option = "Scientific Names")
## 查询“内陆鱼类”中国红色名录信息, 显示一个可查询、下载的交互性页面
get_redlist_china (group = "Inland Fishes", viewDT = TRUE)
3.7 get_col_global查询全球生物物种名录信息
函数get_col_global运行不受“Species 2000”密钥限制, 可独立使用, 它包含6个参数: query、option、response、start、limit和mc.cores。(1)参数query输入种或种下id、物种名; (2)参数option设置查询方式, 与参数query配合使用, 可选择参数有“id”和“name”, 默认值为“name”; (3)参数response设置查询返回结果, 可选择“full”或“terse”, “full”返回完整查询结果, “terse”返回简短查询结果, 默认值为“terse”; (4)参数start设置查询返回的第一个记录, 默认值为0, 与参数response配合使用; (5)参数limit设置单次查询返回的记录, 默认值为500, 单次简短查询返回结果的最大数量为500, 单次完整查询返回结果的最大数量为50; (6)参数mc.cores设置同3.3。
以批量获取全球“鳗鲡属(Anguilla)”名录信息为例, R代码如下:
## 加载包
library("SP2000")
x <- get_col_global (query = "Anguilla", response = "full")
## 总的查询结果为208
x[["Anguilla"]][["meta"]][["total_number_of_results"]] [1]
3.8 find_synonyms查询全球生物物种同物异名
函数find_synonyms有2个参数: query和mc.cores。(1)参数query输入物种名, (2)参数mc.cores设置计算机的内核数量, 缩短查询时间, 默认值为2。以“欧洲鳗鲡(Anguilla anguilla)”为例, 调用方式为find_synonyms ("Anguilla anguilla")。
3.9 get_col_taiwan查询台湾生物物种名录信息
函数get_col_taiwan有4个参数: query、level、option、include_synonyms。(1)参数query查询分类名称信息; (2)参数level设置查询方式, 与参数query配合使用, 可选择“kingdom”, “phylum”, “class”, “order”, “family”, “genus”, “species”中的一个, 分别表示界、门、纲、目、科、属和种, 默认值为“species”; (3)参数option设置查询方式, 可选择“contain”, “equal”和“beginning”中的一个, 分别表示“包含”, “等于”, “开始于”, 默认值为“equal”; (4)参数include_synonyms是逻辑值, 查询结果是否包含同物异名信息, 默认值为TRUE。以“鳗鲡科(Anguillidae)”为例, 调用方式为get_col_taiwan(query = "Anguillidae", level = "family")。
为了更好地满足生物多样性信息时代的用户需求, 在R程序包SP2000基础上, 我们也使用Python语言(Perkel, 2015; Python Software Foundation, 2020)编写了程序包SP2000(
附录 Supplementary Material
附录1 R程序包SP2000的安装、配置和使用指南
Appendix 1 The installation, configuration and usage for R package SP2000
附录2 Python程序包SP2000的简介、安装、配置和使用指南
Appendix 2 The introduction, Installation, configuration and usage for Python package SP2000
附录3 本文英文版
Appendix 3 Full-text in English
致谢
衷心感谢两位审稿专家以及编委对R程序包SP2000提出的宝贵意见和建议。
参考文献
Catalogue of Life Plus: A collaborative project to complete the checklist of the world’s species
spocc: Interface to Species Occurrence Data Sources
R package version 1.0.8. https://CRAN.R- project.org/package=spocc/. (accessed on 2020-06-01)
Protecting biodiversity and promoting sustainable development: In memory of the releasing of Catalogue of Life China 2015 and China Biodiversity Red List on the International Day for Biological Diversity 2015
保护生物多样性, 促进可持续发展—— 纪念《中国生物物种名录》和《中国生物多样性红色名录》发布
Evaluating the popularity of R in ecology
Establishing China Infrastructure for Big Biodiversity Data
中国生物多样性大数据平台建设
The Catalogue of Life: Assembling data into a global taxonomic checklist
R: A Language and Environment for Statistical Computing
Principles behind designing herbarium specimen labels and the R package ‘herblabel’
植物标本标签设计的原则及R程序包herblabel
/
〈 |
|
〉 |
