Command line

ecotyper-py mirrors the R wrapper scripts and writes the same output folder layout, so it can replace Rscript EcoTyper_*.R in existing pipelines. Unlike the R scripts, it takes options on the command line rather than in a YAML config file.

Command

R script

Tutorial

recover-bulk

EcoTyper_recovery_bulk.R

1

recover-scrna

EcoTyper_recovery_scRNA.R

2

recover-visium

EcoTyper_recovery_visium.R (precomputed fractions)

3

discover

EcoTyper_discovery_bulk.R (from CIBERSORTx HiRes profiles), EcoTyper_discovery_presorted.R

4, 6

discover-scrna

EcoTyper_discovery_scRNA.R

5

-t/--threads sets the number of parallel processes (R: Number of threads). Set OMP_NUM_THREADS=1 so that BLAS does not oversubscribe the cores.

ecotyper-py

usage: ecotyper-py [-h]
                   {recover-bulk,recover-scrna,recover-visium,discover,discover-scrna}
                   ...

Python port of EcoTyper (R-exact).

positional arguments:
  {recover-bulk,recover-scrna,recover-visium,discover,discover-scrna}
    recover-bulk        EcoTyper_recovery_bulk.R
    recover-scrna       EcoTyper_recovery_scRNA.R
    recover-visium      EcoTyper_recovery_visium.R (precomputed fractions)
    discover            discovery from purified/presorted profiles (bulk
                        downstream of CSx, presorted)
    discover-scrna      EcoTyper_discovery_scRNA.R

options:
  -h, --help            show this help message and exit

recover-bulk

usage: ecotyper-py recover-bulk [-h] -m MATRIX [-a ANNOTATION] [-d DISCOVERY]
                                [--models MODELS] [-o OUTPUT] [-t THREADS]
                                [--seed SEED] [--fast]

options:
  -h, --help            show this help message and exit
  -m MATRIX, --matrix MATRIX
  -a ANNOTATION, --annotation ANNOTATION
  -d DISCOVERY, --discovery DISCOVERY
                        model: a built-in name (Carcinoma, Lymphoma), a model
                        folder saved with EcoTyperModel.save, or a discovery
                        name under --models
  --models MODELS       folder containing <discovery>/<discovery>_Fractions
                        models (e.g. the 'EcoTyper' folder of the R
                        repository); default: built-in models, downloaded on
                        first use
  -o OUTPUT, --output OUTPUT
  -t THREADS, --threads THREADS
  --seed SEED           seed for NMFpredict's random initialisation
  --fast                fast mode (exact=False): BLAS NMF updates, not bit-
                        identical to R

recover-scrna

usage: ecotyper-py recover-scrna [-h] -m MATRIX -a ANNOTATION [-s SUBSAMPLE]
                                 [-d DISCOVERY] [--models MODELS] [-o OUTPUT]
                                 [-t THREADS] [--seed SEED] [--fast]

options:
  -h, --help            show this help message and exit
  -m MATRIX, --matrix MATRIX
  -a ANNOTATION, --annotation ANNOTATION
  -s SUBSAMPLE, --subsample SUBSAMPLE
  -d DISCOVERY, --discovery DISCOVERY
                        model: a built-in name (Carcinoma, Lymphoma), a model
                        folder saved with EcoTyperModel.save, or a discovery
                        name under --models
  --models MODELS       folder containing <discovery>/<discovery>_Fractions
                        models (e.g. the 'EcoTyper' folder of the R
                        repository); default: built-in models, downloaded on
                        first use
  -o OUTPUT, --output OUTPUT
  -t THREADS, --threads THREADS
  --seed SEED           seed for NMFpredict's random initialisation
  --fast                fast mode (exact=False): BLAS NMF updates, not bit-
                        identical to R

recover-visium

usage: ecotyper-py recover-visium [-h] -i INPUT_DIR -f FRACTIONS -n NAME
                                  [--background BACKGROUND] [-d DISCOVERY]
                                  [--models MODELS] [-o OUTPUT] [-t THREADS]
                                  [--seed SEED] [--fast]

options:
  -h, --help            show this help message and exit
  -i INPUT_DIR, --input-dir INPUT_DIR
  -f FRACTIONS, --fractions FRACTIONS
  -n NAME, --name NAME
  --background BACKGROUND
  -d DISCOVERY, --discovery DISCOVERY
                        model: a built-in name (Carcinoma, Lymphoma), a model
                        folder saved with EcoTyperModel.save, or a discovery
                        name under --models
  --models MODELS       folder containing <discovery>/<discovery>_Fractions
                        models (e.g. the 'EcoTyper' folder of the R
                        repository); default: built-in models, downloaded on
                        first use
  -o OUTPUT, --output OUTPUT
  -t THREADS, --threads THREADS
  --seed SEED           seed for NMFpredict's random initialisation
  --fast                fast mode (exact=False): BLAS NMF updates, not bit-
                        identical to R

discover

usage: ecotyper-py discover [-h] -i INPUT_DIR [-a ANNOTATION] -n NAME
                            [--fractions FRACTIONS]
                            [--scale-column SCALE_COLUMN]
                            [--max-states MAX_STATES] [--restarts RESTARTS]
                            [--cophenetic COPHENETIC]
                            [--min-states MIN_STATES] [-o OUTPUT] [-t THREADS]
                            [--fast] [--nmf-method {brunet,cd}]

options:
  -h, --help            show this help message and exit
  -i INPUT_DIR, --input-dir INPUT_DIR
                        folder with <cell type>.txt profiles
  -a ANNOTATION, --annotation ANNOTATION
  -n NAME, --name NAME
  --fractions FRACTIONS
  --scale-column SCALE_COLUMN
  --max-states MAX_STATES
  --restarts RESTARTS
  --cophenetic COPHENETIC
  --min-states MIN_STATES
  -o OUTPUT, --output OUTPUT
  -t THREADS, --threads THREADS
  --fast                fast mode (exact=False): BLAS NMF updates, not bit-
                        identical to R
  --nmf-method {brunet,cd}
                        NMF solver: brunet (EcoTyper/R) or cd (scikit-learn
                        coordinate descent, Frobenius loss; not R-equivalent)

discover-scrna

usage: ecotyper-py discover-scrna [-h] -m MATRIX -a ANNOTATION -n NAME
                                  [--filter-genes FILTER_GENES]
                                  [--max-states MAX_STATES]
                                  [--restarts RESTARTS]
                                  [--cophenetic COPHENETIC]
                                  [--min-states MIN_STATES] [--pvalue PVALUE]
                                  [-o OUTPUT] [-t THREADS] [--fast]
                                  [--nmf-method {brunet,cd}]

options:
  -h, --help            show this help message and exit
  -m MATRIX, --matrix MATRIX
  -a ANNOTATION, --annotation ANNOTATION
  -n NAME, --name NAME
  --filter-genes FILTER_GENES
  --max-states MAX_STATES
  --restarts RESTARTS
  --cophenetic COPHENETIC
  --min-states MIN_STATES
  --pvalue PVALUE
  -o OUTPUT, --output OUTPUT
  -t THREADS, --threads THREADS
  --fast                fast mode (exact=False): BLAS NMF updates, not bit-
                        identical to R
  --nmf-method {brunet,cd}
                        NMF solver: brunet (EcoTyper/R) or cd (scikit-learn
                        coordinate descent, Frobenius loss; not R-equivalent)