跳转到主要内容

Python的物种工具包

项目描述

pytaxize

docs travis coverage black

这是R包taxize的移植版。这个库在R版本中有许多功能,所以将所有相同的功能移植过来需要一些时间。

为什么?taxize的Python版本的显著优势是对于那些真正喜欢Python的人来说。此外,您可以在Web应用程序中使用pytaxize(例如,在Shiny应用程序中),但不会扩展,速度不会很快等。

python 2/3

pytaxize仅在Python 3中开发和测试

安装

从pypi稳定版

pip install pytaxize

开发版本

sudo pip install git+git://github.com/sckott/pytaxize.git#egg=pytaxize

物种ID

我开始为物种ID编写类接口,它将有一系列扩展方法来进行各种操作。目前可用的只是获取COL ID。

from pytaxize import Ids
res = Ids('Poa annua')
res.ncbi()
res.ids
{'Poa annua': [{'id': '93036',
   'name': 'Poa annua',
   'rank': 'species',
   'uri': 'https://www.ncbi.nlm.nih.gov/taxonomy/93036'}]}

抓取物种名称

out = pytaxize.scrapenames(url = 'http://www.mapress.com/zootaxa/2012/f/z03372p265f.pdf')
out['data'][0:3]
[{'verbatim': '(Hemiptera:',
  'scientificName': 'Hemiptera',
  'offsetStart': 222,
  'offsetEnd': 233},
 {'verbatim': 'Sternorrhyncha:',
  'scientificName': 'Sternorrhyncha',
  'offsetStart': 234,
  'offsetEnd': 249},
 {'verbatim': 'Coccoidea:',
  'scientificName': 'Coccoidea',
  'offsetStart': 250,
  'offsetEnd': 260}]

ITIS低级函数

from pytaxize import itis
itis.accepted_names(504239)

{'acceptedName': 'Dasiphora fruticosa',
   'acceptedTsn': '836659',
   'author': '(L.) Rydb.'}
itis.comment_detail(tsn=180543)

[{'commentDetail': 'Status: CITES - Appendix I as U. arctos (Mexico, Bhutan, China, and Mongolia populations) and U. a. isabellinus; otherwise Appendix II. U. S. ESA - Endangered as U. arctos pruinosus, as U. arctos in Mexico, and as U. a. arctos in Italy. Threatened as U. a. ho...',
  'commentId': '18556',
  'commentTimeStamp': '2007-08-20 15:06:38.0',
  'commentator': 'Wilson & Reeder, eds. (2005)',
  'updateDate': '2014-02-03'},
 {'commentDetail': "Comments: Reviewed by Erdbrink (1953), Couturier (1954), Rausch (1963a), Kurtén (1973), Hall (1984) and Pasitschniak-Arts (1993). Ognev (1931) and Allen (1938) recognized U. pruinosus as distinct; not followed by Ellerman and Morrison-Scott (1951), Gao (1987), and Stroganov (1962). Lönnberg (1923b) believed that differences between pruinosus and arctos warranted subgeneric distinction as (Mylarctos) pruinosus; however, this was not supported by Pocock's (1932b) thorough revision. Synonyms allocated a...",
  'commentId': '18557',
  'commentTimeStamp': '2007-08-20 15:06:38.0',
  'commentator': 'Wilson & Reeder, eds. (2005)',
  'updateDate': '2014-02-03'}]
itis.hierarchy_up(tsn = 36485)

{'author': 'Raf.',
 'parentName': 'Asteraceae',
 'parentTsn': '35420',
 'rankName': 'Genus',
 'taxonName': 'Agoseris',
 'tsn': '36485'}

生命之树目录

from pytaxize import col
x = col.children(name=["Apis"])
x[0][0:3]
[{'id': '7a4a38c5095963949d6d6ec917d471de',
  'name': 'Apis andreniformis',
  'rank': 'Species'},
 {'id': '39610a4ceff7e5244e334a3fbc5e47e5',
  'name': 'Apis cerana',
  'rank': 'Species'},
 {'id': 'e1d4cbf3872c6c310b7a1c17ddd00ebc',
  'name': 'Apis dorsata',
  'rank': 'Species'}]

解析名称

使用GBIF的解析器API解析名称

from pytaxize import gbif
gbif.parse(name=['Arrhenatherum elatius var. elatius',
     'Secale cereale subsp. cereale', 'Secale cereale ssp. cereale',
   'Vanessa atalanta (Linnaeus, 1758)'])
[{'scientificName': 'Arrhenatherum elatius var. elatius',
  'type': 'SCIENTIFIC',
  'genusOrAbove': 'Arrhenatherum',
  'specificEpithet': 'elatius',
  'infraSpecificEpithet': 'elatius',
  'parsed': True,
  'parsedPartially': False,
  'canonicalName': 'Arrhenatherum elatius elatius',
  'canonicalNameWithMarker': 'Arrhenatherum elatius var. elatius',
  'canonicalNameComplete': 'Arrhenatherum elatius var. elatius',
  'rankMarker': 'var.'},
 {'scientificName': 'Secale cereale subsp. cereale',
  'type': 'SCIENTIFIC',
  ...

贡献者

元数据

变更日志

0.7.0 (2020-06-15)

  • 首次发布到pypi

项目详情


下载文件

下载适合您平台的文件。如果您不确定该选择哪个,请了解更多关于安装包的信息。

源代码发行版

pytaxize-0.7.0.tar.gz (71.7 kB 查看哈希值)

上传时间 源代码

构建发行版

pytaxize-0.7.0-py3.8.egg (155.9 kB 查看哈希值)

上传时间 源代码

pytaxize-0.7.0-py2.py3-none-any.whl (94.5 kB 查看哈希值)

上传时间 Python 2 Python 3

支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面