Skip to main content

demultiplexer3

A Python CLI tool for demultiplexing paired-end Illumina sequencing reads using inline tags. Successor to demultiplexer2.

Key improvements over demultiplexer2

  • Output-oriented parallelism — workers write individual samples as soon as parsing is done, instead of blocking on the largest input file.
  • Cross-product tag validation — forward and reverse tags are checked jointly (concatenated Levenshtein distance), eliminating the infinite-loop risk of separate checks.
  • Configurable minimum distance (--min_dist) and optional tag trimming (--trim).
  • DAG-based scheduler using concurrent.futures.ProcessPoolExecutor with dynamic job submission.
  • Parquet intermediate format with sample identity classified once at parse time, for fast columnar filtering downstream.

Installation

pip install demultiplexer3

Dependencies

  • biopython
  • pandas
  • openpyxl
  • pyarrow
  • duckdb
  • psutil
  • tqdm
  • isal (faster gzip via Intel ISA-L; falls back to stdlib gzip if unavailable)

Usage

1. Create a primerset

demultiplexer3 create_primerset --name <name> --n_primers <n>

Creates an Excel file with three sheets (general_information, forward_tags, reverse_tags) for the user to fill in primer sequences and tag names/sequences. IUPAC ambiguity codes are supported. Saved as <name>_primerset.xlsx in the current working directory (same as the tagging scheme below).

2. Create a tagging scheme

demultiplexer3 create_tagging_scheme --name <name> --data_dir <dir> --primerset_path <path>

Scans data_dir for .fastq.gz file pairs, loads the primerset, and interactively asks which tag combinations were used. Produces a tagging scheme Excel file where sample names are filled in by the user.

3. Demultiplex

demultiplexer3 demultiplex --primerset_path <path> --tagging_scheme_path <path> --output_dir <dir> [--workers <n>] [--min_dist <d>] [--trim]
Parameter Description Default
--primerset_path Path to the primerset Excel file required
--tagging_scheme_path Path to the tagging scheme Excel file required
--output_dir Directory for output FASTQ files required
--workers Number of parallel workers physical cores − 2
--min_dist Minimum Levenshtein distance between tag combinations 2
--trim Remove original tag sequences from the start of each read off

How it works

  1. Tag validation & extension — Tags are equalized to the same length, IUPAC codes are expanded, and the cross-product of all (fwd+rev) combinations is checked for minimum Levenshtein distance. If the distance is too low, tags are extended base-by-base from the primer sequence.

  2. Parse phase — Each input FASTQ pair is read with BioPython's FastqGeneralIterator. The first N bases of each read are extracted as the tag and classified against that input's known tag combinations right away, storing the result as an integer sample index. All data is written to an lz4-compressed Parquet file (a purely transient intermediate — compression here favors speed over ratio).

  3. Write phase — For each sample, DuckDB filters the Parquet file on that integer index and writes matching reads in batches to gzipped FASTQ output files.

  4. Cleanup — Parquet files are deleted once all downstream write jobs for them complete. Unmatched reads are aggregated into unmatched_logfile.xlsx, keeping only the highest-count combinations per input file (the long tail of near-random spacer variants carries no diagnostic value).

License

MIT

Metadata

Release files for demultiplexer3 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for demultiplexer3 1.0.1
File Size Uploaded Provenance Actions
demultiplexer3-1.0.1.tar.gz 33.5 kB Without provenance Details for demultiplexer3-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for demultiplexer3 1.0.1
File Interpreter ABI Platform Actions
demultiplexer3-1.0.1-py3-none-any.whl Python 3 none any Details for demultiplexer3-1.0.1-py3-none-any.whl

Total release size: 62.6 kB

Release files / demultiplexer3-1.0.1.tar.gz

Download URL demultiplexer3-1.0.1.tar.gz
Size 33.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5b7aafa67abbdaeda83869b6cb6b48fb6d672fd1a3c024abc806625d60125959
BLAKE2b-256 checksum
How to use checksums
c6f2dd964016c6182be35ed54ccf8281a8885e5b7368e163a8c5bb5984da33c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Release files / demultiplexer3-1.0.1-py3-none-any.whl

Download URL demultiplexer3-1.0.1-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc8807c69f0b265f48423606cd924af05bfd7313036d6be5dff551a308c39531
BLAKE2b-256 checksum
How to use checksums
2710dfcc426af355b22cc84f8759c723efd0c919ac6bfee52a4e988203ebbe5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.2

Security for demultiplexer3 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page