Skip to content

CLI reference

Global options

These options can be used with any subcommand.

Option Description
-v, --verbose Increase log verbosity (-v, -vv, -vvv)
-q, --quiet Suppress all output except errors
--version Print version
-h, --help Print help

Accession types

sracha accepts three types of accessions:

Type Prefixes Example Description
Run SRR, ERR, DRR SRR2584863 Single sequencing run (directly downloadable)
Study SRP, ERP, DRP SRP123456 Study containing multiple runs
BioProject PRJNA, PRJEB, PRJDB PRJNA675068 BioProject containing multiple runs

Study and BioProject accessions are automatically resolved to their constituent run accessions via the NCBI EUtils API.

Accession lists

The get, fetch, and info commands accept --accession-list to read accessions from a file (one per line). Blank lines and lines starting with # are skipped. This can be combined with positional arguments.

1
2
3
4
5
# From a file
sracha get --accession-list SRR_Acc_List.txt

# Mixed: positional + file
sracha get SRR9999999 --accession-list more_accessions.txt

sracha get

Download, convert, and compress SRA data in one shot.

sracha get [OPTIONS] [ACCESSION]...

Arguments

Argument Description
ACCESSION One or more accessions (run, study, or BioProject)

Options

Input / output

Option Default Description
--accession-list <FILE> Read accessions from a file (one per line)
-O, --output-dir <DIR> . Output directory
--folder-per-accession Place each accession's outputs (FASTQ + metadata sidecar + temp SRA + completion marker + .sracha-progress + any --keep-sra artifact) inside its own <output-dir>/<accession>/ subdirectory. The shared sracha-stats.jsonl audit log stays at the top level
--format <FORMAT> sra Download format: sra (full quality) or sralite (simplified quality, smaller)
-f, --force Overwrite existing files

Sequence output

