跳转到主要内容

这是一个库,用于与由EBI托管的Human Cell Atlas摄取API进行通信,用于创建和管理HCA项目提交。

项目描述

PyPI

摄取客户端

此存储库包含可以跨摄取服务共享的hca-ingest Python包库。

安装

pip install hca-ingest

使用

API包

要在您的Python脚本中使用摄取API接口

from hca_ingest.api.ingestapi import IngestApi

通过设置INGEST_API环境变量来配置要使用的摄取URL

INGEST_API=http://localhost:8080

Schema模板包

Schema模板包提供了在HCA JSON模式中查找属性的方便方法。JSON模式中的每个属性都表示为以模式名称为前缀的简单键。

第一个元素是模式简称,后面跟着属性。例如,在donor_organism模式中,biomaterial_id属性的键是donor_organism.biomaterial_core.biomaterial_id

模式模板提供了访问每个键的属性,这对于开发需要查询或根据JSON模式生成JSON文档的模式感知应用程序非常有用。

描述 示例
{key}.schema.high_level_entity 告诉您属性是否属于typemodulecore模式 donor_organism.biomaterial_core.schema.high_level_entity = core, donor_organism.schema.high_level_entity = type, donor_organism.medical_history.schema.high_level_entity = module
{key}.schema.domain_entity 告诉您属性是否位于biomaterialfileprocessprotocolanalysisproject模式中 donor_organism.schema.domain_entity = biomaterial, dissociation_protocol.schema.domain_entity = protocol, dissociation_protocol.schema.domain_entity = protocol, sequence_file.schema.domain_entity = File
{key}.schema.module 告诉您定义此属性的模式名称 donor_organism.schema.domain_entity = biomaterial, dissociation_protocol.schema.module = dissociation_protocol, dissociation_protocol.schema.module = dissociation_protocol, donor_organism.medical_history.schema.module = medical_history
{key}.schema.url 提供定义此属性的模式的全URL donor_organism.medical_history.schema.url = https://schema.humancellatlas.org/module/biomaterial/5.1.0/medical_history
{key}.value_type 告诉您此属性的预期值类型。可以是objectstringinteger之一 donor_organism.medical_history.medication.value_type = string, sequence_file.lane_index.value_type = integer, sequence_file.file_core.value_type = object
{key}.multivalue 告诉您值是单个值还是值的数组 sequence_file.insdc_run.multivalue = True
{key}.user_friendly 属性的友好名称 sequence_file.insdc_run.multivalue = INSDC run
{key}.description 属性的简要描述 sequence_file.insdc_run.multivalue = An INSDC (International Nucleotide Sequence Database Collaboration) run accession. Accession must start with DRR, ERR, or SRR.
{key}.format 告诉您属性是否有特定的格式,如日期格式 project.contact.email.format = email
{key}.required 告诉您属性是否必需 donor_organism.biomaterial_core.biomaterial_id.required = True
{key}.identifiable 告诉您属性是否是当前实体的可识别字段 donor_organism.biomaterial_core.biomaterial_id.identifiable = True, donor_organism.biomaterial_core.biomaterial_name.identifiable = False
{key}.external_reference 告诉您属性是否是全局可识别的,因此可以从摄入中检索可检索的对象 donor_organism.uuid.external_reference = True
{key}.example 此属性预期值的示例 project.contact.contact_name.example = John,D,Doe

开发者说明

此包目前仅与Python 3兼容。

需求

此项目的要求列在2个文件中:requirements.txtdev-requirements.txtdev-requirements.txt文件包含特定于开发的依赖项

需求文件(requirements.txtdev-requirements.txt)使用pip-toolspip-compile生成

pip-compile requirements.in
pip-compile dev-requirements.in

直接依赖项列在requirements.indev-requirements.in输入文件中。

安装依赖项

  • 使用pip-tools中的pip-sync
pip-sync requirements.txt dev-requirements.txt
  • 或直接使用pip install
    pip install -r requirements.txt
    pip install -r dev-requirements.txt

升级依赖项

要更新所有包,定期重新运行pip-compile --upgrade

要更新特定包到最新版本或指定版本,使用--upgrade-package-P标志

pip-compile --upgrade-package requests

有关更多选项,请参阅pip-compile的文档

运行测试

要运行所有测试,请使用 unittest

python -m unittest 

以可编辑模式开发代码

使用 pip 的可编辑模式,客户端项目可以直接引用此存储库中的最新代码,而无需通过 PyPI 安装。这可以通过手动克隆代码库来实现

pip install -e path/to/ingest-client

或者通过为 pip 提供对存储库的引用来自动执行

pip install -e \
git+https://github.com/HumanCellAtlas/ingest-client.git\
#egg=hca_ingest

有关 pip 的版本控制系统支持的更多信息,请参阅 VCS 支持文档

发布到 PyPI

  1. 通过 注册页面 创建 PyPI 账户。

    请注意,PyPI 在发布前要求验证电子邮件地址。

  2. 为分发打包项目。

     python setup.py sdist
    

    请注意,setup.py 已配置为构建名称为 hca-ingest 的分发。

  3. 安装 Twine

     pip install twine        
    
  4. 将分发包上传到 PyPI。

     twine upload dist/*
    

    运行 python setup.py sdist 将在项目基本目录的 dist 目录中创建一个包。如果需要,可以选择特定的包而不是通配符 *

     twine upload dist/hca_ingest-0.1a0.tar.gz
    

项目详情


下载文件

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

源分发

hca-ingest-2.8.0.tar.gz (59.8 kB 查看哈希)

上传时间

由以下机构支持

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