aixport package
Submodules
aixport.basecmdtool module
- class aixport.basecmdtool.BaseCommandLineTool(theargs, provenance_utils=None)[source]
Bases:
objectBase class for all command line tools. Command line tools MUST subclass this
Constructor
- Parameters:
theargs (dict) – Arguments for tool. This tool expects the following values in the dict:
provenance_utils (
ProvenanceUtil) – Wrapper for fairscape-cli which is used for RO-Crate creation and population
- COMMAND = 'BaseCommandLineTool'
- static add_subparser(subparsers)[source]
Should add any argparse commandline arguments to subparsers passed in This must be implemented by subclasses and will always raise an error
- Parameters:
subparsers (argparse)
- Raises:
AIxPORTError – will always raise this
- Returns:
- run()[source]
Should contain logic that will be run by command line tool. This must be implemented by subclasses and will always raise an error
- Raises:
AIxPORTError – will always raise this
- Returns:
aixport.benchmark module
aixport.constants module
- aixport.constants.MODEL_PKL = 'model.pkl'
Name of model file using Python Pickle object structure
- aixport.constants.MODEL_PREFIX = 'model'
Prefix name of file containing trained model for algorithm
- aixport.constants.MODEL_PT = 'model.pt'
Name of model file using PyTorch object structure
- aixport.constants.OPTIMIZETRAIN_MODE = 'optimizetrain'
Value passed to –mode or self._theargs[‘mode’] that tells model to run optimize and then train mode
- aixport.constants.PREDICTIONS_DIRECTORY = 'predictions'
Name of directory where prediction results are written
- aixport.constants.PREDICT_MODE = 'predict'
Value passed to –mode or self._theargs[‘mode’] that tells model to run in test/predict mode this is the same as calling TEST_MODE
- aixport.constants.SUPPORTED_MODEL_FILES = ['model.pt', 'model.pkl']
All supported model file names
- aixport.constants.TEST_MODE = 'test'
Value passed to –mode or self._theargs[‘mode’] that tells model to run in test/predict mode this is the same as calling PREDICT_MODE
- aixport.constants.TRAINED_MODELS_DIRECTORY = 'trainedmodels'
Name of directory where trained models reside under the train RO-Crate
- aixport.constants.TRAIN_MODE = 'train'
Value passed to –mode or self._theargs[‘mode’] that tells model to run in train mode
- aixport.constants.TRAIN_PREDICTIONS = 'train_predictions.txt'
Name of file containing training predictions
aixport.aixportcmd module
aixport.evaluate module
aixport.exceptions module
aixport.pipeline module
- class aixport.pipeline.BenchmarkPipelineTool(theargs)[source]
Bases:
BaseCommandLineToolRuns benchmark Train step
- Parameters:
theargs
- COMMAND = 'benchmarkpipeline'
aixport.predict module
- class aixport.predict.AIxPORTPredictRunner(outdir=None, input_rocrates=None, trained_model_dirs=None, algorithms=None, algorithm_configs=None)[source]
Bases:
objectBase runner that materializes prediction jobs.
Constructor.
- class aixport.predict.BashPredictRunner(outdir=None, input_rocrates=None, trained_model_dirs=None, algorithms=None, algorithm_configs=None)[source]
Bases:
AIxPORTPredictRunnerEmits bash script to run predictions serially.
Constructor.
- class aixport.predict.PredictTool(theargs, provenance_utils=None)[source]
Bases:
BaseCommandLineToolRuns predictions using trained models.
- Parameters:
theargs (dict) – arguments
- COMMAND = 'predict'
- class aixport.predict.SLURMPredictRunner(outdir=None, input_rocrates=None, trained_model_dirs=None, algorithms=None, algorithm_configs=None)[source]
Bases:
AIxPORTPredictRunnerEmits SLURM scripts to run predictions on a cluster.
Constructor.
aixport.train module
- class aixport.train.BashTrainRunner(outdir=None, input_rocrates=None, algorithms=None, algorithm_configs=None, algorithm_rocrate_configs=None)[source]
Bases:
DRETrainRunnerRuns DREs via Bash script
Constructor
- class aixport.train.DRETrainRunner(outdir=None, input_rocrates=None, algorithms=None, algorithm_configs=None, algorithm_rocrate_configs=None)[source]
Bases:
objectDefines runner for invoking various Drug Recommender engines in Training mode
Constructor
- run()[source]
Abstract method to run the pipeline. This method should be implemented by subclasses.
- Raises:
NotImplementedError – If the subclass does not implement this method.
- class aixport.train.SLURMTrainRunner(outdir=None, input_rocrates=None, algorithms=None, algorithm_configs=None, algorithm_rocrate_configs=None)[source]
Bases:
DRETrainRunnerRuns DREs via SLURM
Constructor
aixport.rocratezipper module
- class aixport.rocratezipper.ROCrateZipper(directory_path: str, zip_path: str)[source]
Bases:
objectUtility for creating and inspecting ZIP archives built from RO-Crate directory trees.
Initialize with the directory to zip and the output zip file path.
- Parameters:
directory_path – Path to the directory to compress.
zip_path – Path where the ZIP archive will be written.
- extract_file(file_name: str, dest_path: str) None[source]
Extracts a specific file from the zip archive to the given destination.
- list_contents() List[str][source]
Returns a list of all file names and paths inside the zip archive.
- read_file(file_name: str) bytes[source]
Reads and returns the binary contents of a file inside the zip archive. Raises a FileNotFoundError if the file does not exist in the zip.
Module contents
Top-level package for Artificial Intelligence Predictive Oncology Research Toolkit.