Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Usage: cirro download [OPTIONS]
Options:
--project TEXT Name or ID of the project
--dataset TEXT ID of the dataset
--file... TEXT Name and relative path of the file (optional)
--data-directory TEXT Directory to store the files
-i, --interactive Gather arguments interactively
--help Show this message and exit.
Expand Down Expand Up @@ -91,7 +92,7 @@ $ cirro upload --interactive
See the following set of Jupyter notebooks that contain examples on the following topics:

| Jupyter Notebook | Topic |
|--------------------------------------------------------------------|--------------------------------------|
| ------------------------------------------------------------------ | ------------------------------------ |
| [Introduction](samples/Getting_started.ipynb) | Installing and authenticating |
| [Uploading a dataset](samples/Uploading_a_dataset.ipynb) | Uploading data |
| [Downloading a dataset](samples/Downloading_a_dataset.ipynb) | Downloading data |
Expand All @@ -103,7 +104,7 @@ See the following set of Jupyter notebooks that contain examples on the followin
## R Usage

| Jupyter Notebook | Topic |
|-----------------------------------------------------|---------------------|
| --------------------------------------------------- | ------------------- |
| [Downloading a dataset in R](samples/Using-R.ipynb) | Reading data with R |

## Advanced Usage
Expand All @@ -113,7 +114,7 @@ View the API documentation for this library [here](https://cirrobio.github.io/Ci
### Supported environment variables

| Name | Description | Default |
|----------------|-------------------------------|----------|
| -------------- | ----------------------------- | -------- |
| CIRRO_HOME | Local configuration directory | ~/.cirro |
| CIRRO_BASE_URL | Base URL of the data portal | |

Expand Down
4 changes: 4 additions & 0 deletions cirro/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def list_datasets(**kwargs):
help='Name or ID of the project')
@click.option('--dataset',
help='ID of the dataset')
@click.option('--file',
help='Name and relative path of the file (optional)',
default=[],
multiple=True)
@click.option('--data-directory',
help='Directory to store the files')
@click.option('-i', '--interactive',
Expand Down
14 changes: 14 additions & 0 deletions cirro/cli/controller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import os
import sys

import pandas as pd
Expand Down Expand Up @@ -142,6 +143,19 @@ def run_download(input_params: DownloadArguments, interactive=False):
datasets = cirro.datasets.list(project_id)
dataset_id = get_id_from_name(datasets, input_params['dataset'])

if input_params['file']:
all_files = cirro.datasets.get_file_listing(project_id, dataset_id)
files_to_download = []

for filepath in input_params['file']:
if not filepath.startswith('data/'):
filepath = os.path.join('data/', filepath)
file = next((f for f in all_files if f.relative_path == filepath), None)
if not file:
logger.warning(f"Could not find file {filepath}. Skipping.")
continue
files_to_download.append(file)

logger.info("Downloading files")
if cirro.configuration.enable_additional_checksum:
checksum_method = "SHA256"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cirro"
version = "1.2.8"
version = "1.2.9"
description = "CLI tool and SDK for interacting with the Cirro platform"
authors = ["Cirro Bio <[email protected]>"]
license = "MIT"
Expand Down