1:"Bacteria|Proteobacteria|Betaproteobacteria|Neisseriales|Neisseriaceae|Kingella" 2:"Bacteria|Proteobacteria|Betaproteobacteria|Neisseriales|Neisseriaceae|unclassified"
# 未识别到的/未注解到的物种,不可以在OTU/ASV表中直接删掉,识别到的水平 ,例如把上面的第2个,删除成“Bacteria|Proteobacteria|Betaproteobacteria|Neisseriales|Neisseriaceae”,这科水平Bacteria|Proteobacteria|Betaproteobacteria|Neisseriales|Neisseriaceae,代表的是底下所有合并的情况。不允许单独去掉未识别到的那部分。
在进行物种进化树或者cladogram或者GraPhlAn绘制
rm(list=ls())
# devtools::install_github("lch14forever/microbiomeViz")
library(microbiomeViz)
data("SRS014459_Stool_profile")
SRS014459_Stool_profile$V1[14:55]
# 自己数据转成这个
rm(list=ls())
pacman::p_load(tidyverse,microeco,magrittr)
data(dataset)
library(readxl)
library(dplyr)
df <- read.csv("10_lefse.csv")
df <- df[-1,]
df <- t(df)
tax <- df[1,]
medians <- c()
df_count=as.data.frame(df[-1,])
dim(df_count)
df_count[,1:ncol(df)] <- apply(df_count[,1:ncol(df)],2,as.numeric )
median_c <- purrr::map_dbl(df_count,.f = median)
srs$V1
srs <- data.frame(V1=tax,V2=median_c)
srs <- tidyr::separate(
string = srs$V1,pattern = "|")
tax_table$Kingdom <- paste0(median_ctax_table$Kingdom <- paste0("k__",tax_table$Kingdom)
tax_table$Phylum <- paste0("p__",tax_table$Phylum)
tax_table$Class <- paste0("c__",tax_table$Class)
tax_table$Order <- paste0("o__",tax_table$Order)
tax_table$Family <- paste0("f__",tax_table$Family)
tax_table$Genus <- paste0("g__",tax_table$Genus)
#
tr <- parseMetaphlanTSV(SRS014459_Stool_profile)
p <- tree.backbone(
tr,
size = 0.8,
layout = "fan" # "rectangular", "slanted", "fan", "circular", "inward_circular",
)
p
anno.data <- data.frame(node=c("g__Roseburia",
"g__Bacteroides",
"o__Clostridiales",
"s__Bacteroides_ovatus"),
color=c('darkgreen','red',
'darkgreen','red'
),
stringsAsFactors = FALSE)
p <- clade.anno(p, anno.data)
p