diff --git a/articles/neocortex.html b/articles/neocortex.html index 66b5fb3..888a0c5 100644 --- a/articles/neocortex.html +++ b/articles/neocortex.html @@ -201,7 +201,10 @@

Spatial and temporal dynamics# Visualization of F(.) p <- ggplot( data = FX_long, - aes(x = `Time period`, y = F, linetype = `Neocortex area`, colour = `Neocortex area`, group = `Neocortex area`) + aes( + x = `Time period`, y = F, + linetype = `Neocortex area`, colour = `Neocortex area`, group = `Neocortex area` + ) ) + geom_line(linewidth = 0.5) + ylab(NULL) + @@ -228,12 +231,12 @@

Spatial and temporal dynamicsGene set enrichment analysis

-# Inferred gene factors (corresponding to the W matrix in the MFAI paper)
-gene_factors <- mfairObject@W
-rownames(gene_factors) <- colnames(mfairObject@Y) # Assign gene symbols
-colnames(gene_factors) <- paste("Factor", c(1:3))
-head(gene_factors)
-#>           Factor 1   Factor 2   Factor 3
+# Inferred gene loadings (corresponding to the W matrix in the MFAI paper)
+gene_loadings <- mfairObject@W
+rownames(gene_loadings) <- colnames(mfairObject@Y) # Assign gene symbols
+colnames(gene_loadings) <- paste("Loading", c(1:3))
+head(gene_loadings)
+#>          Loading 1  Loading 2  Loading 3
 #> DCUN1D2 -1.0973545  0.4754917 -0.4656467
 #> ARRB1    3.7897678  0.5357535  0.3688403
 #> PDE1B    0.1807732  3.1537712 -0.5730507
@@ -241,8 +244,8 @@ 

Gene set enrichment analysis#> TOX 1.6022312 -1.6211514 -1.7326521 #> LOXHD1 -3.4764620 0.1372484 0.1020414

-# Heatmap of the inferred gene factors
-pheatmap::pheatmap(t(gene_factors),
+# Heatmap of the inferred gene loadings
+pheatmap::pheatmap(t(gene_loadings),
   scale = "column",
   clustering_method = "complete",
   cluster_row = FALSE, cluster_col = TRUE,
@@ -253,14 +256,14 @@ 

Gene set enrichment analysis= 12 )

-

We first calculated the relative weight of the \(k\)-th factor for the \(m\)-th gene by \(\left| W_{mk} \right| / \sum_{k^{\prime}=1}^{3} +

We first calculated the relative weight of the \(k\)-th loading for the \(m\)-th gene by \(\left| W_{mk} \right| / \sum_{k^{\prime}=1}^{3} \left| W_{mk^{\prime}} \right|\), where \(W_{m \cdot} \in \mathbb{R}^{3 \times 1}\) -is the \(m\)-th row of gene factors, -and then selected the top 300 weighted genes in each factor to form the +is the \(m\)-th row of gene loadings, +and then selected the top 300 weighted genes in each loading to form the gene sets.

-# Normalize each factor to have l2-norm equal one
-gene_factors <- apply(gene_factors,
+# Normalize each loading to have l2-norm equal one
+gene_loadings <- apply(gene_loadings,
   MARGIN = 2,
   FUN = function(x) {
     x / sqrt(sum(x^2))
@@ -268,14 +271,14 @@ 

Gene set enrichment analysis) # Relative weight -gene_factors <- abs(gene_factors) -gene_factors <- gene_factors / rowSums(gene_factors) +gene_loadings <- abs(gene_loadings) +gene_loadings <- gene_loadings / rowSums(gene_loadings) -M <- nrow(gene_factors)[1] # Total number of genes M = 2,000 -ntop <- M * 0.15 # We use the top 300 weighted genes in each factor to form the gene sets +M <- nrow(gene_loadings)[1] # Total number of genes M = 2,000 +ntop <- M * 0.15 # We use the top 300 weighted genes in each loading to form the gene sets # Index of top genes -top_gene_idx <- apply(gene_factors, +top_gene_idx <- apply(gene_loadings, MARGIN = 2, FUN = function(x) { which(rank(-x) <= ntop) @@ -285,18 +288,18 @@

Gene set enrichment analysistop_genes <- apply(top_gene_idx, MARGIN = 2, FUN = function(x) { - rownames(gene_factors)[x] + rownames(gene_loadings)[x] } ) -colnames(top_genes) <- paste("Factor", c(1:3)) +colnames(top_genes) <- paste("Loading", c(1:3)) head(top_genes) -#> Factor 1 Factor 2 Factor 3 -#> [1,] "ARRB1" "PDE1B" "AJAP1" -#> [2,] "LOXHD1" "PDE7B" "KCNA3" -#> [3,] "TYRP1" "KCNA2" "ASTN2" -#> [4,] "PRKG1" "PMP22" "EMID1" -#> [5,] "MS4A8B" "GPR155" "GPR52" -#> [6,] "FAM131B" "SMAD2" "SEC24D"

+#> Loading 1 Loading 2 Loading 3 +#> [1,] "ARRB1" "PDE1B" "AJAP1" +#> [2,] "LOXHD1" "PDE7B" "KCNA3" +#> [3,] "TYRP1" "KCNA2" "ASTN2" +#> [4,] "PRKG1" "PMP22" "EMID1" +#> [5,] "MS4A8B" "GPR155" "GPR52" +#> [6,] "FAM131B" "SMAD2" "SEC24D"

Then we can conduct the gene set enrichment analysis based on Gene Ontology for each factor.