Gene Co-expression Visualization
Overview
Goal. Identify co-expressed gene groups from a user-provided expression matrix and visualize the network interactively.
Two modes. - Text mode: write detected clusters to a results file. - Web mode: serve an interactive D3.js force-layout graph via a Go HTTP server.
Positive correlations are one edge color and negative correlations another; users can inspect cluster membership and relationships at a glance.
Quick Start
Text mode (CLI)
Provide an expression matrix (rows = genes, cols = samples).
Run the executable with:
./Go_codes.exe text <input.txt> <output.txt> <corr_threshold>The output file lists clusters and membership.
Web mode (interactive)
Start the server:
./Go_codes.exe webOpen
http://localhost:8000.Upload your matrix, set correlation cutoff, browse clusters, and click Generate graph to open an interactive view.
Methods (brief)
- Filtering: remove genes with low expression across all samples (threshold configurable in code).
- Similarity: compute Pearson correlation for all gene pairs.
- Graph: build an adjacency matrix using a user-defined cutoff (e.g., |r| ≥ 0.85) to mark edges.
- Clustering: traverse the undirected graph via DFS to extract connected components.
- Visualization: render selected component with D3.js (force-directed layout).
- Enrichment (optional): export cluster gene lists and analyze in shinyGO (external).
Example (replace with your assets)
Dataset:
Data/sample_200_rand.txt(subset for speed).Example command:
./Go_codes.exe text Data/sample_200_rand.txt Results/coexpr.txt 0.85Web demo screenshot:

Notes & Future Work
- Make expression cutoff user-configurable (currently hardcoded in the sample).
- Pass selected cluster index across handlers to load the matching JSON (avoid hardcoding index 0).
- Add optional parallelism for correlation and traversal on large matrices.
- Provide built-in GO enrichment by calling an R script from Go for one-shot reports.
Files & Links
- Code repository: https://github.com/yourname/gene-coexpression
- Report (PDF): files/gene-coexpression.pdf
- Report (source .qmd): files/gene-coexpression-report.qmd