The idea is to extract the importance and effect of each factor. To do so, the expression of each gene is modeled as a Poisson distribution. The log of its parameter (the expected value) is approximated by a linear combination of the factors in the experiment. The coefficients associated to each factors are estimated to fit gene expression, and can be insightful to characterize genes behavior in a particular cluster. The model with interactions is considered. It your design in not a complete crossed design, the interaction term will be null.
fit_glm(normalized_counts, genes, design, factors = colnames(design))
normalized counts
genes belonging to a specific expression-based clusters
experimental design as a dataframe
factors to use for the fit (defalut is all the factors of the design)
glm object
Note that we can only apply a glm fit to a set of genes that have very close expression profiles accros conditions, else we would have to introduce a new variable related to the genes themselves.
data("abiotic_stresses")
genes_cluster <- DIANE::get_genes_in_cluster(
abiotic_stresses$heat_DEGs_coseq_membership, cluster = 3)
glm <- DIANE::fit_glm(abiotic_stresses$normalized_counts, genes_cluster,
abiotic_stresses$design)
summary(glm)
#>
#> Call:
#> glm(formula = formula, family = poisson(link = "log"), data = glmData)
#>
#> Coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) 3.68888 0.02282 161.64 <2e-16 ***
#> Salt 2.65639 0.02361 112.52 <2e-16 ***
#> Mannitol 2.27679 0.02396 95.01 <2e-16 ***
#> Heat 3.31508 0.02323 142.69 <2e-16 ***
#> Salt:Mannitol -1.44706 0.02504 -57.80 <2e-16 ***
#> Salt:Heat -2.20259 0.02426 -90.81 <2e-16 ***
#> Mannitol:Heat -1.49167 0.02453 -60.80 <2e-16 ***
#> Salt:Mannitol:Heat 1.69578 0.02590 65.48 <2e-16 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> (Dispersion parameter for poisson family taken to be 1)
#>
#> Null deviance: 2301824 on 383 degrees of freedom
#> Residual deviance: 1825288 on 376 degrees of freedom
#> AIC: 1827659
#>
#> Number of Fisher Scoring iterations: 7
#>