Skip to content

Repository files navigation

adata_science_tools

Documentation

Data-science tools that operate on AnnData objects.

Setup

Clone the repository

git clone https://github.com/gitbenlewis/adata_science_tools.git
cd adata_science_tools

Create the conda environment

conda env create -f config/env_not_base.yaml -n not_base
conda activate not_base

If not_base already exists, update it in place instead of deleting it:

conda env update -f config/env_not_base.yaml -n not_base

Run the self-contained plotting gallery

bash scripts/000_generate_plotting_gallery.bash

This regenerates the deterministic PNG catalog in docs/assets/plotting_gallery and writes its run log under scripts/logs/.

Simulated data example

The repo includes a small config-driven simulated-data workflow in example_simulated_data/. Its config.yaml uses repository-relative output paths, so the commands below are portable when run from the repository root. Outputs resolve under example_simulated_data/results/.

conda activate not_base
python example_simulated_data/scripts/simulate_1_var_covar_age.py
python example_simulated_data/scripts/plot_dotplot_simulate_1_var_covar_age.py

The default parameters simulate one feature, simulated_feature, from Age and case_control, add residual y variance so the points are not constrained to exact fit lines, and write both a baseline AnnData bundle and a dotplot.

The main example knobs are beta or beta_age, beta_case_control, case_control_prob, and residual_stdev.

See docs/_simulate_data.md for the simulation API and config details, and docs/_corr_dotplots.md for the plotting API.

Committed output snapshots: baseline.h5ad and baseline.png.

baseline simulated dotplot

Paired datapoints examples

adtl.paired_datapoints() can add a third x-axis position for either the signed post-baseline difference or log2(post / baseline). The secondary y-axis is symmetric around zero in both modes.

Raw post-baseline difference

Paired datapoints with raw post-baseline differences

Opt-in legend metrics can summarize the finite post-filter values at baseline, post, and the raw pairwise post - baseline position.

Paired datapoints with raw post-baseline differences and per-position summary legend

Post-over-baseline log2 fold change

Paired datapoints with post-over-baseline log2 fold changes

The log2FC summary uses valid pairwise log2(post / baseline) values rather than a fold change calculated from the endpoint means.

Paired datapoints with post-over-baseline log2 fold changes and per-position summary legend

Example plots from example_PMID_33969320

These are committed output snapshots from a dataset-specific workflow, not a fresh-clone runnable example. The workflow expects external study data and a code_library checkout that are not included in this repository.

Column plot

API: adtl.datapoints_effect_panels_column() (source)

View plot file COVID versus non-COVID day-zero distributions with a log2 fold-change effect panel

Volcano plot

API: adtl.volcano_plot_generic()

View plot file COVID versus non-COVID day-zero volcano plot

About

data science tools that operate on anndata objects

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages