leospeidel / relate_lib

C++ library containing functions for parsing/dumping Relate output files
MIT License
6 stars 1 forks source link

How to add individual information to treesequence convered from mut/anc file #7

Open Bai-fengting opened 1 year ago

Bai-fengting commented 1 year ago

Hello, I convered mut/anc files infered from relate software to treesequence in aim to calculate genealogical nearest neighbors(GNN). However, I find that the convered treesequence don't record any information about individual of nodes. Can you give me some suggestion?@nspope .Thanks a lot!

nspope commented 1 year ago

You could use tskit.TreeSequence.dump_tables to convert your relate-to-tree-sequence to a tskit.TableCollection, then add rows to the individuals table, and add individual id in the node table -- I think that'd be covered somewhere around https://tskit.dev/tutorials/tables_and_editing.html#individual-and-population-tables -- then convert back to tree sequence with tskit.TableCollection.tree_sequence and save. Let me know if you get stuck!