INNER CODE UNIT · Python

downsample

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

def downsample(
    input: Path = typer.Argument(..., help="Clonotype sample file."),
    size: int = typer.Argument(..., help="Target size (reads, or unique clonotypes with --clones)."),
    fmt: str = _FMT, out: Optional[Path] = _OUT,
    clones: bool = typer.Option(False, "--clones", help="Draw unique clonotypes, not reads."),
    seed: int = typer.Option(0, "--seed", help="Random seed for reproducible draws."),
) -> None:
    """Randomly down-sample a repertoire to a common depth (reads, or unique clonotypes)."""
    from vdjtools.io.batch import read
    from vdjtools.preprocess import downsample as _ds

    _write(_ds(read(input, fmt=fmt), size, by="clones" if clones else "reads", seed=seed), out)


@app.command(name="filter")
def filter_(
    input: Path = typer.Argument(..., help="Clonotype sample file."),
    fmt: str = _FMT, out: Optional[Path] = _OUT,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…