Rosalind第83题:Inferring Genotype from a Pedigree

Problem

Figure 1. The rooted binary tree whose Newick format is (aa,((Aa,AA),AA)). Each leaf encodes the genotype of an ancestor for the given individual, which is represented by '?'.

图1 根树状二叉树,其Newick格式为(aa,(((Aa,AA),AA))。每个叶子编码给定个体的祖先的基因型,用“?”表示。

rooted binary tree can be used to model the pedigree of an individual. In this case, rather than time progressing from the root to the leaves, the tree is viewed upside down with time progressing from an individual's ancestors (at the leaves) to the individual (at the root).

An example of a pedigree for a single factor in which only the genotypes of ancestors are given is shown in Figure 1.

Given: A rooted binary tree  in Newick format encoding an individual's pedigree for a Mendelian factor whose alleles are A (dominant) and a (recessive).

Return: Three numbers between 0 and 1, corresponding to the respective probabilities that the individual at the root of  will exhibit the "AA", "Aa" and "aa" genotypes.

根的二叉树可用于对个人的谱系进行建模。在这种情况下,不是将时间从根部转移到叶子,而是将树倒置查看,而时间却从一个个体的祖先(在叶子)发展到一个个体(在根部)。

图1显示了一个单一因子的谱系实例,其中仅给出了祖先的基因型 。

给定:纽克(Newick)格式的有根二叉树,编码一个人的血统,用于其等位基因为A(显性)和A(隐性)的孟德尔因子。

返回值: 0到1之间的三个数字,分别对应于根源个人显示“ AA”,“ Aa”和“ aa”基因型的概率。

 

Sample Dataset

((((Aa,aa),(Aa,Aa)),((aa,aa),(aa,AA))),Aa);

Sample Output

0.156 0.5 0.344
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值