INNER CODE UNIT · Python
_resolve_corpus
antigenomics/vdjtools · python/vdjtools/cli/__init__.py:644
def _resolve_corpus(name: str):
"""A bundled corpus name, or a path to an artifact."""
from vdjtools.signature.corpus import Corpus, bundled_path
path = bundled_path(name)
if path is None:
have = _bundled_names()
_err(f"no corpus named {name!r}, and no artifact at that path. "
+ (f"Installed: {', '.join(have)}. " if have else
"No corpus ships with this version yet. ")
+ "Build one with: vdjtools corpus --corpus naive --smoke -o naive.npz")
try:
return Corpus.load(path)
except FileNotFoundError:
_err(f"corpus artifact {path} is missing its .json sidecar")
except ValueError as e:
_err(str(e))