XgenePy is a Python port of the XgeneR package for modeling cis and trans
regulatory differences between homozygous strains. It mirrors the core XgeneR
workflow while replacing the R edgeR dependency with the Python
edgepython package.
The package centers on:
- building the same allele-aware design matrices used by
XgeneR - fitting negative binomial GLMs with
edgepython - testing cis and trans hypotheses
- generating the same assignment and proportion-cis summaries
- producing diagnostic plots in matplotlib
Create the conda environment:
conda env create -f environment.yaml
conda activate xgenepyThen install the package in editable mode:
pip install -e .import pandas as pd
from xgenepy import FitObject, fit_edgepython, get_assignments_and_plot
counts = pd.read_csv("../XgeneR/inst/extdata/BATcold_ballinger_counts.csv", index_col=0)
metadata = pd.read_csv("../XgeneR/inst/extdata/BATcold_ballinger_metadata.csv", index_col=0)
fit_obj = FitObject(counts=counts, metadata=metadata, trans_model="log_additive")
fit_obj = fit_edgepython(fit_obj)
results = get_assignments_and_plot(fit_obj, make_plot=False)
print(results.dataframe.head())src/xgenepy/model.py: model construction, design matrices, contrasts, and fittingsrc/xgenepy/plotting.py: plotting and assignment helpersdata/: copied example datasets fromXgeneR, includingBATcold,cold, and full Ballinger filesnotebooks/: Jupyter notebook equivalents of theXgeneRvignettestests/: pytest coverage for design and fitting smoke testsscripts/: example script for running the BATcold dataset