shiba2corr
Quantify the reproducibility of differentially spliced events between two Shiba experiments via a weighted Pearson correlation of dPSI values, computed on the union of differentially spliced events (DSEs) and weighted by the reliability of each PSI estimate.
Overview
Two Shiba runs (a Target condition and a Reference condition) produce
per-event PSI tables. A naive Pearson correlation of their dPSI values
overweights noisy events with low junction coverage. shiba2corr instead
computes a weighted Pearson correlation on the union of DSEs from both
runs, where the weight of each event reflects how precisely its PSI was
estimated in each condition.
Weighted correlation:
$$r_w = \frac{\mathrm{Cov}_w(x, y)}{\sqrt{\mathrm{Var}_w(x)\ \mathrm{Var}_w(y)}}$$
with unbiased weighted estimators
$$\bar{x}_w = \frac{\sum w_i x_i}{\sum w_i},\quad \mathrm{Cov}_w(x,y) = \frac{\sum w_i (x_i - \bar{x}_w)(y_i - \bar{y}_w)}{\sum w_i - \frac{\sum w_i^2}{\sum w_i}}$$
and significance assessed via a t-test on the Kish effective sample size
$$n_{\text{eff}} = \frac{(\sum w_i)^2}{\sum w_i^2}.$$
| Weight scheme | $w_i$ | Use when |
|---|---|---|
inverse_variance (default) |
$1 / (\mathrm{Var}(\mathrm{PSI}_{\mathrm{tgt}}) + \mathrm{Var}(\mathrm{PSI}_{\mathrm{ref}}) + \varepsilon)$ | Beta-derived PSI variances are reliable |
geom_mean |
$\sqrt{\mathrm{cov}_{\mathrm{tgt}} \cdot \mathrm{cov}_{\mathrm{ref}}}$ | Coverage is the only confidence proxy |
coverage_mean |
$\tfrac{1}{2}(\mathrm{cov}_{\mathrm{tgt}} + \mathrm{cov}_{\mathrm{ref}})$ | One condition may have low coverage |
uniform |
$1$ | Sanity-check vs. unweighted Pearson |
In addition to the correlation table, shiba2corr produces:
- per-event-type KDE-coloured scatter plots of Target vs Reference dPSI;
- DSE overlap Venn diagrams (Target vs Reference, split by dPSI direction) for each event type and a combined grid.
Installation
pip install shiba2corr
For development:
git clone https://github.com/Sika-Zheng-Lab/shiba2corr.git
cd shiba2corr
pip install -e ".[dev]"
Usage
Quick start with example data
A small synthetic Shiba result pair is included in example/:
shiba2corr \
-t example/target \
-r example/reference \
-o example/output
Basic usage
shiba2corr -t target_shiba_dir -r reference_shiba_dir -o output/
Filter DSEs by t-test P-value
If Shiba was run with t-tests enabled (column p_ttest present in the PSI
files), restrict the analysis to events that also pass a P-value threshold:
shiba2corr -t target/ -r reference/ -o output/ --ttest 0.05
Choose a different weighting scheme
shiba2corr -t target/ -r reference/ -o output/ --weight-scheme geom_mean
Custom colors and font
shiba2corr -t target/ -r reference/ -o output/ \
--target-color "#FF0000FF" \
--reference-color "#00008BFF" \
--font-family Arial
Skip Venn diagrams
shiba2corr -t target/ -r reference/ -o output/ --no-venn
Input File Format
-t / -r accept the path to a Shiba working directory. Within each
directory, shiba2corr reads:
<shiba_dir>/results/splicing/PSI_SE.txt
<shiba_dir>/results/splicing/PSI_FIVE.txt
<shiba_dir>/results/splicing/PSI_THREE.txt
<shiba_dir>/results/splicing/PSI_MXE.txt
<shiba_dir>/results/splicing/PSI_RI.txt
<shiba_dir>/results/splicing/PSI_MSE.txt
<shiba_dir>/results/splicing/PSI_AFE.txt
<shiba_dir>/results/splicing/PSI_ALE.txt
Each PSI table is a tab-separated file with at least the following columns:
| Column | Description |
|---|---|
pos_id |
Unique event ID (matched across conditions) |
dPSI |
Delta PSI vs. control samples |
ref_PSI, alt_PSI |
PSI values used to compute dPSI |
ref_junction*, alt_junction* |
Per-sample junction read counts (semicolon-delimited; one column per replicate) |
Diff events |
Yes / No, marking DSEs |
p_ttest (optional) |
T-test P-value; required only with --ttest |
Missing event-type files are skipped with a warning.
-l/--event-list (optional)
A plain-text file with one pos_id per line. When provided, the weighted
correlation is restricted to the intersection of the union DSE set and this
list.
Output Files
Given -o output/:
| File | Description |
|---|---|
results/event_dpsi_weighted_correlation.tsv |
Per-event-type summary (n_union, n_used, r, p_value_approx, neff) |
results/weighted_correlation_scatter_{TYPE}.tsv |
Per-event-type per-event scatter data (pos_id, dPSI values, weights) |
plots/png/weighted_correlation_scatter_{TYPE}.png |
KDE-coloured scatter plot (also .pdf under plots/pdf/) |
plots/png/dse_venn_{TYPE}_{up,down}.png |
DSE overlap Venn diagram per event type and direction |
plots/png/dse_venn_grid_{up,down}.png |
Combined Venn diagram grid per direction |
report.json |
Machine-readable run summary (version, timestamp, command line) |
TYPE is one of SE, FIVE, THREE, MXE, RI, MSE, AFE, ALE,
or all (aggregated across event types). --no-venn skips all DSE overlap
Venn output.
CLI Options
| Option | Description |
|---|---|
-v, --version |
Show version and exit |
-t, --target |
Target Shiba working directory (required) |
-r, --reference |
Reference Shiba working directory (required) |
-o, --output |
Output directory (required) |
-l, --event-list |
Restrict analysis to events listed in this file (optional) |
--weight-scheme |
inverse_variance (default), geom_mean, coverage_mean, uniform |
--min-events |
Minimum effective sample size for the t-test p-value (default: 3) |
--ttest |
Filter DSEs by t-test P-value threshold (requires p_ttest column) |
--target-color |
Hex color for Target DSEs in Venn diagrams |
--reference-color |
Hex color for Reference DSEs in Venn diagrams |
--font-family |
Font family for plot text (e.g. Arial) |
--no-venn |
Skip the DSE overlap Venn diagrams |
--verbose |
Enable DEBUG-level logging |
License
MIT License
Citation
If you use shiba2corr in your research, please cite this repository.
Contributing
Thank you for wanting to improve shiba2corr! If you have any bugs or questions, feel free to open an issue or pull request. See CONTRIBUTING.md for the development workflow and release process.
Authors
- Naoto Kubota (0000-0003-0612-2300)
- Sika Zheng (0000-0002-0573-4981)
Release files for shiba2corr 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shiba2corr-1.0.0.tar.gz | 25.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shiba2corr-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.6 kB
Release files / shiba2corr-1.0.0.tar.gz
| Download URL | shiba2corr-1.0.0.tar.gz |
|---|---|
| Size | 25.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47f5f71e2d426b7f336564ed6dffc1cbebf776061e2ee7aba210e4144c351bf2
|
|
BLAKE2b-256 checksum How to use checksums |
6857018f5646571a4069822ef9b7be5cdf22a037113edbc659bd5ff27cc74c13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency logRelease files / shiba2corr-1.0.0-py3-none-any.whl
| Download URL | shiba2corr-1.0.0-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92d021eabd48495db9a850d2f597554d0771feb0a7c3ad9bb2a1c53da2d8c8e9
|
|
BLAKE2b-256 checksum How to use checksums |
f6d33e8b256d0abbc26d050fe7d8760b8830ea7f76a811a99836f2e09ecfbc28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency log