API Reference
- class terrier.apps.CheckpointVersion(version: str, url: str, description: str, aliases: tuple[str, ...] = ())
A released version of the Terrier model weights.
- class terrier.apps.Terrier(**kwargs)
Transposable Element Repeat Result classifIER
- add_short_sequences(results_df: pd.DataFrame) pd.DataFrame
Adds a row to the results for each sequence that was skipped because it is shorter than the minimum length.
This means that the CSV files have a row for every sequence in the input, in the original order. The rows for the skipped sequences have an ‘Unknown’ prediction and no probabilities.
- bibliography = Method(func=<function TorchApp.bibliography>, methods_to_call=[], main=False, tool=False, flag=True, shortcut='', signature_ready=False)
- bibtex = Method(func=<function TorchApp.bibtex>, methods_to_call=[], main=False, tool=False, flag=True, shortcut='', signature_ready=False)
- cache_dir() Path
Returns a directory under the user’s cache folder for storing downloads, e.g. ~/.cache/torchapps/<AppName>/.
- callbacks = Method(func=<function TorchApp.callbacks>, methods_to_call=('extra_callbacks', 'checkpoint_callback'), main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- checkpoint = Method(func=<function Terrier.checkpoint>, methods_to_call=[], main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- checkpoint_callback = Method(func=<function TorchApp.checkpoint_callback>, methods_to_call=('monitor', 'goal'), main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- comparison_plot = Method(func=<function Terrier.comparison_plot>, methods_to_call=[], main=False, tool=True, flag=False, shortcut='', signature_ready=False)
- data = Method(func=<function Terrier.data>, methods_to_call=('super',), main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- extra_callbacks = Method(func=<function TorchApp.extra_callbacks>, methods_to_call=[], main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- extra_hyperparameters = Method(func=<function Corgi.extra_hyperparameters>, methods_to_call=[], main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- find_fasta_paths(files: list[str]) list[Path]
Finds the FASTA files to classify.
- Parameters:
files (list[str]) – Paths or URLs of files or directories.
- Returns:
The paths of the FASTA files.
- Return type:
list[Path]
- find_input_paths(files: list[str], base_extensions: set[str] | None = None) list[Path]
Finds the sequence files to classify.
Directories are searched recursively for files with a recognised sequence file extension (optionally gzipped).
- Parameters:
files (list[str]) – Paths or URLs of files or directories.
base_extensions (set[str] | None) – The file extensions to accept. If not given, then the extensions for FASTA, GenBank, tabular and FASTQ files are used.
- Returns:
The paths of the matching files.
- Return type:
list[Path]
- lightning_module = Method(func=<function TorchApp.lightning_module>, methods_to_call=('model', 'loss_function', 'extra_hyperparameters', 'input_count', 'metrics', 'module_class'), main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- load_checkpoint = Method(func=<function TorchApp.load_checkpoint>, methods_to_call=('checkpoint',), main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- loss_function = Method(func=<function Corgi.loss_function>, methods_to_call=[], main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- metrics = Method(func=<function Terrier.metrics>, methods_to_call=[], main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- model = Method(func=<function Corgi.model>, methods_to_call=('module_class', 'checkpoint'), main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- module_class = Method(func=<function Corgi.module_class>, methods_to_call=[], main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- monitor = Method(func=<function Terrier.monitor>, methods_to_call=[], main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- node_to_str(node: SoftmaxNode) str
Converts the node to a string
- one_batch = Method(func=<function TorchApp.one_batch>, methods_to_call=('setup_and_data',), main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- one_batch_loss = Method(func=<function TorchApp.one_batch_loss>, methods_to_call=('one_batch', 'lightning_module'), main=False, tool=True, flag=False, shortcut='', signature_ready=False)
- one_batch_output_size = Method(func=<function TorchApp.one_batch_output_size>, methods_to_call=('setup_and_data', 'lightning_module'), main=False, tool=True, flag=False, shortcut='', signature_ready=False)
- one_batch_size = Method(func=<function TorchApp.one_batch_size>, methods_to_call=('one_batch',), main=False, tool=True, flag=False, shortcut='', signature_ready=False)
- output_results = Method(func=<function Terrier.output_results>, methods_to_call=[], main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- package_name() str
Returns the name of the package.
- predict = Method(func=<function TorchApp.predict>, methods_to_call=('load_checkpoint', 'prediction_trainer', 'prediction_dataloader', 'output_results'), main=True, tool=True, flag=False, shortcut='', signature_ready=False)
- prediction_dataloader = Method(func=<function Corgi.prediction_dataloader>, methods_to_call=[], main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- prediction_trainer = Method(func=<function TorchApp.prediction_trainer>, methods_to_call=[], main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- process_location(location: str, reload: bool = False) Path
Turn a URL or filesystem path into a Path that points to a local file. If it’s a URL, download (and cache) via cached_download().
- profiler = Method(func=<function TorchApp.profiler>, methods_to_call=[], main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- refseq_to_seqtree = Method(func=<function Corgi.refseq_to_seqtree>, methods_to_call=[], main=False, tool=True, flag=False, shortcut='', signature_ready=False)
- setup_and_data = Method(func=<function TorchApp.setup_and_data>, methods_to_call=('setup', 'data', 'validation_dataloader'), main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- train = Method(func=<function TorchApp.train>, methods_to_call=('setup_and_data', 'validation_dataloader', 'lightning_module', 'trainer'), main=False, tool=True, flag=False, shortcut='', signature_ready=False)
- trainer = Method(func=<function TorchApp.trainer>, methods_to_call=('callbacks', 'profiler', 'project_name'), main=False, tool=False, flag=False, shortcut='', signature_ready=False)
- tune = Method(func=<function TorchApp.tune>, methods_to_call=('train', 'project_name'), main=False, tool=True, flag=False, shortcut='', signature_ready=False)
- tuning_params()
Inspect the signature of self.tune(…) and return a dict of only those Param() arguments where Param.tune == True. (So that an external tuner can see which hyperparameters are tunable.)
- validate = Method(func=<function TorchApp.validate>, methods_to_call=('setup_and_data', 'load_checkpoint', 'trainer'), main=False, tool=True, flag=False, shortcut='', signature_ready=False)
- version = Method(func=<function TorchApp.version>, methods_to_call=(), main=False, tool=False, flag=True, shortcut='-v', signature_ready=False)
- terrier.apps.checkpoint_names() list[str]
All the names that can be given to the –checkpoint option.
- terrier.apps.get_original_classification(original_id: str) str
The classification in a sequence ID of the form ‘accession#classification’.
- terrier.apps.resolve_checkpoint_version(name: str) CheckpointVersion | None
The checkpoint version for a version number or alias, or None if the name is not known.