r - 如何在 ade4 中使用与 sPCA 包相同的包 adespatial
问题描述
我使用带有函数 sPCA 的包 adegenet 来了解我的遗传数据中是否存在地理模式。
vcf<- read.table("AMZ.012") #samples per line
vcf_m<-as.matrix(vcf)
# Add coordinates of samples
xy <-read.table("CoordAMZ_m.csv", sep=",") #geo coordinates for each sample
矩阵“vcf”有 0 和 1(1 表示有信息,0 表示没有信息),每行是不同的样本,如下例所示:
0 1 0 1
1 1 0 1
1 1 0 0
我按照示例在 R 中使用 adgenet 包运行了 sPCA:
mySpca <- spca(vcf_m, xy, ask=FALSE, type=5, scannf=FALSE)
结果是:
This function is now deprecated. Please use the 'multispati' function in the 'adespatial' package.
我尝试使用这个新功能,但我不知道如何使用与在 sPCA 中实现的功能相同的功能并获得类似的结果。我期待这个 pdf ( http://adegenet.r-forge.r-project.org/files/tutorial-spca.pdf ) 第 7 页中的内容。
如果有人可以帮助我,我会非常高兴。
谢谢。
解决方案
我不确定您是否仍然感兴趣,但这很简单。首先看一下,args(multispati)
看看需要什么。
dudi
所需的第一个参数是在ade4
包中使用的多变量排序分析。
我创建了一个dudi.pca
.
然后listw
需要一个。
这只是一个加权连接网络,类似于您在 sPCA 中使用的,但格式不同。
您可以chooseCN
像在您的 sPCA 中一样使用。
然后使用该功能将您转换myCN
为 a 。listw
nb2listw
希望这可以帮助!
干杯,凯特
推荐阅读
- javascript - 使用 IBM Watson SDK 在 Node JS 中使用麦克风音频输入实时语音到文本
- python - 在 Django 变量中执行 Django 命令
- ios - 通过导入另一个脚本类来测试 swift 脚本
- xamarin.forms - 带有 XAML 的 Xamarin.Forms SDK 样式多平台项目
- c - 如何修复对 register 的引用指向错误的引用?
- python - 触摸:无法触摸“Dockerfile”:权限被拒绝
- javascript - 比较两个不同的数组并将匹配的记录保存在 Java Script 中的另一个数组中
- playframework - Play Framework - conf/routes 文件中的两个资产控制器
- angular - Unique FormControl Names
- typescript - TypeScript 泛型问题:类型 T(扩展类型)不可分配给 T