I've got an error. Is it a bug?
It depends on how the message starts. A message of one line starting with Error: is about the input: a missing file, a malformed table, an option out of range. It says what is wrong and, where possible, what to do about it.
A message starting with Unexpected internal error and followed by a Python traceback is a bug in MARADONER. We'd be grateful for a report at the issue tracker with the traceback and the command.
If the cause of an input error is unclear, the MARADONER_DEBUG environment variable makes MARADONER print a traceback for it as well:
> MARADONER_DEBUG=1 maradoner fit MyProject
How many samples do I need?
At least 2. The model learns activities from the variation of expression across samples, and fit stops with an error if there is 1 sample. For a single sample there is a separate model.
When samples are few, it matters how they are grouped. Each group has an error variance to estimate. Without the --sample-groups option every sample is a group, and e.g. 2 samples in 2 groups are refused. The same 2 samples in one group are fine.
The smallest design we have tested is 2 samples per group. The About page has the numbers.
Will more threads make it faster?
Rarely. MARADONER runs on 1 thread by default. Most of the linear algebra in it is done on many small matrices, and a pool of threads spends more time on waiting than on computing there.
The number of threads is set with the global --threads option. It goes before the name of a command:
> maradoner --threads 4 fit MyProject
The MARADONER_THREADS environment variable does the same. If neither is given and a variable of the OMP_NUM_THREADS family is set, MARADONER leaves the choice to that variable.
We timed the fit of the Quickstart example on a machine of 16 cores, a few runs per setting:
| Setting | Time of the whole command, seconds |
|---|---|
| 1 thread (default) | 6.3 to 6.9 |
| 4 threads | 6.5 to 7.4 |
| 16 threads | 8.9 to 16.6 |
| 1 thread, with a cache of compiled programs | 4.1 to 4.5 |
The last row is the better way to save time on a project of that size. A good share of those seconds goes to the compilation of the likelihood by JAX, and it is the same from run to run. If the MARADONER_JAX_CACHE environment variable holds a path to a folder, the compiled programs are kept there and reused:
> export MARADONER_JAX_CACHE=~/.cache/maradoner > maradoner fit MyProject
The first run with the variable fills the folder and is no faster.
My loading matrix has zeros and ones only. Is it fine?
It is, with one change in create. The default transformation of loadings ranks the values of each motif. A column of 2 distinct values turns into a constant under it, and MARADONER drops the motif. The --loading-transform none option keeps such a table as it is, and --loading-transform scale brings its columns to a unit variance.
Why did create drop so many promoters?
Promoters of low expression carry mostly noise, and create filters them out. It fits a mixture of 2 components to the expression of each promoter in the sample where it is highest, and it keeps the promoters attributed to the expressed component. The .filter-plot.png picture saved next to the project shows where the cut went.
If the cut looks wrong, the --filter-lowexp-w option moves it, and a value of 1 keeps all promoters. A table already filtered by other means is better passed with that value.
Some motifs are missing from the activities. Where are they?
They were left out by predict. A motif with a variance several orders of magnitude below the median one has no activity to speak of, and it is removed before the activities are computed. The list is in the params/filtered_motif_variances.tsv table of the exported folder. The --no-filter-motifs option of predict keeps all motifs.
Why are all activities centered at zero?
Because the tables of the activities folder hold deviations. In MARADONER, the activity of a motif in a group is a sum of 2 parts: a mean shared by all samples, and a deviation of the group from it. The 2 parts are estimated in different ways and are exported to different tables. The mean is in params/motif_means.tsv.
The deviations are the part to look at when groups are compared. The mean tells whether a motif activates or represses on average.
One standard error in group_variances.tsv is empty. Why?
That nu was not estimated. The variance of an activity is a product of a motif-wise tau and a group-wise nu, and such a product has an arbitrary scale. MARADONER fixes the nu of one group to settle it, and a fixed number has no standard error.
I have more motifs than promoters. What can I do?
As it is, nothing: fit will stop with an error. The error variances are estimated from the part of the expression that the loadings can't explain, and with as many motifs as promoters there is no such part.
There are 2 ways out. The first one is fewer motifs, e.g. one motif per transcription factor in place of several. The second one is the clustering of motifs with the --clustering and --num-clusters options of fit. The model is then fitted to clusters, and the activities are those of clusters too.
I ran create again, and my fit is gone. Is that intended?
Yes. A fit belongs to the data it was made from. When create writes a project under an existing name, it removes the files left by fit, predict and gof of the old project and lists them in the output. An exported folder is left alone.
The same holds further down the chain. A new fit removes the files of predict and gof, and a new predict removes those of gof.
