INNER CODE UNIT · Python

_parse_components

antigenomics/vdjtools · python/vdjtools/cli/__init__.py:634

def _parse_components(spec: Optional[str]):
    """``None``, an int count, or a float variance fraction -- whichever the string spells."""
    if spec is None:
        return None
    try:
        return int(spec) if "." not in spec else float(spec)
    except ValueError:
        _err(f"--components must be an integer count or a fraction in (0, 1); got {spec!r}")


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. "

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…