简体   繁体   English

如何使用素食主义者在 R 中的 plot 稀疏曲线?

[英]How to plot rarefaction curves in R using Vegan?

I have a dataset containing genes identified in different reference genomes.我有一个数据集,其中包含在不同参考基因组中鉴定的基因。 So, the reference genomes are in the Rows and the genes are in the columns of the table.因此,参考基因组在行中,基因在表的列中。 The table is coded as a binary where 0 means the gene is absent and 1 means the gene is present.该表被编码为二进制,其中0表示基因不存在, 1表示基因存在。 I made gene accumulation curves, which indicates that the number of genes per genomes is approaching a plateau.我做了基因积累曲线,这表明每个基因组的基因数量正在接近一个平台期。 Now, I am trying to plot the rarefaction curves using the R-package vegan .现在,我正在尝试使用 R-package vegan对稀疏曲线进行 plot 。 I used the following codes:我使用了以下代码:

b<-read.csv("data.csv", header = T, check.names = F)
S <- specnumber(b) # observed number of species
(raremax <- min(rowSums(b)))
Srare <- rarefy(b, raremax)
plot(Srare, xlab = "Observed No. of genes", ylab = "Rarefied No. of genes")
abline(0, 1)
rarecurve(b, step = 15, sample = raremax, col = "blue", cex = 0.6)

The data set is like the following:数据集如下:

          gene1 gene2 gene3
#genome1    0     1     0
#genome2    1     0     1
#genome3    1     0     1

However, using this code I am not getting any satisfactory output.但是,使用此代码我没有得到任何令人满意的 output。 I just get only one straight line through the diagonal.我只得到一条通过对角线的直线。 I have attached the output below.我在下面附上了 output。 稀疏曲线

Can someone please suggest me how can I correct the output?有人可以建议我如何纠正 output?

Thank you.谢谢你。

rarefy function rarefies individual rows of your data: it takes a subsample of your occurrences ("individuals") within each row.稀有rarefy稀有数据的各个行:它对每行中出现的事件(“个人”)进行子样本。 If all these sampled individuals have value 1, you will have a subsample of ones, and the sum of ones is the sample size: that was what you got.如果所有这些抽样个体的值都是 1,那么您将有一个子样本,而一个子样本的总和就是样本量:这就是您得到的。 There is no meaningful way of rarefying a vector of ones: you need count data with some counts > 1.稀疏向量没有有意义的方法:您需要一些计数 > 1 的计数数据。

You were perhaps looking for accumulation of genes in your whole data set when subsampling rows of the matrix.在对矩阵的进行二次采样时,您可能正在寻找整个数据集中的基因积累。 This is done in vegan function specaccum (argument method = "exact" ) which has its own plot etc methods.这是在素食主义者function specaccum (参数method = "exact" )中完成的,它有自己的plot等方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM