Skip to main content

Command line API

Updated for basepair version 3.x

Command-line (CLI) bindings for Basepair's API. The CLI is a thin wrapper around the Python bindings, which are more fully-featured. If you can't accomplish something with the CLI, check the Python API instead.

All commands follow the pattern:

basepair <resource> <action> [options] -c /path/to/basepair.config.json

An outline of the contents on this page:

  1. Creating a project
  2. Creating a sample
  3. Running an analysis
  4. Downloading results
  5. Managing pipelines and modules
  6. Other commands

1. Creating a project

List your existing projects:

basepair project list -c /path/to/basepair.config.json
id     name          owner               last updated
------ ------------- ------------------- --------------------------
784 Example Data user@example.com 2022-03-11T14:01:19
8611 Project 1 user@example.com 2022-05-15T19:20:06

Create a new project (requires a team ID, visible in your account settings):

basepair project create --name my_project --team 1234 -c /path/to/basepair.config.json
created: project with id 8658

Share a project with a collaborator:

basepair project update -u 8658 --team 1234 \
--emails collaborator@example.com --perm view \
-c /path/to/basepair.config.json

Permission levels: view, edit, admin.


2. Creating a sample

Create a sample within your project, specifying the sample name, data type, genome, and file locations:

basepair sample create --project 8658 \
--name Untreat1 \
--type atac-seq \
--genome hg19 \
--file1 /path/to/read_1.fastq.gz \
--file2 /path/to/read_2.fastq.gz \
-c /path/to/basepair.config.json
created: sample with id 75042
Sample id: 75042
Creating upload read_1.fastq.gz
created: upload with id 138264
Creating upload read_2.fastq.gz
created: upload with id 138265
Sample created successfully.

To see all available data types:

basepair sample create -h

Supported types: atac-seq, chip-seq, crispr, cutnrun, cutntag, dna-seq, other, panel, rna-seq, scaleBio_scRNA, scrna-seq, small-rna-seq, snap-chip, wes, wgs.

To list available genomes:

basepair genome list -c /path/to/basepair.config.json

List all samples in a project:

basepair sample list --project 8658 -c /path/to/basepair.config.json

Get details for a specific sample:

basepair sample get -u 75042 -c /path/to/basepair.config.json

Update a sample (e.g. change genome or data type):

basepair sample update -u 75042 --genome hg38 -c /path/to/basepair.config.json

3. Running an analysis

Run an analysis by specifying the project, sample, and pipeline:

basepair analysis create --project 8658 \
--sample 75042 \
--pipeline 19 \
-c /path/to/basepair.config.json
created: analysis 91182 with sample id(s) 75042

To list all available pipelines:

basepair pipeline list -c /path/to/basepair.config.json

Run a differential-expression analysis with multiple samples and controls:

basepair analysis create \
--sample 75042 75043 75044 \
--control 75050 75051 \
--pipeline 8 \
-c /path/to/basepair.config.json

Override per-node parameters (format: node_id:argument:value):

basepair analysis create \
--sample 75042 \
--pipeline 8 \
--params deseq2:padj:0.01 deseq2:lfc:1.5 \
-c /path/to/basepair.config.json

List analyses in a project:

basepair analysis list --project 8658 -c /path/to/basepair.config.json

Restart a completed or failed analysis:

basepair analysis reanalyze -u 91182 -c /path/to/basepair.config.json

Stop a running analysis:

basepair analysis terminate -u 91182 -c /path/to/basepair.config.json

4. Downloading results

Download all files for a given analysis:

basepair analysis download -u 91182 -c /path/to/basepair.config.json

Download only the deduplicated alignment BAM files (tagged dedup):

basepair analysis download -u 91182 \
--tags dedup \
--tagkind subset \
-c /path/to/basepair.config.json

Download only BAM files, saving to a specific directory:

basepair analysis download -u 91182 \
--tags bam \
--tagkind exact \
-o ./bams \
-c /path/to/basepair.config.json

Download everything except log files:

basepair analysis download -u 91182 \
--tags log \
--tagkind diff \
-c /path/to/basepair.config.json

Tag filter modes:

ModeBehaviour
exactOnly files whose tag set exactly matches the provided tags
subsetAny file that has at least one of the provided tags
diffExclude files that have the provided tag

To list all files of an analysis with their tags:

basepair analysis get -u 91182 -c /path/to/basepair.config.json

Download the execution log:

basepair analysis download-log -u 91182 -o ./logs -c /path/to/basepair.config.json

5. Managing pipelines and modules

Create a pipeline from a YAML definition file:

basepair pipeline create --file /path/to/pipeline.yaml -c /path/to/basepair.config.json

Update an existing pipeline:

basepair pipeline update -u 380 --file /path/to/pipeline.yaml -c /path/to/basepair.config.json

Create a module:

basepair module create --file /path/to/module.yaml -c /path/to/basepair.config.json

List modules for a pipeline:

basepair module list --pipeline 19 -c /path/to/basepair.config.json

6. Other commands

Get JSON output — add --json to any get or list command:

basepair analysis list --project 8658 --json -c /path/to/basepair.config.json
basepair sample get -u 75042 --json -c /path/to/basepair.config.json

Download a file by ID:

basepair file download -u 456789 -o ./downloads -c /path/to/basepair.config.json

Delete resources:

basepair analysis delete -u 91182 -c /path/to/basepair.config.json
basepair sample delete -u 75042 -c /path/to/basepair.config.json