开源生物信息分析工具ngs-bits的SampleSimilarity 可以用于进行家系分析。
概念说明
Identity by State (IBS): Identity by state is an easy, generally applicable method to measure similarity between unrelated individuals. IBS simply considers the similarity between genotypes at each locus and averages over all the loci of interest. 参考来源
Sample Similarity 计算几个衡量样本相似性的指标:
- overlap_percent: Overlap of the variant lists, i.e. percentage of variants found in both samples - not considering the genotype (only in VCF and GSvar mode).
- correlation: Correlation of variant genotypes for variants found in both samples.
- ibs0: Percentage of variants with zero IBS 基因型完全不一样, e.g. AA and CC (only in BAM mode).
- ibs2: Percentage of variants with complete IBS 基因型完全一样, e.g. AA and AA.
原理简介
计算两个样本基因型相关性步骤:
- 提取两个样本都检出SNP的位置;
- 编码基因型,HOM:1,HET:0.5
- 计算皮尔逊相关性:
$$correlation = \frac{\sum_i [(X_i - X_m) * (Y_i - Y_m)]}{\delta(X) * \delta(Y)}$$
其中 $X_m$, $Y_m$表示编码后的序列平均值,\delta(X) \delta(Y)表示编号后序列标准差
$$overlap_percentage = \frac{X_{snp} \cap Y_{snp}}{min(X_{count}, Y_{count})}$$
其中$X_{snp} \cap Y_{snp}$表示X,Y样本SNP交集,$min(X_{count}, Y_{count})$ 表示两个样本SNP个数较小的一个值
$$ibs2 = \frac{X_{isnp} \cap Y_{isnp}}{min(X_{count}, Y_{count})}$$
与 $overlap_{percentage}$ 计算公式类似,只不过SNP交集是考虑杂合性,即只统计基因型完全相同的SNP,如CC和CC,AG和AG
使用方法
安装
1 | conda config --add channels bioconda |
软件的使用整体比较简单,输入文件为VCF文件,输出文件可以指定一个txt文件,也可以不指定,默认输出为stdout。
1 | SampleSimilarity -in 25D03227091*/vcf/*final.vcf.gz -skip_multi |
结果格式说明: 每两个vcf文件的样本对,后续对应,共突变的位点比例,样本的位点相关性,基因型完全相同的位点比例,样本1的位点个数,样本2的位点个数,注释。
一个外部封装
封装后的项目代码仓库路径: https://gitlab.genomics.cn/bioinfo/ss 。
封装主要对输入文件进行了一些区分,明文指定了父亲、母亲、先证者(孩子)的样本,然后回根据 SampleSimilarity 返回的相关性,进行样本亲缘关系的判定,来确定输入的样本关系是否存在异常。
历史测评数据
显然的,亲缘关系越接近的样本,相关性会越高,历史测试数据也支持这个结论,历史测试的不同关系的样本间的具体数据表现如下:
相同样本相关性一般应该在0.95以上;父母与子女的相关性一般应该在0.55以上;兄弟姐妹的相关性在0.67左右。父母这类无血缘关系的样本一般在0.44左右(数据主要来源于中国人样本,针对不同族裔会有差别)。 统计数据如下:
| relationship | count | mean | start | end |
|---|---|---|---|---|
| sibling | 34 | 0.6783 | 0.5847 | 0.7401 |
| couple | 604 | 0.449 | 0.4225 | 0.4769 |
| grandparent | 4 | 0.5001 | 0.4585 | 0.5417 |
| nephew | 2 | 0.4875 | 0.4262 | 0.5488 |
| parent-child | 1253 | 0.5466 | 0.5213 | 0.5737 |
| relative | 4 | 0.4916 | 0.4778 | 0.5086 |
| unknown | 16 | 0.553 | 0.4945 | 0.5982 |
| 一个更直观的查看方式 | ||||
![]() |
||||
| 不同亲缘关系间的阈值 | ||||
| $$start: Q1 - 1.5 * (Q3 - Q1)$$$$end: Q3 + 1.5 * (Q3 - Q1)$$ |
一般的经验标准
夫妻关系异常:> 0.4769
亲子关系异常:< 0.5213
