Format-aware concordance reports for bioinformatics pipeline outputs.
Project description
biocompare
biocompare is a Python toolkit for comparing bioinformatics pipeline outputs
with semantic, format-aware metrics. Instead of only checking whether files are
byte-for-byte identical, it measures whether two runs agree in biologically or
analytically meaningful ways.
Project website: https://qchiujunhao.github.io/biocompare/
Status: alpha. The core comparison model and initial comparators are usable, but APIs and metrics may change as more bioinformatics formats and workflows are validated.
This repository currently implements the Phase 1 vertical slice:
- a shared
ConcordanceReportmodel - comparator registry with plugin entry point support
- file type detection for common bioinformatics and tabular formats
- a differential expression result comparator
- a count/expression matrix comparator
- a normalized expression matrix comparator
- a BED interval comparator
- a FASTA/FASTQ sequence comparator
- a lightweight VCF comparator with ALT splitting and minimal allele trimming
- a
samtools flagstat/samtools statscomparator - a generic CSV/TSV table comparator
- JSON/text report writers
- a command-line interface
- automated tests with
unittest
Quickstart
python3 -m biocompare compare tests/fixtures/table_a.tsv tests/fixtures/table_b.tsv --key gene_id
Write a report to disk:
python3 -m biocompare compare tests/fixtures/table_a.tsv tests/fixtures/table_b.tsv \
--key gene_id \
--output report.json
Compare differential expression tables:
python3 -m biocompare compare tests/fixtures/degs_tool_a.tsv tests/fixtures/degs_tool_b.tsv \
--type deg \
--alpha 0.05
Compare count matrices:
python3 -m biocompare compare tests/fixtures/counts_a.tsv tests/fixtures/counts_b.tsv \
--type counts
Compare normalized expression matrices:
python3 -m biocompare compare tests/fixtures/expression_tpm_a.tsv tests/fixtures/expression_tpm_b.tsv \
--type expression
Compare BED intervals:
python3 -m biocompare compare tests/fixtures/peaks_a.bed tests/fixtures/peaks_b.bed \
--type bed \
--min-reciprocal-overlap 0.5
Compare FASTA sequences:
python3 -m biocompare compare tests/fixtures/sequences_a.fa tests/fixtures/sequences_b.fa \
--type fasta
Compare VCF calls:
python3 -m biocompare compare tests/fixtures/calls_a.vcf tests/fixtures/calls_b.vcf \
--type vcf
Optionally provide a reference FASTA for simple repeated-indel left alignment:
python3 -m biocompare compare calls_a.vcf calls_b.vcf \
--type vcf \
--reference-fasta reference.fa
Compare alignment summary statistics:
python3 -m biocompare compare tests/fixtures/flagstat_a.txt tests/fixtures/flagstat_b.txt \
--type bam_stats
Run the tests:
python3 -m unittest discover -s tests
Install development tooling:
python3 -m pip install -e ".[dev]"
python3 -m ruff check .
python3 -m coverage run -m unittest discover -s tests
python3 -m coverage report
Run a batch comparison from a manifest:
python3 -m biocompare batch tests/fixtures/batch_manifest.tsv --format text
The manifest must contain file_a and file_b columns. Optional columns are
label and type.
Use --min-concordance in CI to fail when any comparison falls below a chosen
threshold:
python3 -m biocompare batch tests/fixtures/batch_manifest.tsv --min-concordance 0.95
Write an HTML report:
python3 -m biocompare compare tests/fixtures/peaks_a.bed tests/fixtures/peaks_b.bed \
--type bed \
--format html \
--output report.html
Batch reports also support --format html.
Plugin Model
Comparators subclass biocompare.comparators.base.Comparator and return a
biocompare.core.report.ConcordanceReport. Third-party packages can register
comparators with the biocompare.comparators entry point group.
Documentation
Additional documentation is available on the project website and in docs/,
including API notes, design rationale, and tutorials for regression testing,
RNA-seq outputs, variant calls, and BED peak comparisons.
Citation and Paper Draft
Citation metadata is available in CITATION.cff. A draft JOSS-style paper is
available under paper/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file biocompare-0.1.0.tar.gz.
File metadata
- Download URL: biocompare-0.1.0.tar.gz
- Upload date:
- Size: 37.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
129d03bc9e3bde25b846f77945799d957ac57dc2366be5f946b9a0e0bab7c083
|
|
| MD5 |
09b0cce5a0d39f7576c64ac8b57d1822
|
|
| BLAKE2b-256 |
75842d1736c91d21ad1ca8635ce9765bd7c89208f40f2b4de8c39300b37b66b3
|
Provenance
The following attestation bundles were made for biocompare-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on qchiujunhao/biocompare
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
biocompare-0.1.0.tar.gz -
Subject digest:
129d03bc9e3bde25b846f77945799d957ac57dc2366be5f946b9a0e0bab7c083 - Sigstore transparency entry: 1809951141
- Sigstore integration time:
-
Permalink:
qchiujunhao/biocompare@906574408876cc3353349262b2ec48d4a67dcb01 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/qchiujunhao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@906574408876cc3353349262b2ec48d4a67dcb01 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file biocompare-0.1.0-py3-none-any.whl.
File metadata
- Download URL: biocompare-0.1.0-py3-none-any.whl
- Upload date:
- Size: 42.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d06329009be532207e38c9cf0b71451e96ca8accd60018d116fe406c81b3543
|
|
| MD5 |
2bb16dbaa4e069e3dbf85c291d187d2f
|
|
| BLAKE2b-256 |
1f863aad1d51b1372046847d08e439f33708e2cb4b7086419d2ee1902fba8f72
|
Provenance
The following attestation bundles were made for biocompare-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on qchiujunhao/biocompare
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
biocompare-0.1.0-py3-none-any.whl -
Subject digest:
8d06329009be532207e38c9cf0b71451e96ca8accd60018d116fe406c81b3543 - Sigstore transparency entry: 1809951144
- Sigstore integration time:
-
Permalink:
qchiujunhao/biocompare@906574408876cc3353349262b2ec48d4a67dcb01 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/qchiujunhao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@906574408876cc3353349262b2ec48d4a67dcb01 -
Trigger Event:
workflow_dispatch
-
Statement type: