Where wuv is the edge weight between u and v, kiin is the internal edge weight of node i, ki is the degree of node i, and m is the total edge weight of the graph.
Move Nodes:
Move the node to the community that maximizes ΔQ and repeat until no further improvement.
2. Refinement Phase:
Community Merging:
Treat communities as supernodes and construct a new graph where supernodes are connected by aggregated edge weights.
3. Fine-Tuning Phase:
Apply Local Optimization Again:
Optimize modularity in the new graph of supernodes.
Modularity Definition:
Modularity Q:
Q=2m1i,j∑[wij−2mkikj]δ(Ci,Cj)
Where wij is the edge weight between nodes i and j, ki and kj are the degrees of nodes i and j, and δ(Ci,Cj) is the Kronecker delta function indicating whether nodes i and j are in the same community.
Step 5: Evaluation and Annotation of Metacells
1. Statistical Metrics Calculation:
Calculate various metrics for each metacell.
Cell Number(Ci)=∣Ci∣
Expressed Genes(Ci)=j∑I(k∈Ci∑Xkj>0)
2. Differential Expression Analysis:
Identify genes that are differentially expressed in each metacell.
DE(Ci)={g∣avg(i)(X′′:,g)>avg(others)(X′′:,g)}
3. Functional Enrichment Analysis:
Perform functional enrichment analysis on marker genes.
Enrichment(DE(Ci))=GO(DE(Ci)),KEGG(DE(Ci))
4. Cell Type Comparison:
Compare metacells with known cell types or states.
Annotation(Ci)=Compare(DE(Ci),known markers)
5. Visualization:
Visualize metacells using dimensionality reduction techniques such as t-SNE or UMAP.