跳转到主要内容

用于上传数据到HCA数据平台的命令行工具

项目描述

hca-util

用于上传数据到人类细胞图谱AWS S3存储桶的命令行工具。

用户

先决条件

用户需要具备

  1. 基本的命令行知识
  2. 机器上安装了Python3.x
  3. 访问S3存储桶中数据的凭证(访问密钥和密钥)

安装

可以从PyPi安装 hca-util 工具。

$ pip install hca-util

请注意,该工具的一个版本已在PyPi上发布,名称为covid-util,用于上传数据到欧洲COVID-19数据平台。此版本使用自己的独立数据存储和访问凭证。

使用方法

显示帮助和命令列表。

$ hca-util -h
usage: hca-util [-h] [--version] [--profile PROFILE] {config,create,select,list,upload,download,delete} ...

hca-util

optional arguments:
  -h, --help            show this help message and exit
  --version, -v         show program's version number and exit
  --profile PROFILE     use PROFILE instead of default 'hca-util' profile

command:
  {config,create,select,list,upload,download,delete}
    config              configure AWS credentials
    create              create an upload area (authorised users only)
    select              select or show the active upload area
    list                list contents of the area
    upload              upload files to the area
    download            download files from the area
    delete              delete files from the area

在上面的示例中,可选参数位于[]内,而选项位于{}内。

基本用法如下

$ hca-util cmd ARG1 ARG2 -o1 -o2

通过指定一个命令(cmd - 请参阅下面的列表)来运行该工具,任何必需(位置)参数(例如 ARG1ARG2 - 请参阅每个命令的位置参数),以及任何可选参数(例如 -o1o2 - 请参阅每个命令的选项)。

命令

具体命令的帮助信息

$ hca-util <cmd> -h

某些命令或选项/标志仅限于授权用户(管理员)使用。

config 命令

配置AWS凭证

$ hca-util config ACCESS_KEY SECRET_KEY

positional arguments:
  ACCESS_KEY         AWS Access Key ID
  SECRET_KEY         AWS Secret Access Key

该工具在本地AWS配置文件中使用配置文件名 hca-util

配置完成后,可以通过再次运行命令(这次不提供凭证)来检查设置,以验证之前输入的凭证是否有效。

create 命令

创建上传区域(仅限授权用户)

$ hca-util create NAME [-p {u,ud,ux,udx}]


positional arguments:
  NAME               name for the new area

optional arguments:
  -p {u,ud,ux,udx}   allowed actions (permissions) on new area. u for
                     upload, x for delete and d for download. Default is ux

select 命令

显示或选择活动上传区域

$ hca-util select AREA

positional arguments:
  AREA                area uuid. 

如果没有指定区域,则显示所选区域。

list 命令

列出所选区域的内容

$ hca-util list [-b]

optional arguments:
  -b                 list all areas in bucket **(authorised users only)**

upload 命令

将文件上传到所选区域

$ hca-util upload PATH [PATH ...] [-o]

positional arguments:
  PATH               valid file or directory

optional arguments:
  -o                  overwrite files with same names

download 命令

从所选区域下载文件

$ hca-util download (-a | -f file [file ...])

optional arguments:
  -a                  download all files from selected area
  -f file [file ...]  download specified file(s) only

delete 命令

从所选区域删除文件

$ hca-util delete [-a | -d] [PATH [PATH ...]]

positional arguments:
  PATH               path to file or directory to delete

optional arguments:
  -a                 delete all files from the area
  -d                 delete upload area and contents (authorised users only)

sync 命令

将所选区域的文件传输到Ingest上传区域

$ hca-util sync INGEST_UPLOAD_AREA

positional arguments:
  INGEST_UPLOAD_AREA  Ingest upload area

INGEST_UPLOAD_AREA 格式:s3://org-hca-data-archive-upload-_ENV_/_UUID_/

开发者

下载依赖项

pip install -r requirements.txt

运行

python3 -m ait.commons.util

运行测试

nosetests

项目详情


下载文件

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

源分布

hca-util-0.2.16.tar.gz (21.0 kB 查看哈希值)

上传时间

构建分布

hca_util-0.2.16-py3-none-any.whl (32.2 kB 查看哈希值)

上传时间 Python 3

支持者

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