Option Default Description
--split <MODE> split-3 Split mode: split-3, split-files, split-spot, interleaved. split-3 and interleaved on a single-end run print a warning and write one file
--paired-suffix <STYLE> numeric Suffix style for paired/split FASTQ outputs: numeric (_1/_2, matches fasterq-dump and ENA) or r (_R1/_R2, matches Illumina BCL output)
--fasta Output FASTA instead of FASTQ (drops quality scores)
--seq-defline <TEMPLATE> Custom defline template, fasterq-dump --seq-defline syntax (see Custom deflines)
--qual-defline <TEMPLATE> Custom +-line template, same variables as --seq-defline; + alone writes a bare + (#162)
--min-read-len <N> Minimum read length filter
--include-technical Include technical reads (skipped by default)
--metadata <FORMAT> Write a <accession>.metadata.{tsv,json} sidecar alongside each FASTQ output, capturing BioSample/SAMN, Sample/SRS, BioProject, library strategy/source/selection/layout, instrument, experiment, study, scientific name, tax id, bases, and release dates from the EUtils RunInfo CSV. Values: tsv, json, both. In TSV, tabs/newlines inside values become spaces and list columns (avg_read_len) are ;-joined, as in --dry-run and info
-Z, --stdout Write to stdout (stream interleaved FASTQ, auto-delete temp SRA)

Compression

Option Default Description
--no-gzip Disable gzip compression (compressed by default)
--gzip-level <N> 1 Gzip compression level (1-9)
--zstd Use zstd compression instead of gzip
--zstd-level <N> 3 Zstd compression level (1-22)

Performance

Option Default Description
-t, --threads <N> auto (CPUs, max 32) Thread count for decode and compression
--connections <N> auto (8, up to 24 on large files) HTTP connections per file; an explicit number is used as given

Download behavior

Option Default Description
--no-resume Disable download resume (re-download from scratch)
--dry-run Resolve accessions and print what would be downloaded, then exit without downloading or decoding
--dry-run-format <FORMAT> tsv Output format for --dry-run: tsv or json
-y, --yes Confirm project downloads and large downloads (>100 GiB)
--prefer-sdl Skip direct S3 and resolve via the SDL API
--prefer-ena Try ENA FASTQ mirrors first; fall back to the NCBI SRA path if ENA has no FASTQ for the accession or its output config is incompatible with the requested split/compression
--no-runinfo Skip EUtils RunInfo API call (derive read structure from VDB metadata)
--no-disk-check Skip the free-disk-space preflight. Useful when the output filesystem autoscales, or when statvfs reports a quota that does not reflect what the job can actually use
--prefetch-depth <N> 2 Number of accessions to download ahead of the decoder. Larger values hide slow networks behind decode at the cost of one extra temp SRA file per step. Multi-accession get only
--keep-sra Keep the downloaded SRA file in the output directory instead of deleting it after decode
--no-progress Disable progress bar
--no-strict Downgrade strict-fatal data-integrity anomalies from hard failures to warnings. Strict mode fails when the quality and sequence streams do not correspond, when decoded bases or spots disagree with the archive's own recorded totals, or on invalid quality bytes, quality overruns and paired-spot violations. Strict is the default. Benign-fallback counters (SRA-lite all-zero quality blobs, truncated-spot recovery) stay informational either way
--verify Also check decoded quality values against the archive's STATS/QUALITY histogram. Every other quality check compares lengths, so this is the only one that notices a decode emitting the right number of plausible quality bytes at the wrong values. Costs one increment per base; skipped where quality is synthesized rather than decoded (SRA-Lite, --fasta)

sracha fetch

Download SRA files without conversion. When the run has a .vdbcache companion (split-archive cSRA) it is saved beside the archive as <ACC>.sra.vdbcache; sracha fastq picks it up from there. get downloads the same companion, so both commands report each transfer as downloaded, resumed or cached.

sracha fetch [OPTIONS] [ACCESSION]...

Arguments

Argument Description
ACCESSION One or more accessions (run, study, or BioProject)

Options

Option Default Description
--accession-list <FILE> Read accessions from a file (one per line)
-O, --output-dir <DIR> . Output directory
--format <FORMAT> sra Download format: sra (full quality) or sralite (simplified quality, smaller)
--connections <N> auto (8, up to 24 on large files) HTTP connections per file; an explicit number is used as given
--no-validate Skip MD5 verification after download (verification is on by default)
-f, --force Overwrite existing files
--no-resume Disable download resume (re-download from scratch)
-y, --yes Confirm project downloads and large downloads (>100 GiB)
--prefer-sdl Skip direct S3 and resolve via the SDL API
--prefer-ena Fetch pre-computed FASTQ.gz from ENA's mirror instead of the SRA binary. Falls back to the NCBI path when ENA has no FASTQ for an accession
--no-disk-check Skip the free-disk-space preflight. Useful when the output filesystem autoscales, or when statvfs reports a quota that does not reflect what the job can actually use
--no-progress Disable progress bar

sracha fastq

Convert SRA files to FASTQ (or FASTA).

sracha fastq [OPTIONS] <INPUT>...

Arguments

Argument Description
INPUT Local .sra file path(s) (from sracha fetch)

Options

Sequence output

Option Default Description
--split <MODE> split-3 Split mode: split-3, split-files, split-spot, interleaved. split-3 and interleaved on a single-end run print a warning and write one file
--paired-suffix <STYLE> numeric Suffix style for paired/split FASTQ outputs: numeric (_1/_2, matches fasterq-dump and ENA) or r (_R1/_R2, matches Illumina BCL output)
--fasta Output FASTA instead of FASTQ (drops quality scores)
--seq-defline <TEMPLATE> Custom defline template, fasterq-dump --seq-defline syntax (see Custom deflines)
--qual-defline <TEMPLATE> Custom +-line template, same variables as --seq-defline; + alone writes a bare + (#162)
--min-read-len <N> Minimum read length filter
--include-technical Include technical reads (skipped by default)
-Z, --stdout Write to stdout (implies --no-progress)

Compression

Option Default Description
--no-gzip Disable gzip compression (compressed by default)
--gzip-level <N> 1 Gzip compression level (1-9)
--zstd Use zstd compression instead of gzip
--zstd-level <N> 3 Zstd compression level (1-22)

Other

Option Default Description
-t, --threads <N> auto (CPUs, max 32) Thread count for decode and compression
-O, --output-dir <DIR> . Output directory
--folder-per-accession Place each accession's outputs inside its own <output-dir>/<accession>/ subdirectory
-f, --force Overwrite existing files
--no-progress Disable progress bar
--no-strict Downgrade strict-fatal data-integrity anomalies from hard failures to warnings. Strict mode fails when the quality and sequence streams do not correspond, when decoded bases or spots disagree with the archive's own recorded totals, or on invalid quality bytes, quality overruns and paired-spot violations. Strict is the default. Benign-fallback counters (SRA-lite all-zero quality blobs, truncated-spot recovery) stay informational either way
--verify Also check decoded quality values against the archive's STATS/QUALITY histogram. Every other quality check compares lengths, so this is the only one that notices a decode emitting the right number of plausible quality bytes at the wrong values. Costs one increment per base; skipped where quality is synthesized rather than decoded (SRA-Lite, --fasta)

sracha info

Show accession metadata, or inspect a local .sra file.

sracha info [OPTIONS] [ACCESSION_OR_PATH]...

Arguments

Argument Description
ACCESSION_OR_PATH Accession (run, study, or BioProject) or a local .sra file path

Options

Option Default Description
--accession-list <FILE> Read accessions from a file (one per line)
--prefer-ena Also fetch ENA's FASTQ filereport and show it alongside the NCBI info
--format <FMT> table Output format: table (human-readable), tsv, csv, or json (every field)

For accessions, displays file sizes, available formats, download mirrors, and quality information. Study and BioProject accessions are resolved to runs first.

For local file paths, opens the KAR archive directly (no network) and prints its table of contents, schema, and metadata. Paths starting with ~/ are expanded to $HOME.

--format tsv and --format csv emit a single header row followed by one record per accession. Columns: accession, archive_type (SRA/cSRA), layout (SINGLE/PAIRED/N-read), nreads, spots, size_bytes, platform, md5, read_lengths (;-separated, e.g. 8;50;16;49) and read_types (;-separated Biological/Technical), read_lengths_source, title, format (normalized or lite; empty for local files), bases (NCBI's reported count, else an estimate) and bases_estimated (true/false). nreads is the number of biological reads. Missing fields are empty strings. Local .sra paths get a row alongside remote accessions; --prefer-ena is ignored with a stderr warning in these formats. read_lengths and read_types come from the archive's own metadata (fetched with small range requests, no download), so technical reads are included. If that fetch fails, read_lengths falls back to an estimate from NCBI RunInfo, shown as ~61bp+62bp in the table, with read_types empty. read_lengths_source is archive or runinfo accordingly.

title is the human-readable name of the run from NCBI's EFetch experiment XML: the sample title when the run has one, otherwise the experiment title (many runs have only the latter). The same fetch adds Title, Study and Design lines to the single-accession view and a Title column to the multi-run table. It is best-effort: if NCBI is slow or unavailable the fields are simply empty and the rest of the output is unaffected. Local .sra paths have no title.

1
2
3
$ sracha info --format tsv SRR28588231.sra
accession   archive_type    layout  nreads  spots   size_bytes  platform    md5 read_lengths    read_types  read_lengths_source title   format  bases   bases_estimated
SRR28588231 SRA PAIRED  2   66220   23395841    ILLUMINA        301;301 B;B archive             

--format json prints a pretty-printed array with one object per accession and every field the other views show. TSV/CSV stay flat; JSON is the superset for scripts, and adds the study title, design description, mirror URL, alternate mirrors and vdbcache size. Unknown scalars are null and empty lists are [] (no empty-string placeholders). The experiment details are nested:

{
  "accession": "SRR18918001",
  "layout": "PAIRED",
  "format": "normalized",
  "read_lengths": [8, 50, 16, 49],
  "read_types": ["T", "B", "T", "B"],
  "read_lengths_source": "archive",
  "title": "scATAC-seq of Drosophila melanogaster: third-instar larval third leg disc",
  "experiment": {
    "experiment_title": "scATAC-seq of Drosophila melanogaster: third-instar larval third leg disc",
    "sample_title": null,
    "study_title": "Single-Cell Atlas of the Drosophila Leg Disc Identifies a Long Non-Coding RNA in Late Development",
    "design_description": "10X Genomics scATAC-seq v.1",
    "library_construction_protocol": null
  }
}

An accession that fails to resolve appears as {"accession": "...", "error": "..."} so one failure does not break the array. Local .sra paths and remote accessions mix in the same array. Fields shown above are abridged; see the full output for accession, path, archive_type, nreads, spots, bases, bases_estimated, size_bytes, platform, md5, source, source_url, alt_mirrors, vdbcache_size, blobs and columns.


sracha validate

Validate SRA file integrity by decoding all records and checking for errors.

sracha validate [OPTIONS] <INPUT>...

Arguments

Argument Description
INPUT SRA file(s) to validate

Options

Option Default Description
-t, --threads <N> auto (CPUs, max 32) Thread count for decode
--no-progress Disable progress bar
--md5 <HASH> Expected MD5 hex; fail on mismatch. With multiple inputs every file must match
--offline Skip the SDL lookup for the expected MD5 (air-gapped use)

sracha vdb

Inspect the VDB structure of an .sra archive. Pure-Rust replacement for vdb-dump — no C FFI, no subprocess to sra-tools.

sracha vdb <SUBCOMMAND> <SOURCE> [OPTIONS]

<SOURCE> is a local .sra path, an https:// URL, or a run accession. Accessions and URLs are read in place over HTTP range requests — the archive is never downloaded. The table of contents is a file prefix and the column indexes are kilobytes, so inspecting a multi-gigabyte run transfers a few hundred KiB:

1
2
3
4
5
# ~1 s and ~256 KiB transferred against a 4.2 GB archive
sracha vdb info SRR18959644

# spot-check read structure without downloading anything
sracha vdb dump SRR18959644 -C READ_LEN,READ_TYPE -R 1,22228622

Pass -v to see how much was transferred. Only inspection works remotely; sracha fastq needs a local file, since decoding touches essentially every byte and would transfer the whole archive anyway.

Row ranges matter for remote dump

dump fetches only the blobs covering -R. Without -R it reads every selected column in full, which over the network means downloading them.

sracha vdb info

Print summary metadata: schema, platform, table row counts, load timestamp, and formatter / loader / update software events.

sracha vdb info <SOURCE> [--json]
Option Default Description
--json Emit a single JSON object instead of human-readable text

sracha vdb tables

List tables in the archive. Only meaningful for Database archives (cSRA / aligned); flat Tables print a note.

sracha vdb tables <SOURCE>

sracha vdb columns

List columns in a table.

sracha vdb columns <SOURCE> [-T TABLE] [-s]
Option Default Description
-T, --table <NAME> SEQUENCE (or first) Table to inspect
-s, --stats Show row counts, blob counts, and first-blob header stats per column

sracha vdb meta

Dump the metadata tree (schema / stats / LOAD / SOFTWARE nodes).

sracha vdb meta <SOURCE> [-T TABLE] [-P PATH] [-d DEPTH] [--db]
Option Default Description
-T, --table <NAME> SEQUENCE Table whose metadata tree to walk
-P, --path <PATH> Restrict to a sub-path like STATS/TABLE or LOAD
-d, --depth <N> Limit recursion depth below the chosen sub-path
--db Walk the database-level tree (root md/cur) instead of a table tree

sracha vdb schema

Print the embedded schema text.

sracha vdb schema <SOURCE>

sracha vdb id-range

Print the first row id and row count for a table/column.

sracha vdb id-range <SOURCE> [-T TABLE] [-C COLUMN]
Option Default Description
-T, --table <NAME> SEQUENCE (or first) Table to inspect
-C, --column <NAME> first alphabetically Column to read

sracha vdb dump

Dump row-level data for the chosen columns. Values are typed by a name-based heuristic (READ as bases, READ_LEN as an array, and so on); unrecognized columns render as hex.

-C READ renders the logical READ column — the 2na basecalls with the ALTREAD ambiguity mask applied — so ambiguous positions show as N and the output matches vdb-dump. Releases before 0.5.0 showed the physical column without the mask, which disagreed with vdb-dump wherever a submitter recorded an ambiguity.

sracha vdb dump <SOURCE> [-T TABLE] [-C COLUMNS] [-x COLUMNS] [-R ROWS] [-f FORMAT]
Option Default Description
-T, --table <NAME> SEQUENCE (or first) Table to dump from
-C, --columns <LIST> all known columns Comma-separated columns to include
-x, --exclude <LIST> Columns to drop, applied after -C
-R, --rows <RANGES> all rows Comma-separated, 1-indexed, inclusive: 5, 5-20, 100-, -50, 1-10,200
-f, --format <FMT> default default, csv, tab, or json (NDJSON)

Custom deflines

--seq-defline <TEMPLATE> (available on both sracha get and sracha fastq) replaces the built-in FASTQ/FASTA header with a template, using the same $-variable syntax as fasterq-dump's --seq-defline:

Variable Expands to
$ac Run accession (e.g. SRR12345678)
$si Spot id — 1-based row number
$ri Read id — 1-based read number within the spot
$sn Spot name from the NAME column (empty when the archive has none)
$rl Read length in bases
$lg The spot's LINKAGE_GROUP, e.g. a 10x CB:<barcode>-1\|UB:<UMI> (empty when the run has none)
$$ A literal $
1
2
3
4
# Match a fasterq-dump pipeline that used --seq-defline '@$ac.$si.$ri'
sracha get --seq-defline '@$ac.$si.$ri' --split split-files SRR12345678
#  -> @SRR12345678.1.1
#     @SRR12345678.1.2   (mate 2 of spot 1)

Notes:

  • A leading @ (or > for FASTA) is optional — it is stripped, and sracha adds the correct record prefix automatically.
  • The + (quality) line mirrors the sequence defline unless --qual-defline <TEMPLATE> is given. It takes the same variables; a leading + is optional and + alone writes a bare + line. Ignored with --fasta.
  • When a template is given, the split-spot/interleaved modes do not add their implicit <spot>/<mate> suffix — use $ri in the template to distinguish mates instead.
  • $sg (spot-group) is not supported; a template using it is rejected at startup. Reference-compressed (cSRA) archives have no NAME column, so $sn expands to empty there.

Notes on $lg:

  • $lg is read from bam-loaded (cSRA) archives, where LINKAGE_GROUP lives in PRIMARY_ALIGNMENT (or SEQUENCE.CMP_LINKAGE_GROUP for unaligned spots). Plain SRA runs have none, so it expands to empty. The column is only read when a template uses $lg.
  • To pull a 10x barcode out as its own file: sracha fastq --seq-defline '@$si $lg' SRR30022414.

Coming from sra-tools

How common fasterq-dump / fastq-dump options map to sracha:

sra-tools option sracha equivalent Notes
-O, --outdir <DIR> -O, --output-dir <DIR> Same
-e, --threads <N> -t, --threads <N> Decode + compression threads
--split-3 --split split-3 Default in both
--split-files --split split-files One file per read slot; skipped reads still consume their number. An archive storing a single read per spot writes a bare ACC.fastq, with no _1 suffix
--split-spot --split split-spot All reads of a spot in one file
--concatenate-reads / no split --split interleaved Single interleaved stream
-Z, --stdout -Z, --stdout Interleaved FASTQ to stdout
--fasta --fasta Drops quality
--seq-defline <FMT> --seq-defline <FMT> Common variables; see above
--include-technical --include-technical Technical reads skipped by default in both
-M, --min-read-len <N> --min-read-len <N> Same
-p, --progress (on by default) Disable with --no-progress
-t, --temp <DIR> (automatic) Temp files are managed internally
--qual-defline <FMT> --qual-defline <FMT> Same variables as --seq-defline; + alone writes a bare + line
--rowid-as-name (unsupported) Use --seq-defline with $si
gzip via external pipe --gzip-level / --zstd Compression is built in (gzip on by default)

sracha-only conveniences with no fasterq-dump equivalent: parallel chunked download, --prefer-ena, --metadata sidecars, --folder-per-accession, --zstd, and direct accession resolution from a study/BioProject.