We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I used the data from https://raw.githubusercontent.com/taowenmicro/R-_function/main/. R script is: metadata = read.delim("./metadata.tsv",row.names = 1) otutab = read.delim("./otutab.txt", row.names=1) taxonomy = read.table("./taxonomy.txt", row.names=1)
ps = phyloseq(sample_data(metadata), otu_table(as.matrix(otutab), taxa_are_rows=TRUE), tax_table(as.matrix(taxonomy))#, # phy_tree(tree), # refseq(rep) )
#-提取丰度最高的指定数量的otu进行构建网络
#----------计算相关#---- result = corMicro (ps = ps, N = 150, method.scale = "TMM", r.threshold=0.8, p.threshold=0.05, method = "spearman"
)
#--提取相关矩阵 cor = result[[1]] head(cor)
#-网络中包含的OTU的phyloseq文件提取 ps_net = result[[3]]
#-导出otu表格 otu_table = ps_net %>% vegan_otu() %>% t() %>% as.data.frame()
netClu = data.frame(ID = row.names(otu_table),group =rep(1:5,length(row.names(otu_table)))[1:length(row.names(otu_table))] ) netClu$group = as.factor(netClu$group) head(netClu) #--------计算布局#--------- result2 = PolygonClusterG (cor = cor,nodeGroup =netClu ) node = result2[[1]] head(node) edge = edgeBuild(cor = cor,node = node) head(edge) p <- ggplot() + geom_segment(aes(x = X1, y = Y1, xend = X2, yend = Y2,color = as.factor(cor)), data = edge, size = 0.5) + geom_point(aes(X1, X2,fill = Phylum,size = mean),pch = 21, data = nodes) + scale_colour_brewer(palette = "Set1") + scale_x_continuous(breaks = NULL) + scale_y_continuous(breaks = NULL) + theme(panel.background = element_blank()) + theme(axis.title.x = element_blank(), axis.title.y = element_blank()) + theme(legend.background = element_rect(colour = NA)) + theme(panel.background = element_rect(fill = "white", colour = NA)) + theme(panel.grid.minor = element_blank(), panel.grid.major = element_blank()) p
But can't plot . Error is Must request at least one colour from a hue palette.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I used the data from https://raw.githubusercontent.com/taowenmicro/R-_function/main/.
R script is:
metadata = read.delim("./metadata.tsv",row.names = 1)
otutab = read.delim("./otutab.txt", row.names=1)
taxonomy = read.table("./taxonomy.txt", row.names=1)
tree = read_tree("./otus.tree")
rep = readDNAStringSet("./otus.fa")
ps = phyloseq(sample_data(metadata),
otu_table(as.matrix(otutab), taxa_are_rows=TRUE),
tax_table(as.matrix(taxonomy))#,
# phy_tree(tree),
# refseq(rep)
)
#-提取丰度最高的指定数量的otu进行构建网络
#----------计算相关#----
result = corMicro (ps = ps,
N = 150,
method.scale = "TMM",
r.threshold=0.8,
p.threshold=0.05,
method = "spearman"
)
#--提取相关矩阵
cor = result[[1]]
head(cor)
#-网络中包含的OTU的phyloseq文件提取
ps_net = result[[3]]
#-导出otu表格
otu_table = ps_net %>%
vegan_otu() %>%
t() %>%
as.data.frame()
netClu = data.frame(ID = row.names(otu_table),group =rep(1:5,length(row.names(otu_table)))[1:length(row.names(otu_table))] )
netClu$group = as.factor(netClu$group)
head(netClu)
#--------计算布局#---------
result2 = PolygonClusterG (cor = cor,nodeGroup =netClu )
node = result2[[1]]
head(node)
edge = edgeBuild(cor = cor,node = node)
head(edge)
p <- ggplot() + geom_segment(aes(x = X1, y = Y1, xend = X2, yend = Y2,color = as.factor(cor)),
data = edge, size = 0.5) +
geom_point(aes(X1, X2,fill = Phylum,size = mean),pch = 21, data = nodes) +
scale_colour_brewer(palette = "Set1") +
scale_x_continuous(breaks = NULL) + scale_y_continuous(breaks = NULL) +
theme(panel.background = element_blank()) +
theme(axis.title.x = element_blank(), axis.title.y = element_blank()) +
theme(legend.background = element_rect(colour = NA)) +
theme(panel.background = element_rect(fill = "white", colour = NA)) +
theme(panel.grid.minor = element_blank(), panel.grid.major = element_blank())
p
But can't plot . Error is Must request at least one colour from a hue palette.
The text was updated successfully, but these errors were encountered: