R 中的遗传分化,函数 genetic_diff()

Genetic differentiation in R, function genetic_diff()

我正在尝试 运行 函数 genetic_diff(): myDiff <- genetic_diff(vcf, pops = pop, method = 'nei')

但我得到以下信息“ 如果(class(x)!=“vcfR”){ 停止(粘贴(“期待 class vcfR 的对象,而不是接收到”,class(vcf)))“

我能做什么?

推测您有一个 vcfR 文件。使用read.vcfR命令读取为vcfR文件,即可成功运行genetic_diff命令。使用 vcfR 示例文件的示例 lumpy.vcf.

x=read.vcfR("filename.txt")
pop=as.factor(c("a", "a", "b"))
genetic_diff(x, pop, method="nei")

   CHROM      POS Hs_a Hs_b        Ht n_a n_b  Gst     Htmax    Gstmax Gprimest
1   chr1 93822813  0.5  0.0 0.4444444   4   2 0.25 0.6666667 0.5000000      0.5
2  chr12 71315481  0.5  NaN 0.5000000   4   0  NaN 0.5000000       NaN      NaN
3  chr12 71315764  0.5  NaN 0.5000000   4   0  NaN 0.5000000       NaN      NaN
4  chr12 71316537  0.5  NaN 0.5000000   4   0  NaN 0.5000000       NaN      NaN
5  chr12 71316539  0.5  NaN 0.5000000   4   0  NaN 0.5000000       NaN      NaN
6  chr13 33618456  0.5  0.5 0.5000000   2   2 0.00 0.7500000 0.3333333      0.0
7  chr15 70302685  0.5  NaN 0.5000000   4   0  NaN 0.5000000       NaN      NaN
8  chr16 25192730  0.5  0.5 0.5000000   4   2 0.00 0.7222222 0.3076923      0.0
9  chr16 25192895  0.5  0.5 0.5000000   4   2 0.00 0.7222222 0.3076923      0.0
10 chr16 25193026  0.5  0.5 0.5000000   4   2 0.00 0.7222222 0.3076923      0.0
11 chr16 25193261  0.5  0.5 0.5000000   4   2 0.00 0.7222222 0.3076923      0.0