MARADONER

Motif families and windows

This page follows a project where every motif has loadings in several windows around the TSS, and the motifs of related factors form families. It covers the layout of the input files, the fit and the reading of the results. The model of families itself is on the Motif families page.

What do we ask of such data?

A motif scanned in 3 windows (the core promoter, upstream and downstream of it) gives 3 columns of the loading matrix, and each column gets an activity. The questions are about the motif, though:

The model answers them through families of 2 levels. The windows of a motif form a family, and the windows of all motifs of related factors form a family of the second level. The activity of a window is then the sum of 3 parts: the part shared by the factors of its family, the part shared by the windows of its motif, and the individual part of the window.

Input files

The loading matrix has a column per motif and window. The name of a column is the name of the motif followed by the window, as in MEF2D_core, MEF2D_up and MEF2D_down. MARADONER reads no meaning into the names: the windows are tied together by the file of families only.

The file of families has a line per motif with its windows, and a line per family of factors with its motifs:

motif_1 motif_1_core motif_1_up motif_1_down
motif_2 motif_2_core motif_2_up motif_2_down
...
family_3 motif_1 motif_6 ...

Here, motif_1 on the last line is the name of a family, and it stands for the 3 windows of the motif. The windows may be listed instead, and the line

family_3 motif_1_core motif_1_up motif_1_down motif_6_core motif_6_up motif_6_down ...

gives the same family. A window belongs to 2 families, one of each level. The second level is optional: without it, a family per motif is the whole file.

Example

The generator of synthetic data makes such a dataset with the --windows option. First, we generate 150 motifs in 3 windows, split into 10 families of factors, and create a project:

> maradoner generate windows_demo --m 150 --windows core,up,down --families 10
> maradoner create Windows windows_demo/expression.tsv windows_demo/loadings.tsv --sample-groups windows_demo/groups.json --loading-transform none

Here, the loading matrix has 450 columns, and the loadings of the windows of a motif have a correlation of 0.5. The generator draws for each of the 120 active motifs whether it acts through all windows together, through one window, or both. The truth goes to windows_demo/windows_gt.tsv:

motif	class	omega	individual	family
motif_1	family	0.2896226645646708		family_3
motif_2	family+individual	0.6585818884946497	motif_2_up	family_9
motif_3	family+individual	0.0091505241586455	motif_3_core	family_8
inactive_motif_4	none	0.0

The class column refers to the windows of a motif: family for a motif acting through its windows together, individual for a motif acting through the windows of the individual column alone, and family+individual for both. The family of factors in the last column adds a part to all windows of its motifs on top of that. The file of families is windows_demo/families.txt, with 150 families of windows and 10 families of factors.

Then we fit the model with the families, predict the activities and export the results:

> maradoner fit Windows --motif-families windows_demo/families.txt
> maradoner predict Windows
> maradoner export Windows windows_results

The output of fit has these lines:

  Motif families: 160 families (160 of them with more than one motif) cover 450 of 450 motifs.
...
[motif covariance] Sigma/G REML deviance -174566.915 -> -191645.622 (gain +17078.706)
  covariance between motifs: diagonal Sigma + 89 of 160 family variances above zero (REML deviance -191645.62).

Here, 89 families have a variance above zero: 79 of the 150 families of windows and all 10 families of factors. The fit takes 3.6 seconds.

Reading the table of families

The windows_results/tests/families.tsv table has a row per family. A row of a family of windows reads as a statement about the motif:

family	motifs	class	family_FDR	family_groups_FDR	individual	individual_groups	members
motif_1	3	family	1.0226992525708141e-17	9.41987098468065e-10			motif_1_core,motif_1_up,motif_1_down
motif_2	3	family+individual	6.4274789955139946e-12	0.0054119433147867	motif_2_up		motif_2_core,motif_2_up,motif_2_down
motif_6	3	none	1.0				motif_6_core,motif_6_up,motif_6_down
motif_8	3	individual	1.0		motif_8_down	motif_8_down	motif_8_core,motif_8_up,motif_8_down
Statement Row of the motif
The motif acts through all its windows together class is family
The motif acts in the downstream window alone class is individual, and the individual column lists the downstream window only
The motif acts through all windows, and through the upstream one beyond that class is family+individual, and the individual column lists the upstream window
The common part of the windows differs between groups family_groups_FDR is small
A window differs between groups beyond the rest of the motif The window is in the individual_groups column

The class joins the test of the family variance $ω = 0$ (family_FDR) with the tests of $τ = 0$ of the windows. The lists and classes use the FDR level of the --alpha option of export, 0.05 by default. The truth of all 4 rows above is in windows_gt.tsv. The first 3 are right: motif_8, for instance, acts through its downstream window alone. The truth of motif_6 is individual through the upstream window, and the export found nothing. A window left out of a list lacks evidence of an effect. That is no evidence of its absence.

A row of a family of factors reads the same way, with the motifs of the factors in place of the windows. In the example, all 10 families of factors are of class family+individual, and their common parts differ between groups with FDRs from $4.2 × 10^{-9}$ down to $8.9 × 10^{-158}$. Their individual columns list the windows varying beyond both families of the window.

In which groups?

The z-scores of the common parts of families are in windows_results/activities/family_activity.tsv, a row per family and a column per group. For motif_5, of class family, they range from -5.90 in group_5 to 9.87 in group_9: the motif is down in group 5 and up in group 9 through all its windows. For the family of factors family_3 (16 motifs, 48 windows) they range from -21.23 in group_10 to 9.73 in group_2.

The individual parts of the windows are in activities/individual_activity.tsv, and their test across groups in tests/prediction_based/individual_anova.tsv. The downstream window of motif_8 differs between groups with an FDR of 0.00044, and its z-scores range from -4.35 in group_8 to 3.00 in group_7. The other 2 windows of the motif have FDRs of 1. The raw values and their standard deviations are in the files ending in _group_raw.tsv and _group_raw_std.tsv; the Motif families page lists them all.

How well does it work?

On this example, 124 of the 150 motifs get the class of the truth, and 126 get the right list of individual windows. All 30 inactive motifs are of class none. Every error is an effect missed: 10 motifs of class family+individual came out as family (the individual window was missed), 9 motifs of class individual and 5 of class family+individual came out as none, 1 motif of class family+individual came out as individual, and 1 motif of class family came out as none. No motif got an effect it does not have.

Without the file of families, the test of $τ$ in anova.tsv finds all 3 windows of each of the 120 active motifs. That is right, as the family of factors adds a part to all windows of its motifs. Hence the test of single columns cannot tell a motif acting through one window from a motif acting through all of them. The families can.

Notes

On this page