LiquidSig — Cell-free RNA signatures¶
Features¶
Deconvolute cfRNA data
Derive tissue & organ-specific signatures
For early malignancy detection & MRD
For predicting tissue of origin
For identification of end-organ damage (e.g., in sepsis)
Requirements¶
Python 3.10+
Quantified transcripts (from cfRNA)
Installation¶
You can install Liquidsig via pip from PyPI:
pip install liquidsig
Usage¶
Please see the [Reference Guide] for details.
Experiment Tracking with Weights & Biases (Optional)¶
LiquidSig supports experiment tracking with Weights & Biases (wandb) when using the transformer deconvolution method. This allows you to:
Monitor training progress in real-time
Track hyperparameters and metrics
Compare different runs
Save and version model artifacts
Setting up Wandb¶
Create a wandb account at https://wandb.ai
Install wandb (if not already installed):
pip install wandb
Configure authentication using one of these methods:
Option A: Environment variable (recommended for scripts/CI)
export WANDB_API_KEY=your_api_key_here
Option B: Interactive login
wandb loginYou can find your API key at: https://wandb.ai/authorize
Using Wandb with LiquidSig¶
Enable wandb tracking by adding the --use-wandb flag:
# Basic usage with wandb
liquidsig --transcript-quants sample.sf --deconv-method transformer --use-wandb
# Specify custom project name
liquidsig --transcript-quants sample.sf --deconv-method transformer --use-wandb --wandb-project my-project
# Evaluation mode with wandb
liquidsig --evaluation-mode --mixed-samples mixed.h5ad --deconv-method transformer --use-wandb
What Gets Tracked¶
When wandb is enabled, LiquidSig automatically logs:
Model architecture: Parameters, layer sizes, device info
Training metrics: Loss curves, learning rate changes
Hyperparameters: All model and training parameters
Model artifacts: Trained model files for reproducibility
System info: Hardware, environment details
Viewing Results¶
After starting a run with wandb enabled, you can:
View real-time progress at the URL shown in the logs
Access your dashboard at https://wandb.ai
Compare runs across different hyperparameters
Download model artifacts for later use
Troubleshooting¶
If you encounter wandb issues:
API key errors: Ensure
WANDB_API_KEYis set or runwandb loginNetwork issues: wandb will gracefully disable if connection fails
Disable wandb: Simply omit the
--use-wandbflag to run without tracking
Hyperparameter Tuning¶
LiquidSig includes built-in hyperparameter optimization via liquidsig tune:
# Single-machine tuning with W&B Bayesian sweeps
liquidsig tune --tuner wandb \
--architecture sparse-cross-attention \
--tissue-archetypes path/to/tissue-archetypes.h5ad \
--cell-archetypes path/to/cell-archetypes.h5ad \
--eval-metric cell_conditional_loss \
--sweep-runs 20
SLURM Parallel Workflow¶
For cluster environments, use --create-only to create a sweep then run parallel agents:
# 1. Create sweep (returns sweep ID)
liquidsig tune --tuner wandb ... --create-only
# 2. Launch parallel agents on SLURM
sbatch --export=SWEEP_ID=<your-sweep-id> slurm-sweep-agent.slurm
# 3. Train best model after sweep completes
liquidsig tune --tuner wandb --resume-sweep <sweep-id> --train-best \
--best-model-output-path models/best-model.model
Eval Metrics¶
val_loss(default): Overall validation losscell_conditional_loss: Cell-level deconvolution performance (recommended for optimizing cell-type predictions)
Contributing¶
Contributions are very welcome. To learn more, see the Contributor Guide.
License¶
For non-commercial use only. Copyright © Nick Semenkovich & Medical College of Wisconsin 2024-2025
Issues¶
If you encounter any problems, please file an issue along with a detailed description.
Credits¶
This project was generated from Statistics Norway’s SSB PyPI Template.