-3

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

但我得到以下信息“ if(class(x) != "vcfR"){ stop(paste("期望类 vcfR 的对象,而不是收到", class(vcf)))"

我能做些什么?

4

1 回答 1

0

大概你有一个 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
于 2021-03-11T20:13:28.867 回答