Inferring whole-genome histories in large population datasets: inferred tree sequences for Simons Genome Diversity Project
收藏资源简介:
Tree sequences inferred for the SGDP autosomes using tsinfer version 0.1.4 and compressed using tszip. Tree sequences can be decompressed as follows: <pre><code class="language-bash">$ tsunzip sgdp_chr1.trees.tsz</code></pre> Once decompressed, trees files can be loaded and processed using tskit. <pre><code class="language-python">import tskit ts = tskit.load("sgdp_chr1.trees") # ts is an instance of tskit.TreeSequence print("Chromosome 1 contains {} trees".format(ts.num_trees))</code></pre> Metadata associated with individuals and populations was derived from the original source and converted to JSON form. For example, to access individual metadata we can use: <pre><code class="language-python">import tskit import json ts = tskit.load("sgdp_chr1.trees") ind = ts.individual(0) metadata_dict = json.loads(ind.metadata)</code></pre> The metadata_dict variable will now contain all the metadata for the individual with ID 0 as a dictionary. Metadata associated with populations can be found in a similar way. Population IDs are associated with individuals via their constituent nodes. For example, <pre><code class="language-python">pop_metadata = [json.loads(pop.metadata) for pop in ts.populations()] ind_node = ts.node(ind.nodes[0]) ind_pop_metadata = pop_metadata[ind_node.population]</code></pre> After this, the ind_pop_metadata variable will contain the population level metadata for individual ID 0. The full data pipeline used to generate these tree sequences and associated metadata is available on GitHub.
本数据集为使用tsinfer 0.1.4版本对SGDP常染色体推演得到的树序列(Tree sequence),并经tszip完成压缩存储。树序列可通过如下命令解压缩: <pre><code class="language-bash">$ tsunzip sgdp_chr1.trees.tsz</code></pre> 解压缩完成后,可使用tskit加载并处理树序列文件。示例代码如下: <pre><code class="language-python">import tskit ts = tskit.load("sgdp_chr1.trees") # ts 为 tskit.TreeSequence 类的实例 print("1号染色体共包含 {} 棵树".format(ts.num_trees))</code></pre> 个体与群体相关的元数据均取自原始数据源,并已转换为JSON格式。例如,若需获取个体元数据,可执行如下代码: <pre><code class="language-python">import tskit import json ts = tskit.load("sgdp_chr1.trees") ind = ts.individual(0) metadata_dict = json.loads(ind.metadata)</code></pre> 此时,metadata_dict变量将以字典形式存储ID为0的个体的全部元数据。群体相关元数据的获取方式与此类似。 群体ID通过个体所包含的节点与个体建立关联,示例代码如下: <pre><code class="language-python">pop_metadata = [json.loads(pop.metadata) for pop in ts.populations()] ind_node = ts.node(ind.nodes[0]) ind_pop_metadata = pop_metadata[ind_node.population]</code></pre> 执行上述代码后,ind_pop_metadata变量将存储ID为0的个体对应的群体级元数据。 用于生成此类树序列及关联元数据的完整数据流程已公开至GitHub平台。



