MixALime

Scoring SNVs

General scheme

Scoring in MIXALIME consists of two steps:

  1. Computing "raw" p-values and effect-sizes (ES) with the test command;
  2. Combining/"aggregating" p-values and ESes across "groups" (e.g. experiments/samples/conditions/cell types) with the combine command.

Graphically, the process of computing a p-value for some SNV is shown below:

The separation of the scoring procedure into 2 commands allows for swift computation of p-values with respect to different conditions/groups. In this section of the tutorial we shall cover both steps: test and combine.

Computing raw statistics

The test command requires only the project name:

> mixalime test MyProject

Note that test operates only if the model parameters were already estimated with the fit command.

For most purposes this call suffices, but there are some options worth mentioning.

Posterior weight correction

The mixture weight parameter $w$ appears in settings where BAD > 1. It has an interpretation as a slice-specific dataset statistic explaining the proportion of (ref count, alt count) observations where the reference allele is the most abundant one (remember that we use mixtures for unphased genotypes). But when performing scoring, we are dealing with each single SNV separately and the dataset statistics might be too general. It is possible to adjust the $w$ parameter to favor one component or another for a particular observation with the --correction <str> option. At the moment, it supports three modes:

Name Description
none No correction applied.
hard $w$ is set to either $1$ or $0$ depending on which mode is the closest one.
single (Default) $w$ is reweighted probabilistically. It most often results in $w$ being very close to either $0$ or $1$ just like the hard mode.

Conservative scoring

Under some conditions, test can override parameter estimates obtained by fit with the so-called "conservative" values of parameters. Those "conservative" values are:

Parameter Value
$b$ $1.0$
$μ$ $0.0$
$w$ (for $BAD > 1$) $1.0$
$κ$ (for BetaNB) $∞$

Note that beta negative binomial distribution is just negative binomial when $κ = ∞$, so the conservative scoring overrides BetaNB with NB. The conditions under which the conservative scoring mode is enabled are dictated by these options:

Name Description Default value
--gof-thr <float> Conservative scoring is used if the goodness-of-fit statistic (RMSEA) exceeds this value for a particular slice. None
--stop-slice-n-thr <int> Conservative scoring will be used if the number of observations at the slice is below this value. -1

Using a different external fit

We can force test to use parameter estimates obtained from a different "project" with the --fit <str> option if we want to train and evaluate our model at different datasets. For example,

> mixalime test MyProject --fit MyOtherProject.fit.lzma

Combining statistics

By default, the combine command "aggregates"/combines all statistics together irrespective of the samples data originate from. We can restrict MixALime to use only data from certain files by supplying the --group <str> option. Just like with the create command, it supports plenty of formats:

Note that if we call combine for separate groups, each consecutive call will overwrite the previous result. Therefore, unless we want to call export after each run, we should give a "name" to each of the combine runs with the --subname <str> option. For instance,

> mixalime combine MyProject --group m:data/*_male_*.vcf --subname boys
> mixalime combine MyProject --group m:data/*_female_*.vcf --subname girls
> mixalime export all MyProject results

Then, you'll find tables results/pvalues/boys.tsv and results/pvalues/girls.tsv after the export call.

Coverage filter

When coverage is low, it is evident that a low p-value is not achievable. There are many observations of low coverage, and their presence penalizes significant SNVs after the multiple testing correction, therefore we might be interested to filter them out beforehand from the combine step to make scoring more admittable. By default, MIXALIME uses a fixed minimal coverage of $20$, which is a boundary we've established empirically from observing the package performance across different datasets. The boundary can be altered with the --min-cover <int> option.

In newer versions of MIXALIME we provide an adaptive thresholding that can be enabled with the --adaptive-min-cover option. It establishes minimal coverage for each BAD separately, by filtering low coverages where an ES of at least --adaptive-es <float> (the default is $1$, i.e. two-fold difference) is not achievable for a p-value of --adaptive-pval <float> (the default is $0.05$). This approach seems to work a bit better (with the minimal coverages being in the vicinity of $20$ for $BAD = 1$), but for now MIXALIME uses the fixed minimal coverage by default for backward compatibility of results.

Combining statistics across different projects

Sometimes it's useful to compute raw p-values using different fits from different datasets and then combine them, treating observations of SNVs per each dataset as extra replicates. To this end, we must run a special command multiple_combine followed by export multiple_pvalues:

> mixalime multiple_combine NewProjectName ProjectA ProjectB ProjectC
> mixalime export multiple_pvalues NewProjectName ProjectA ProjectB ProjectC combined_pvalues.tsv

NewProjectName will be used as an intermediate storage of combined p-values for the multiple_pvalues command.

Binomial scoring

MIXALIME provides a way for scoring SNVs with the conventional binomial and beta-binomial models. This step substitutes the test command and requires no prior run of the fit command. To obtain raw statistics with the binomial model, it suffices to run

> mixalime test_binom MyProject

after initializing the project with create.

To use the beta-binomial model, one must pass the --beta option to the command. In this case, MixALime will also estimate the variance parameter for each BAD separately.

On this page