Computing GNN for each sample with each sample #2026
-
Hi, all! I have a question about computing the GNN and would appreciate some help. I am looking at your figure from the tsinfer paper. How does one compute the GNN of each sample with each sample (is this is what you did in this figure)? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Hi @janaobsteter! I have been working on code to compute gnns and have successfully Anyhow, I distilled what I believe are the relevant parts and I have I'd be happy to discuss further as I'm currently implementing Cheers, Per |
Beta Was this translation helpful? Give feedback.
-
Hi @janaobsteter . The plotting code is at https://github.com/mcveanlab/treeseq-inference/blob/0cbbb062c96ad4433d8b4d0f120f93ac2d985345/src/plot.py#L1219 and the code to generate the data to plot is at https://github.com/mcveanlab/treeseq-inference/blob/0cbbb062c96ad4433d8b4d0f120f93ac2d985345/human-data/tsutil.py#L333. We actually didn't calculate the GNN of each sample with each, we binned them into populations. However, it would be helpful to have a recipe to do this, so I'll post a snippet below |
Beta Was this translation helpful? Give feedback.
-
@yan Wong, I have a couple more question. I managed to draw the gnn heatmaps for my honeybees - on individual, lineage and country level (different fragmentation). However, it is not as nice as yours (attached the ind plot) and I would like to change the colour scale to not be linear. I've tried a couple of solutions but non of them worked. Do you have any suggestion for this? |
Beta Was this translation helpful? Give feedback.
Hi @janaobsteter . The plotting code is at https://github.com/mcveanlab/treeseq-inference/blob/0cbbb062c96ad4433d8b4d0f120f93ac2d985345/src/plot.py#L1219 and the code to generate the data to plot is at https://github.com/mcveanlab/treeseq-inference/blob/0cbbb062c96ad4433d8b4d0f120f93ac2d985345/human-data/tsutil.py#L333. We actually didn't calculate the GNN of each sample with each, we binned them into populations.
However, it would be helpful to have a recipe to do this, so I'll post a snippet below