Code and data for the paper p-adic Bi-Filtrations for Topological Machine Learning on Genomic Sequences.
Overview of the pVR pipeline. The figure is adapted from Figure 3 of the paper.
The code uses D_H for the compositional distance matrix (L1 distance on
k-mer frequency vectors); the paper denotes this D_c. Same object.
A full conda environment is given in pvr_env.yml, but it includes many
extra packages. Minimally, the pipeline needs:
numpy, scipy, scikit-learn, xgboost, gudhi, joblib, biopython, pandas.
The Nucleotide Transformer comparison (nt_compare.py) additionally needs
torch, transformers, and umap-learn. Plotting needs matplotlib.
GUDHI is easiest via conda: conda install -c conda-forge gudhi.
The benchmark sequences and labels are included under data/ (low-sample)
and data_large/ (large-sample). To rebuild them from NCBI instead, see
download_data.py and download_large.py (an NCBI Entrez email is required).
Full pipeline (main results, ablations, sensitivity) on each regime:
python run_full_eff.py --datadir data/ --outdir results/
python run_full_eff.py --datadir data_large/ --outdir results_large/ --skip_sensitivityEach dataset completes in seconds on a 12-core CPU; no GPU is needed.
python make_tables_ci.py --small results/all_results.json \
--large results_large/all_results.json --out tables_ci.tex
python make_aux_tables.py --small_results results/all_results.json \
--large_results results_large/all_results.json \
--small_data data/ --large_data data_large/Precomputed results are in results/all_results.json and
results_large/all_results.json.
pvr_eff.py— core method (encoding, distances, bi-filtration, classification)baselines.py— FFP-JS, NVM, MinHash baselinesrun_full_eff.py— full experiment pipelinent_compare.py— Nucleotide Transformer v2 comparisonmake_tables_ci.py,make_aux_tables.py— regenerate paper tablesplot_results.py,make_figure.py— figuresdownload_data.py,download_large.py— NCBI data acquisition
If you use this code or data, please cite our paper:
@article{dash2026pvr,
title = {$p$-adic Bi-Filtrations for Topological Machine Learning on Genomic Sequences},
author = {Dash, Tirtharaj and Sachdeva, Gunja},
journal = {arXiv preprint arXiv:2606.06117},
year = {2026},
doi = {10.48550/arXiv.2606.06117}
}