Usage
This page should provide information on how to use aixport
In a project
To use Artificial Intelligence Predictive Oncology Research Toolkit in a project:
import aixport
On the command line
For information invoke aixportcmd.py -h
Example usage
Training
$ aixportcmd.py train trainout --input input_train.txt --algorithms elasticnet_drecmd.py --run_mode bash
input_train.txt should contain absolute paths to *_train_rocrate directories,
one per line. The command will populate trainout with bash script that populates trainout/trainedmodels with per-algorithm
trained model directories. Then run the bash script:
./trainout/bash_train_job.sh
Prediction
$ aixportcmd.py predict predictout --input input_test.txt --trainedmodels trainout/trainedmodels --algorithms elasticnet_drecmd.py --run_mode bash
input_test.txt should list the *_test_rocrate directories with test data, and
trainout/trainedmodels should contain subdirectories named
<drugname>_train_rocrate_<algorithm> produced by the training step. Then run the bash script:
./predictout/bash_predict_job.sh
Benchmark
$ aixportcmd.py benchmark benchmarkout \
--input_test_rocrates input_test.txt \
--predictions_rocrate predictout
input_test.txt should match the file used during prediction and list the test
RO-Crates, one per line. predictout should be the prediction RO-Crate folder produced
by aixportcmd.py predict (or the pipeline), containing the predictions subdirectory.
The benchmark command creates benchmarkout (must not already exist), computes
Pearson/Spearman correlations between predictions and ground truth, writes results.csv,
and generates results.png/results.svg for quick inspection.
Custom RO-Crate pipeline
$ bash scripts/run_custom_dataset.sh \
--rocrates-dir /path/to/rocrates \
--output-dir /path/to/custom_run \
--model-config configs/custom_dataset_models.json
The --rocrates-dir input must already contain per-drug
*_train_rocrate and *_test_rocrate folders.
By default, the script installs aixport and the enabled model packages
with their declared Python dependencies before running. Use --skip-install
only when the environment is already prepared.
The model config JSON supports:
enabledto turn a model on or offoptimizeto control per-model hyperparameter optimizationinstall_pathto install a custom model repo before running
Via Docker
Example usage
TODO: Add information about example usage
Coming soon ...
RO-Crate Zipping Utility
The ROCrateZipper helper can bundle an entire RO-Crate directory into a ZIP archive and inspect or extract its contents. This is useful for publishing or sharing generated RO-Crates.
Example usage
from aixport import ROCrateZipper
zipper = ROCrateZipper("/path/to/folder", "/path/to/output.zip")
zipper.zip_directory()
print(zipper.list_contents()) # View all files in the zip
data = zipper.read_file("subfolder/data.txt") # Access a specific file
zipper.extract_file("subfolder/data.txt", "/tmp/extracted/") # Extract one file