HarveST uses a heterogeneous graph learning framework to reveal spatial transcriptomics patterns.
The 4 matches
- [1] § Methods › Random walk with restart for spatially specific gene detection ↔ harvest/spatial_gene_discovery.py, lines 346 to 386 · score 0.73 · initial probability vector, restart probability, RWR converges, iteratively, walk, seed · Report a mismatch
- [2] § Methods › Heterogeneous graph construction › Gene-gene subgraph ↔ harvest/model/graph_nn.py, lines 11 to 81 · score 0.63 · MI scores, adjacency matrix, Mutual Information, dimensional, weighted, network · Report a mismatch
- [3] § Methods › Heterogeneous graph construction › Joint analysis ↔ harvest/model/graph_nn.py, lines 11 to 81 · score 0.57 · graph neural network, mutual information matrix, dimensional, adjacency · Report a mismatch
- [4] § Methods › Heterogeneous graph construction › Gene-gene subgraph ↔ harvest/preprocessing/mutual_information.py, lines 11 to 78 · score 0.51 · gene pairs, Mutual Information, computationally, MI, matrix · Report a mismatch
Paper
Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 172 lines · 6.9 KB · MIT · 2 matches
- import torch
- import torch.nn as nn
- import torch.nn.functional as F
- from torch.nn.parameter import Parameter
- from .attention import AttentionLayers
- class GraphNeuralNetwork(nn.Module):
- """Graph Neural Network with attention mechanisms for spatial transcriptomics."""
- def __init__(self, hidden_dims_c: list, hidden_dims_g: list,
- adjacency_matrix: torch.Tensor, mi_score: torch.Tensor,
- cg_expr: torch.Tensor, coor_ratio: float = 1.0):
- """
- Initialize the Graph Neural Network.
- Parameters:
- -----------
- hidden_dims_c : list
- Dimensions of cell representation layers
- hidden_dims_g : list
- Dimensions of gene representation layers
- adjacency_matrix : torch.Tensor
- Cell-to-cell adjacency matrix
- mi_score : torch.Tensor
- Gene-to-gene mutual information matrix
- cg_expr : torch.Tensor
- Cell-to-gene expression matrix
- coor_ratio : float
- Coordination ratio parameter
- """
- super(GraphNeuralNetwork, self).__init__()
- self.n_layers = len(hidden_dims_c) - 1
- self.adj = adjacency_matrix
- self.mi = mi_score
- self.expr = cg_expr
- self.coor_ratio = coor_ratio
- # Attention dictionaries
- self.atten = {}
- self.atten_g = {}
- self.atten_gg = {}
- # Weight matrices
- self.W_c = nn.ParameterList([
- Parameter(torch.FloatTensor(hidden_dims_c[i], hidden_dims_c[i+1]))
- for i in range(self.n_layers)
- ])
- self.W_g = nn.ParameterList([
- Parameter(torch.FloatTensor(hidden_dims_g[i], hidden_dims_g[i+1]))
- for i in range(self.n_layers)
- ])
- self.W_gc = nn.ParameterList([
- Parameter(torch.FloatTensor(hidden_dims_g[1], hidden_dims_g[2]))
- ])
- # Attention parameters
- self.Ws_att = nn.ParameterList([])
- self.Ws_att_g = nn.ParameterList([])
- self.Ws_att_gg = nn.ParameterList([])
- for i in range(self.n_layers-1):
- v = nn.ParameterList([])
- v.append(Parameter(torch.FloatTensor(hidden_dims_c[i+1], 1)))
- v.append(Parameter(torch.FloatTensor(hidden_dims_c[i+1], 1)))
- self.Ws_att.append(v)
- for i in range(self.n_layers-1):
- v = nn.ParameterList([])
- v.append(Parameter(torch.FloatTensor(hidden_dims_g[i+1], 1)))
- v.append(Parameter(torch.FloatTensor(hidden_dims_g[i+1], 1)))
- self.Ws_att_g.append(v)
- for i in range(self.n_layers-1):
- v = nn.ParameterList([])
- v.append(Parameter(torch.FloatTensor(hidden_dims_c[i+1], 1)))
- v.append(Parameter(torch.FloatTensor(hidden_dims_c[i+1], 1)))
- self.Ws_att_gg.append(v)
- # Initialize parameters
- self._initialize_parameters()
- def _initialize_parameters(self):
- """Initialize network parameters with Xavier initialization."""
- torch.nn.init.xavier_uniform_(self.Ws_att[0][0])
- torch.nn.init.xavier_uniform_(self.Ws_att[0][1])
- torch.nn.init.xavier_uniform_(self.Ws_att_g[0][0])
- torch.nn.init.xavier_uniform_(self.Ws_att_g[0][1])
- torch.nn.init.xavier_uniform_(self.Ws_att_gg[0][0])
- torch.nn.init.xavier_uniform_(self.Ws_att_gg[0][1])
- torch.nn.init.xavier_uniform_(self.W_c[0])
- torch.nn.init.xavier_uniform_(self.W_c[1])
- torch.nn.init.xavier_uniform_(self.W_gc[0])
- torch.nn.init.xavier_uniform_(self.W_g[0])
- torch.nn.init.xavier_uniform_(self.W_g[1])
- def forward(self, X_c: torch.Tensor, X_g: torch.Tensor):
- """
- Forward pass through the network.
- Parameters:
- -----------
- X_c : torch.Tensor
- Cell features
- X_g : torch.Tensor
- Gene features
- Returns:
- --------
- tuple : (hidden, hidden_coor, reX_c, reX_g)
- Final embeddings and reconstructed features
- """
- H_g = X_g
- H_c = X_c
- for layer in range(self.n_layers):
- H_c, H_g, H_c_coor, H_c_expr = self.encoder(H_c, H_g, self.mi, self.adj, self.expr, layer)
- if layer != self.n_layers-1:
- H_c = F.elu(H_c)
- H_g = F.elu(H_g)
- H_c_coor = F.elu(H_c_coor)
- H_c_expr = F.elu(H_c_expr)
- hidden = H_c
- hidden_coor = H_c_coor
- for layer in range(self.n_layers-1, -1, -1):
- H_c_coor, H_c_expr = self.decoder(H_c_coor, H_c_expr, self.adj, self.expr, self.mi, layer)
- if layer != 0:
- H_c_coor = F.elu(H_c_coor)
- H_c_expr = F.elu(H_c_expr)
- reX_c = H_c_coor
- reX_g = H_c_expr
- return hidden, hidden_coor, reX_c, reX_g
- def encoder(self, X_c: torch.Tensor, X_g: torch.Tensor, mi: torch.Tensor,
- adj: torch.Tensor, expr: torch.Tensor, layer: int):
- """Encoder part of the network."""
- if layer != self.n_layers-1:
- z_g = torch.mm(X_g, self.W_g[layer])
- self.atten_gg[layer] = AttentionLayers.graph_attention_layer_gg(mi, z_g, self.Ws_att_gg[0])
- z_g = torch.mm(self.atten_gg[layer], z_g)
- z_c = torch.mm(X_c, self.W_c[layer])
- z_c_coor = torch.tensor(0, dtype=torch.float)
- z_c_expr = torch.tensor(0, dtype=torch.float)
- return z_c, z_g, z_c_coor, z_c_expr
- elif layer == self.n_layers-1:
- self.atten[layer] = AttentionLayers.graph_attention_layer(adj, X_c, self.Ws_att[0])
- z_c_coor = torch.mm(self.atten[layer], X_c)
- z_c_coor = torch.mm(z_c_coor, self.W_c[layer])
- self.atten_g[layer] = AttentionLayers.graph_attention_layer_g(expr, X_g, self.Ws_att_g[0])
- z_c_expr = torch.mm(self.atten_g[layer], X_g)
- z_c_expr = torch.mm(z_c_expr, self.W_gc[0])
- z_c = self.coor_ratio * z_c_coor + (1 - self.coor_ratio) * z_c_expr
- return z_c, X_g, z_c_coor, z_c_expr
- def decoder(self, z_c_coor: torch.Tensor, z_c_expr: torch.Tensor,
- adj: torch.Tensor, expr: torch.Tensor, mi: torch.Tensor, layer: int):
- """Decoder part of the network."""
- if layer == 0:
- D_c_coor = torch.mm(z_c_coor, torch.transpose(self.W_c[layer], 1, 0))
- D_expr = torch.mm(self.atten_gg[layer], z_c_expr)
- D_expr = torch.mm(D_expr, torch.transpose(self.W_g[0], 1, 0))
- return D_c_coor, D_expr
- else:
- D_c_coor = torch.mm(z_c_coor, torch.transpose(self.W_c[layer], 1, 0))
- D_c_coor = torch.mm(self.atten[layer], D_c_coor)
- D_expr = torch.mm(z_c_expr, torch.transpose(self.W_gc[0], 1, 0))
- D_expr = torch.mm(torch.transpose(self.atten_g[layer], 1, 0), D_expr)
- return D_c_coor, D_expr
graph_nn.py at commit 27ec12b, under MIT · at the source
Overview
- Data Science and Analytics Thrust, Hong Kong University of Science and Technology (Guangzhou),Guangzhou, China
- School of Data Science, Chinese University of Hong Kong, Shenzhen (CUHK-Shenzhen),Shenzhen, China
Abstract
The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.
Repositories
Its files are read in the Code ↔ Paper reader above, with 4 matches between paragraphs and lines of code.
Seven595/HarveST
27ec12b303dd9a0ac8c9bc6accc99dd24fac48e2, 9 February 2026Availability: 1 check, the latest on 30 September 2026: the link answers
- 30 September 2026: the link answers
24 files
- examples/
HarveST_Complete_Analysi , Jupyter, 504 liness.ipynb - examples/
example_usage_cluster.py , Python, 128 lines - examples/
example_usage_svg.py , Python, 50 lines - harvest/
__init__.py , Python, 11 lines - harvest/
clustering/ , Python, 4 lines__init__.py - harvest/
clustering/ , Python, 96 linescluster_analysis.py - harvest/
clustering/ , Python, 286 linesrefinement.py - harvest/
core.py , Python, 686 lines - harvest/
model/ , Python, 4 lines__init__.py - harvest/
model/ , Python, 48 linesattention.py - harvest/
model/ , Python, 172 lines, 2 matchesgraph_nn.py - harvest/
preprocessing/ , Python, 3 lines__init__.py - harvest/
preprocessing/ , Python, 84 linesdata_loader.py - harvest/
preprocessing/ , Python, 75 linesdiscretization.py - harvest/
preprocessing/ , Python, 78 lines, 1 matchmutual_information.py - harvest/
preprocessing/ , Python, 115 linesspatial_distance.py - harvest/
spatial_gene_discovery.p , Python, 448 lines, 1 matchy - harvest/
utils/ , Python, 5 lines__init__.py - harvest/
utils/ , Python, 28 linesconfig.py - harvest/
utils/ , Python, 32 lineslogger.py - harvest/
utils/ , Python, 17 linesseeds.py - setup.py, Python, 40 lines
- LICENSE, License, 21 lines
- README.md, Text, 210 lines
Zenodo 18532348
Availability: 1 check, the latest on 30 September 2026: the link answers (HTTP 200)
- 30 September 2026: the link answers (HTTP 200)
Code availability statement
The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to the authors' code: Seven595/
HarveST , Zenodo 18532348
Read it in the paper: doi.org/10.1038/s42003-026-09841-2.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 22 scripts, each with its path and the digest of its content;
- 4 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- geo:GSE111672, at NCBI GEO; found in “Data availability”
Code and data availability statement
The paper has a code and data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:
- it points to a dataset: NCBI GEO GSE111672
- it points to the authors' code: Seven595/
HarveST , Zenodo 18532348 - it says that the data are available on request
Read it in the paper: doi.org/10.1038/s42003-026-09841-2.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 30 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 2 keywords, 10 MeSH terms, 3 funders, 64 references.
Cite
This paper
Feng, J., Yu, T., & Zhang, Y. (2026). HarveST uses a heterogeneous graph learning framework to reveal spatial transcriptomics patterns. Communications biology, 9(1), 681. https://
BibTeX
@article{feng2026harvest
author = {Feng, Junning and Yu, Tianwei and Zhang, Yanlin},
title = {{HarveST uses a heterogeneous graph learning framework to reveal spatial transcriptomics patterns}},
journal = {Communications biology},
year = {2026},
month = mar,
volume = {9},
number = {1},
pages = {681},
publisher = {Nature Publishing Group},
issn = {2399-3642},
doi = {10.1038/
url = {https://
pmid = {41896336},
pmcid = {PMC13187054}
}
RIS
TY - JOUR
AU - Feng, Junning
AU - Yu, Tianwei
AU - Zhang, Yanlin
TI - HarveST uses a heterogeneous graph learning framework to reveal spatial transcriptomics patterns
T2 - Communications biology
J2 - Commun Biol
PY - 2026
DA - 2026/
VL - 9
IS - 1
SP - 681
SN - 2399-3642
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "HarveST uses a heterogeneous graph learning framework to reveal spatial transcriptomics patterns",
"container-title": "Communications biology",
"author": [
{
"family": "Feng",
"given": "Junning"
},
{
"family": "Yu",
"given": "Tianwei"
},
{
"family": "Zhang",
"given": "Yanlin"
}
],
"container-title-short":
"volume": "9",
"issue": "1",
"page": "681",
"DOI": "10.1038/
"PMID": "41896336",
"PMCID": "PMC13187054",
"ISSN": "2399-3642",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
27
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1093/bib/bbag298 [code]
- Empowering multifaceted analysis of spatial transcriptomics data with RGAST.Journal: Briefings in bioinformaticsIn common: rpy2, Scanpy, Numba, 6 other tools, genetics / omics, mouse, 13 references
- [2] doi:10.1093/bib/bbaf674 [code]
- Probabilistic-graph-base
d spatial context-aware framework for interpretable spatial omics denoising and augmentation. Journal: Briefings in bioinformaticsIn common: rpy2, Scanpy, Numba, 5 other tools, other condition, 13 references - [3] doi:10.1038/s41467-023-36796-3 [code]
- Spatially informed clustering, integration, and deconvolution of spatial transcriptomics with GraphST.Journal: Nature communicationsIn common: rpy2, Scanpy, Numba, 6 other tools, genetics / omics, cellular / molecular, 12 references
- [4] doi:10.1093/bib/bbaf316 [code]
- TriCLFF: a multi-modal feature fusion framework using contrastive learning for spatial domain identification.Journal: Briefings in bioinformaticsIn common: rpy2, Scanpy, Numba, 6 other tools, genetics / omics, mouse, 10 references
- [5] doi:10.1038/s41598-026-39703-0 [code]
- Attention-guided enhanced deconvolution enables reference-free cell type estimation in spatial transcriptomics.Journal: Scientific reportsIn common: Scanpy, PyTorch, scikit-learn, 4 other tools, NCBI GEO GSE111672, genetics / omics, mouse, cellular / molecular, 7 references
- [6] doi:10.1093/bib/bbaf365 [code]
- Path-MGCN: a pathway activity-based multi-view graph convolutional network for determining spatial domains.Journal: Briefings in bioinformaticsIn common: rpy2, Scanpy, PyTorch, 5 other tools, genetics / omics, other condition, mouse, 9 references
- [7] doi:10.1186/s12864-024-10469-x [code]
- HyperGCN: an effective deep representation learning framework for the integrative analysis of spatial transcriptomics data.Journal: BMC genomicsIn common: rpy2, Scanpy, PyTorch, 5 other tools, genetics / omics, mouse, cellular / molecular, 10 references
- [8] doi:10.1038/s41467-024-47152-4 [code]
- Pianno: a probabilistic framework automating semantic annotation for spatial transcriptomics.Journal: Nature communicationsIn common: Scanpy, Matplotlib, NCBI GEO GSE111672, genetics / omics, 11 references
- [9] doi:10.1038/s41467-023-38121-4 [code]
- Reconstruction of the cell pseudo-space from single-cell RNA sequencing data with scSpace.Journal: Nature communicationsIn common: Scanpy, PyTorch, scikit-learn, 4 other tools, genetics / omics, other condition, cellular / molecular, 11 references
- [10] doi:10.1038/s41592-026-03194-8 [code]
- Beyond benchmarking: an expert-guided consensus approach to spatially aware clustering.Journal: Nature methodsIn common: rpy2, Scanpy, PyTorch, 5 other tools, genetics / omics, 10 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 22 scripts, and 4 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:1b49fcebc5184170…
Add the badge to the code's README
If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.
Markdown
<!-- oscr-badge:start -->
[](https://openscicode.org/badge/doi/10.1038/s42003-026-09841-2)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1038/s42003-026-09841-2.svg
:target: https://openscicode.org/badge/doi/10.1038/s42003-026-09841-2
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s42003-026-09841-2"><img src="https://openscicode.org/badge/doi/10.1038/s42003-026-09841-2.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".
If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.
Report a mismatch between the code and the paper · Report a code error (signed in)
Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.
Report a reproduction failure (signed in)
Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
