R包: phyloseq扩增子统计分析利器

news/2024/9/11 3:45:51/ 标签: r语言, 数据分析, 数据可视化

介绍

phyloseq包对多类型数据的综合软件,并其对这些数据提供统计分析和可视化方法。

  微生物数据分析的主要挑战之一是如何整合不同类型的数据,从而对其进行生态学、遗传学、系统发育学、多元统计、可视化和检验等分析。同时,由于同行之间需要分享彼此的分析结果,如何去重复各自的结果呢?这需要一款统一数据输入接口且包含多种分析方法的软件,而phyloseq就是为处理这样的问题诞生的R包。

phyloseq数据结构

phyloseq对象的输入数据:

  • **otu_table:**也即是物种丰度表,以matrix方式输入,行名是物种名字;
  • **sample_data:**表型数据,包含样本的分组信息和环境因素等,以data.frame方式输入,行名是样本名字;
  • tax_table:物种分类学水平的信息,以matrix方式输入,行名或者第一列是otu_table的行名;
  • **phy_tree:**OTU的进化树关系表,计算uniFrac距离;
  • refseq: DNA,RNA和AA氨基酸的序列信息。

使用

输入数据

  • 物种丰度表: otu_mat
  • 物种分类水平表:tax_mat
  • 样本表型:samples_df
library(dplyr)
library(ggplot2)
library(phyloseq)
library(readxl) 
library(tibble)otu_mat<- read_excel("../datset/CARBOM data.xlsx", sheet = "OTU matrix") %>% column_to_rownames("otu")
tax_mat<- read_excel("../datset/CARBOM data.xlsx", sheet = "Taxonomy table") %>% column_to_rownames("otu")
samples_df <- read_excel("../datset/CARBOM data.xlsx", sheet = "Samples") %>% column_to_rownames("sample")
OTU <- otu_table(otu_mat %>% as.matrix(), taxa_are_rows = TRUE)
TAX <- tax_table(tax_mat %>% as.matrix())
samples <- sample_data(samples_df)carbom <- phyloseq(OTU, TAX, samples)

对phylose对象的处理

# 数据名字
sample_names(carbom)
rank_names(carbom)
sample_variables(carbom)# 数据子集
subset_samples(carbom, Select_18S_nifH =="Yes")
subset_taxa(carbom, Division %in% c("Chlorophyta", "Dinophyta", "Cryptophyta", "Haptophyta", "Ochrophyta", "Cercozoa"))
subset_taxa(carbom, !(Class %in% c("Syndiniales", "Sarcomonadea")))# 中位数测序深度归一化reads数目
total <- median(sample_sums(carbom))
standf <- function(x, t=total){round(t * (x / sum(x)))}
carbom <- transform_sample_counts(carbom, standf)

alpha diversity

plot_richness(carbom, x="fraction", color = "fraction", measures=c("Observed", "Chao1", "ACE", "Shannon", "Simpson", "InvSimpson"))+stat_boxplot(geom='errorbar', linetype=1, width=0.3)+geom_boxplot(aes(color=fraction), alpha=0.1)+ggpubr::stat_compare_means(comparisons = list(c("Nano", "Pico")),method = "wilcox.test")+guides(color=F)+theme_bw()

barplot

plot_bar(carbom, fill = "Division")+theme_bw()+# 0->left; .5->center; 1->righttheme(axis.text.x = element_text(angle = 90, vjust = .5, hjust = 1))

tree

library(ape)
random_tree <- rtree(ntaxa(carbom), rooted=TRUE, tip.label=taxa_names(carbom))
carbom_tree <- phyloseq(OTU, TAX, samples, random_tree)#  at least 20% of reads in at least one sample
carbom_abund <- filter_taxa(carbom_tree, function(x) {sum(x > total*0.20) > 0}, TRUE)plot_tree(carbom_abund, color="fraction", shape="level", label.tips="Division", ladderize="left", plot.margin=0.3)+labs(x="",y="")+scale_color_manual(values = c("red", "blue"))+theme_bw()

heatmap

#  at least 20% of reads in at least one sample
carbom_abund <- filter_taxa(carbom_tree, function(x) {sum(x > total*0.20) > 0}, TRUE)
plot_heatmap(carbom_abund, method = "NMDS", distance = "bray")# 自己设定距离
# plot_heatmap(carbom_abund, method = "MDS", distance = "(A+B-2*J)/(A+B-J)", 
#                taxa.label = "Class", taxa.order = "Class", 
#                trans=NULL, low="beige", high="red", na.value="beige")

For vectors x and y the “quadratic” terms are J = sum(x*y), A = sum(x^2), B = sum(y^2) and “minimum” terms are J = sum(pmin(x,y)), A = sum(x) and B = sum(y), and “binary” terms are either of these after transforming data into binary form (shared number of species, and number of species for each row). Somes examples :

  • A+B-2*J “quadratic” squared Euclidean
  • A+B-2*J “minimum” Manhattan
  • (A+B-2*J)/(A+B) “minimum” Bray-Curtis
  • (A+B-2*J)/(A+B) “binary” Sørensen
  • (A+B-2*J)/(A+B-J) “binary” Jaccard

ordination

# method : c("DCA", "CCA", "RDA", "CAP", "DPCoA", "NMDS", "MDS", "PCoA")
# disrance: unlist(distanceMethodList)
carbom.ord <- ordinate(carbom, method = "PCoA", distance = "bray")# plot_ordination(carbom, carbom.ord, type="taxa", color="Class", shape= "Class", 
#                   title="OTUs")plot_ordination(carbom, carbom.ord, type="samples", color="fraction", shape="level")+geom_point(size=3)+theme_bw()

network analysis

# plot_net(carbom, distance = "(A+B-2*J)/(A+B)", type = "taxa", 
#           maxdist = 0.7, color="Class", point_label="Genus")# plot_net(carbom, distance = "(A+B-2*J)/(A+B)", type = "samples", 
#            maxdist = 0.7, color="fraction", point_label="fraction")plot_net(carbom_abund, distance = "(A+B-2*J)/(A+B)", type = "taxa", maxdist = 0.8, color="Class", point_label="Genus") 

Deseq2 with phyloseq

library(DESeq2)
library(ggplot2)diagdds <- phyloseq_to_deseq2(carbom_abund, ~ fraction)
diagdds <- DESeq(diagdds, test="Wald", fitType="parametric")res <- results(diagdds, cooksCutoff = FALSE)
sigtab <- res[which(res$padj < 0.01), ]
sigtab <- cbind(as(sigtab, "data.frame"), as(tax_table(carbom_abund)[rownames(sigtab), ], "matrix"))
head(sigtab)

rarefaction curves

rarecurve2 <- function (x, step = 1, sample, xlab = "Sample Size", ylab = "Species", label = TRUE, col = "black", ...)## See documentation for vegan rarecurve, col is now used to define## custom colors for lines and panels
{tot <- rowSums(x)S <- vegan::specnumber(x)nr <- nrow(x)out <- lapply(seq_len(nr), function(i) {n <- seq(1, tot[i], by = step)if (n[length(n)] != tot[i])n <- c(n, tot[i])drop(vegan::rarefy(x[i, ], n))})Nmax <- sapply(out, function(x) max(attr(x, "Subsample")))Smax <- sapply(out, max)plot(c(1, max(Nmax)), c(1, max(Smax)), xlab = xlab, ylab = ylab,type = "n", ...)if (!missing(sample)) {abline(v = sample)rare <- sapply(out, function(z) approx(x = attr(z, "Subsample"),y = z, xout = sample, rule = 1)$y)abline(h = rare, lwd = 0.5)}for (ln in seq_len(length(out))) {color <- col[((ln-1) %% length(col)) + 1]N <- attr(out[[ln]], "Subsample")lines(N, out[[ln]], col = color, ...)}if (label) {ordilabel(cbind(tot, S), labels = rownames(x), col = col, ...)}invisible(out)
}## Rarefaction curve, ggplot style
ggrare <- function(physeq, step = 10, label = NULL, color = NULL, plot = TRUE, parallel = FALSE, se = TRUE) {## Args:## - physeq: phyloseq class object, from which abundance data are extracted## - step: Step size for sample size in rarefaction curves## - label: Default `NULL`. Character string. The name of the variable##          to map to text labels on the plot. Similar to color option##          but for plotting text.## - color: (Optional). Default ‘NULL’. Character string. The name of the##          variable to map to colors in the plot. This can be a sample##          variable (among the set returned by##          ‘sample_variables(physeq)’ ) or taxonomic rank (among the set##          returned by ‘rank_names(physeq)’).####          Finally, The color scheme is chosen automatically by##          ‘link{ggplot}’, but it can be modified afterward with an##          additional layer using ‘scale_color_manual’.## - color: Default `NULL`. Character string. The name of the variable##          to map to text labels on the plot. Similar to color option##          but for plotting text.## - plot:  Logical, should the graphic be plotted.## - parallel: should rarefaction be parallelized (using parallel framework)## - se:    Default TRUE. Logical. Should standard errors be computed.## require veganx <- as(otu_table(physeq), "matrix")if (taxa_are_rows(physeq)) { x <- t(x) }## This script is adapted from vegan `rarecurve` functiontot <- rowSums(x)S <- rowSums(x > 0)nr <- nrow(x)rarefun <- function(i) {cat(paste("rarefying sample", rownames(x)[i]), sep = "\n")n <- seq(1, tot[i], by = step)if (n[length(n)] != tot[i]) {n <- c(n, tot[i])}y <- vegan::rarefy(x[i, ,drop = FALSE], n, se = se)if (nrow(y) != 1) {rownames(y) <- c(".S", ".se")return(data.frame(t(y), Size = n, Sample = rownames(x)[i]))} else {return(data.frame(.S = y[1, ], Size = n, Sample = rownames(x)[i]))}}if (parallel) {out <- mclapply(seq_len(nr), rarefun, mc.preschedule = FALSE)} else {out <- lapply(seq_len(nr), rarefun)}df <- do.call(rbind, out)## Get sample dataif (!is.null(sample_data(physeq, FALSE))) {sdf <- as(sample_data(physeq), "data.frame")sdf$Sample <- rownames(sdf)data <- merge(df, sdf, by = "Sample")labels <- data.frame(x = tot, y = S, Sample = rownames(x))labels <- merge(labels, sdf, by = "Sample")}## Add, any custom-supplied plot-mapped variablesif( length(color) > 1 ){data$color <- colornames(data)[names(data)=="color"] <- deparse(substitute(color))color <- deparse(substitute(color))}if( length(label) > 1 ){labels$label <- labelnames(labels)[names(labels)=="label"] <- deparse(substitute(label))label <- deparse(substitute(label))}p <- ggplot(data = data, aes_string(x = "Size", y = ".S", group = "Sample", color = color))p <- p + labs(x = "Sample Size", y = "Species Richness")if (!is.null(label)) {p <- p + geom_text(data = labels, aes_string(x = "x", y = "y", label = label, color = color),size = 4, hjust = 0)}p <- p + geom_line()if (se) { ## add standard error if availablep <- p + geom_ribbon(aes_string(ymin = ".S - .se", ymax = ".S + .se", color = NULL, fill = color), alpha = 0.2)}if (plot) {plot(p)}invisible(p)
}ggrare(carbom, step = 100, color = "fraction", label = "fraction", se = FALSE)

ternary

ternary_norm <- function(physeq, group, levelOrder = NULL, raw = FALSE, normalizeGroups = TRUE) {## Args:## - phyloseq class object, otus abundances are extracted from this object## - group: Either the a single character string matching a##          variable name in the corresponding sample_data of ‘physeq’, or a##          factor with the same length as the number of samples in ‘physeq’.## - raw: logical, should raw read counts be used to compute relative abudances of an##        OTU among different conditions (defaults to FALSE)## - levelOrder: Order along which to rearrange levels of `group`. Goes like (left, top, right) for##               ternary plots and (left, top, right, bottom) for diamond plots. ## - normalizeGroups: logical, only used if raw = FALSE, should all levels be given##                    equal weights (TRUE, default) or weights equal to their sizes (FALSE)## Get grouping factor if (!is.null(sam_data(physeq, FALSE))) {if (class(group) == "character" & length(group) == 1) {x1 <- data.frame(sam_data(physeq))if (!group %in% colnames(x1)) {stop("group not found among sample variable names.")}group <- x1[, group]}}if (class(group) != "factor") {group <- factor(group)}## Reorder levels of factorif (length(levels(group)) > 4) {warnings("There are 5 groups or more, the data frame will not be suitable for ternary plots.")}if (!is.null(levelOrder)) {if (any(! group %in% levelOrder)) {stop("Some levels of the factor are not included in `levelOrder`")} else {group <- factor(group, levels = levelOrder)}}## construct relative abundances matrixtdf <- as(otu_table(physeq), "matrix")if (!taxa_are_rows(physeq)) { tdf <- t(tdf) }## If raw, no normalisation should be doneif (raw) {tdf <- t(tdf)abundance <- rowSums(t(tdf))/sum(tdf)meandf <- t(rowsum(tdf, group, reorder = TRUE))/rowSums(t(tdf))} else {        ## Construct relative abundances by sampletdf <- apply(tdf, 2, function(x) x/sum(x))if (normalizeGroups) {meandf <- t(rowsum(t(tdf), group, reorder = TRUE)) / matrix(rep(table(group), each = nrow(tdf)),nrow = nrow(tdf))abundance <- rowSums(meandf)/sum(meandf)meandf <- meandf / rowSums(meandf)} else {abundance <- rowSums(tdf)/sum(tdf)meandf <- t(rowsum(t(tdf), group, reorder = TRUE))/rowSums(tdf)}}## Construct cartesian coordinates for de Finetti's diagram## (taken from wikipedia, http://en.wikipedia.org/wiki/Ternary_plot)if (ncol(meandf) == 3) {ternary.coord <- function(a,b,c) { # a = left, b = right, c = topreturn(data.frame(x = 1/2 * (2*b + c)/(a + b + c),y = sqrt(3) / 2 * c / (a + b + c)))}cat(paste("(a, b, c) or (left, right, top) are (",paste(colnames(meandf), collapse = ", "),")", sep = ""), sep = "\n")## Data pointsdf <- data.frame(x = 1/2 * (2*meandf[ , 2] + meandf[ , 3]),y = sqrt(3)/2 * meandf[ , 3],abundance = abundance, row.names = rownames(meandf))## Extreme pointsextreme <- data.frame(ternary.coord(a = c(1, 0, 0),b = c(0, 1, 0),c = c(0, 0, 1)),labels = colnames(meandf),row.names = c("left", "right", "top"))}if (ncol(meandf) == 4) {diamond.coord <- function(a, b, c, d) {return(data.frame(x = (a - c) / (a + b + c + d),y = (b - d) / (a + b + c + d)))}cat(paste("(a, b, c, d) or (right, top, left, bottom) are (",paste(colnames(meandf), collapse = ", "),")", sep = ""), sep = "\n")## data pointsdf <- data.frame(x = (meandf[ , 1] - meandf[ , 3]),y = (meandf[ , 2] - meandf[ , 4]),abundance = abundance, row.names = rownames(meandf))## extreme pointsextreme <- data.frame(diamond.coord(a = c(1, 0, 0, 0),b = c(0, 1, 0, 0),c = c(0, 0, 1, 0),d = c(0, 0, 0, 1)),labels = colnames(meandf),row.names = c("right", "top", "left", "bottom"))}## Merge coordinates with taxonomix informationdf$otu <- rownames(df)## Add taxonomic informationif (!is.null(tax_table(physeq, FALSE))) {tax <- data.frame(otu = rownames(tax_table(physeq)),tax_table(physeq))df <- merge(df, tax, by.x = "otu")}## Add attributesattr(df, "labels") <- colnames(meandf)attr(df, "extreme") <- extremeattr(df, "type") <- c("ternary", "diamond", "other")[cut(ncol(meandf), breaks = c(0, 3, 4, Inf))]return(df)
}ternary_plot <- function(physeq, group, grid = TRUE, size = "log2(abundance)",color = NULL, shape = NULL, label = NULL,levelOrder = NULL, plot = TRUE,raw = FALSE, normalizeGroups = TRUE) {## Args:## - phyloseq class object, otus abundances are extracted from this object## - group: Either the a single character string matching a##          variable name in the corresponding sample_data of ‘physeq’, or a##          factor with the same length as the number of samples in ‘physeq’.## - raw: logical, should raw read counts be used to compute relative abudances of an##        OTU among different conditions (defaults to FALSE)## - normalizeGroups: logical, only used if raw = FALSE, should all levels be given##                    equal weights (TRUE, default) or weights equal to their sizes (FALSE)## - levelOrder: Order along which to rearrange levels of `group`. Goes like (left, top, right) for##               ternary plots and (left, top, right, bottom) for diamond plots.## - plot: logical, should the figure be plotted## - grid: logical, should a grid be plotted.## - size: mapping for size aesthetics, defaults to `abundance`.## - shape: mapping for shape aesthetics.## - color: mapping for color aesthetics.## - label: Default `NULL`. Character string. The name of the variable##          to map to text labels on the plot. Similar to color option##          but for plotting text.data <- ternary_norm(physeq, group, levelOrder, raw, normalizeGroups)labels <- attr(data, "labels")extreme <- attr(data, "extreme")type <- attr(data, "type")if (type == "other") {stop("Ternary plots are only available for 3 or 4 levels")}## bordersborders <- data.frame(x = extreme$x,y = extreme$y,xend = extreme$x[c(2:nrow(extreme), 1)],yend = extreme$y[c(2:nrow(extreme), 1)])## gridternary.coord <- function(a,b,c) { # a = left, b = right, c = topreturn(data.frame(x = 1/2 * (2*b + c)/(a + b + c),y = sqrt(3) / 2 * c / (a + b + c)))}diamond.coord <- function(a, b, c, d) {return(data.frame(x = (a - c) / (a + b + c + d),y = (b - d) / (a + b + c + d)))}x <- seq(1, 9, 1) / 10    ## Create base plot with theme_bwp <- ggplot() + theme_bw()## Remove normal grid, axes titles and axes ticksp <- p + theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank(), panel.border = element_blank(),axis.ticks = element_blank(), axis.text.x = element_blank(),axis.text.y = element_blank(),axis.title.x = element_blank(),axis.title.y = element_blank())if (type == "ternary") {## prepare levels' labelsaxes <- extremeaxes$x <- axes$x + c(-1/2, 1/2, 0) * 0.1axes$y <- axes$y + c(-sqrt(3)/4, -sqrt(3)/4, sqrt(3)/4) * 0.1## prepare ternary gridbottom.ticks <- ternary.coord(a = x, b = 1-x, c = 0)left.ticks <- ternary.coord(a = x, b = 0, c = 1-x)right.ticks <- ternary.coord(a = 0, b = 1 - x, c = x)ticks <- data.frame(bottom.ticks, left.ticks, right.ticks)colnames(ticks) <- c("xb", "yb", "xl", "yl", "xr", "yr")## Add grid (optional)if (grid == TRUE) {p <- p + geom_segment(data = ticks, aes(x = xb, y = yb, xend = xl, yend = yl),size = 0.25, color = "grey40")p <- p + geom_segment(data = ticks, aes(x = xb, y = yb, xend = xr, yend = yr),size = 0.25, color = "grey40")p <- p + geom_segment(data = ticks, aes(x = rev(xl), y = rev(yl), xend = xr, yend = yr),size = 0.25, color = "grey40")}}if (type == "diamond") {## prepare levels' labelsaxes <- extremeaxes$x <- axes$x + c(1, 0, -1, 0) * 0.1axes$y <- axes$y + c(0, 1, 0, -1) * 0.1## prepare diamond grid nw.ticks <- diamond.coord(a = x, b = 1-x, c = 0, d = 0)ne.ticks <- diamond.coord(a = 0, b = x, c = 1-x, d = 0)sw.ticks <- diamond.coord(a = x, b = 0, c = 0, d = 1 - x)se.ticks <- diamond.coord(a = 0, b = 0, c = 1-x, d = x)ticks <- data.frame(nw.ticks, ne.ticks, se.ticks, sw.ticks)colnames(ticks) <- c("xnw", "ynw", "xne", "yne","xse", "yse", "xsw", "ysw")        ## Add grid (optional)if (grid == TRUE) {p <- p + geom_segment(data = ticks, aes(x = xnw, y = ynw, xend = xse, yend = yse),size = 0.25, color = "grey40")p <- p + geom_segment(data = ticks, aes(x = xne, y = yne, xend = xsw, yend = ysw),size = 0.25, color = "grey40")p <- p + geom_segment(aes(x = c(0, -1), y = c(-1, 0),xend = c(0, 1), yend = c(1, 0)),size = 0.25, color = "grey40")}}## Add bordersp <- p + geom_segment(data = borders, aes(x = x, y = y, xend = xend, yend = yend))## Add levels' labelsp <- p + geom_text(data = axes, aes(x = x, y = y, label = labels))## Add, any custom-supplied plot-mapped variablesif( length(color) > 1 ){data$color <- colornames(data)[names(data)=="color"] <- deparse(substitute(color))color <- deparse(substitute(color))}if( length(shape) > 1 ){data$shape <- shapenames(data)[names(data)=="shape"] <- deparse(substitute(shape))shape <- deparse(substitute(shape))}	if( length(label) > 1 ){data$label <- labelnames(data)[names(data)=="label"] <- deparse(substitute(label))label <- deparse(substitute(label))}if( length(size) > 1 ){data$size <- sizenames(data)[names(data)=="size"] <- deparse(substitute(size))size <- deparse(substitute(size))}## Add data pointsternary_map <- aes_string(x = "x", y = "y", color = color,shape = shape, size = size, na.rm = TRUE)p <- p + geom_point(data = data, mapping = ternary_map)## Add the text labelsif( !is.null(label) ){label_map <- aes_string(x="x", y="y", label=label, na.rm=TRUE)p <- p + geom_text(data = data, mapping = label_map,size=3, vjust=1.5, na.rm=TRUE)}if (plot) {plot(p)}invisible(p)   
}samples_df$New_group <- paste0("group_", replicate(nrow(samples_df), sample(c("A", "B", "C"), 1, replace = FALSE)))samples <- sample_data(samples_df)carbom <- phyloseq(OTU, TAX, samples)
# color or shape are taxonomy
ternary_plot(carbom, "New_group", color = "Division")

参考

  1. phyloseq tutorial
  2. phyloseq: An R Package for Reproducible Interactive Analysis and Graphics of Microbiome Census Data
  3. phyloseq extend
  4. phyloseq tutorial 2

http://www.ppmy.cn/news/1475385.html

相关文章

期货量化交易客户端开源教学第九节——新用户注册

一、新用户注册界面设计&#xff1a; 注册时采用手机号注册&#xff0c;客户端发送新号注册申请由后台做审核&#xff0c;后台审核通过后向注册的手机号发送注册成功的消息。注册过的手机号不能再二次注册。 界面验证代码 private{ Private declarations }FVerf: AnsiString; …

【QT】布局管理器

布局管理器 布局管理器1. 垂直布局2. 水平布局3. 网格布局4. 表单布局5. Spacer 布局管理器 之前使⽤ Qt 在界⾯上创建的控件, 都是通过 “绝对定位” 的⽅式来设定的&#xff1b;也就是每个控件所在的位置, 都需要计算坐标, 最终通过 setGeometry 或者 move ⽅式摆放过去。 …

java 前端上传文件后端解析并转发到第三方存储,Hutool 工具

单个文件上传 PostMapping("/upload")public MyResponse<?> upload(MultipartFile file) {if (multipartFiles null || multipartFiles.length 0) {throw new MessageException("未选择文件");}InputStreamResource inputStreamResource new Inp…

实用教程:用 Go 的 net/textproto 包优化文本协议处理

实用教程&#xff1a;用 Go 的 net/textproto 包优化文本协议处理 介绍准备工作环境设置Go 基础回顾 基础使用创建连接发送请求接收响应 高级特性处理 MIME 头多行响应的管理错误处理与调试 实战案例实现一个简单的邮件客户端实现一个基于 net/textproto 的命令行工具 最佳实践…

从零开始开发视频美颜SDK:实现直播美颜效果

因此&#xff0c;开发一款从零开始的视频美颜SDK&#xff0c;不仅可以节省成本&#xff0c;还能根据具体需求进行个性化调整。本文将介绍从零开始开发视频美颜SDK的关键步骤和实现思路。 一、需求分析与技术选型 在开发一款视频美颜SDK之前&#xff0c;首先需要进行详细的需求…

WPF界面设计-更改按钮样式 自定义字体图标

一、下载图标文件 iconfont-阿里巴巴矢量图标库 二、xaml界面代码编辑 文件结构 &#xe653; 对应的图标代码 Fonts/#iconfont 对应文件位置 <Window.Resources><ControlTemplate TargetType"Button" x:Key"CloseButtonTemplate"…

数据结构与算法基础-学习-37-平衡二叉树(Avl树)之删除节点

目录 一、知识点回顾 1、二叉搜索树&#xff08;BST&#xff09; 2、平衡二叉树&#xff08;Avl树&#xff09;之查找 二、环境信息 三、实现思路 1、示例图 2、查询 3、删除 &#xff08;1&#xff09;叶子节点&#xff08;无子树节点&#xff09; &#xff08;2&am…

如何为IP申请SSL证书

目录 以下是如何轻松为IP地址申请SSL证书的详细步骤&#xff1a; 申请IP证书的基本条件&#xff1a; 申请IP SSL证书的方式&#xff1a; 确保网络通信安全的核心要素之一&#xff0c;是有效利用SSL证书来加密数据传输&#xff0c;特别是对于那些直接通过IP地址访问的资源。I…

同步的艺术:Conda包依赖的自动同步策略

同步的艺术&#xff1a;Conda包依赖的自动同步策略 引言 在复杂的软件开发项目中&#xff0c;依赖管理是确保项目顺利进行的关键环节。Conda作为Python和其他科学计算语言的强大包管理器&#xff0c;提供了依赖同步功能&#xff0c;帮助用户自动化和简化依赖项的同步过程。本…

Oracle数据文件扩容

1、增加数据文件扩容 ALTER TABLESPACE app_data ADD DATAFILE D:\ORACLE\PRODUCT\10.2.0\ORADATA\EDWTEST\APP04.DBF SIZE 30G AUTOEXTEND ON NEXT 1G MAXSIZE UNLIMITED; ALTER database datafile /ora/oradata/radius/undo.dbf resize 32G; alter tablespace sysaux add …

WEB安全-文件上传漏洞

1 需求 2 接口 move_uploaded_file basename pathinfo strtolower htmlspecialchars move_uploaded_file() 是 PHP 中的一个函数&#xff0c;它用于将临时文件移动到新位置。这个函数特别在文件上传处理中非常有用&#xff0c;因为它允许你将用户上传的文件从 PHP 的临时存…

AIGC学习笔记—LLM(前言)

大语言模型本身我不是很了解&#xff0c;但是掌握一些基础的知识点&#xff0c;由于要准备某个公司的二面&#xff0c;所以浅学一下这个技术&#xff0c;也是边摸索边学习...... 首先&#xff0c;我先简单的解释一下大模型&#xff0c;大模型是指具有大规模参数和复杂计算结构…

【新书速递】使用MATLAB进行雷达系统分析和设计(第四版)(2022)

来源&#xff1a;公众号高山防务 一、目录 目录 1雷达定义和术语 1.1雷达系统分类和波段 1.1.1高频&#xff08;HF&#xff09;和甚高频&#xff08;VHF&#xff09;雷达&#xff08;A和B波段&#xff09; 1.1.2超高频&#xff08;UHF&#xff09;雷达&#xff08;C波段&am…

sqlserver 自动编号初始化

在SQL Server中&#xff0c;可以使用IDENTITY属性来创建一个自动增长的序列&#xff0c;这通常用于主键。在创建表时&#xff0c;可以指定某一列为IDENTITY列&#xff0c;并给出起始值和增量。 以下是一个创建表并使用IDENTITY属性初始化自动编号的示例&#xff1a; CREATE T…

Three.js机器人与星系动态场景(四):封装Threejs业务组件

实际在写业务的时候不会在每个组件里都写几十行的threejs的初始化工作。我们可以 将通用的threejs的场景、相机、render、轨道控制器等进行统一初始化。同时将非主体的函数提到组件外部&#xff0c;通过import导入进组件。将业务逻辑主体更清晰一些。下面的代码是基于reactthre…

[计网初识1] TCP/UDP

学习内容 1.TCP建立链接的3次握手&#xff0c;断开连接的4次挥手 2.TCP报文段组成 内容 1.TCP 建立连接的3次握手? 假设主动方是客户端&#xff0c;被动方是服务端。 第一次 客户端给服务端发送 “hello,我是客户端” (TCP段中 SYN1) 第二次 服务端给客户端发送"我接…

C# 建造者模式(Builder Pattern)

建造者模式&#xff08;Builder Pattern&#xff09;&#xff0c;也被称为生成器模式&#xff0c;是一种对象构建模式&#xff0c;旨在将复杂对象的构建过程与表示分离&#xff0c;使得同样的构建过程可以创建不同的表示。这种模式特别适用于构建具有多个组成部分的复杂对象&am…

centos单机配置多个内网IP地址

centos单机配置多个内网IP地址 引配置1. 查看当前网络IP配置2. 打开网络配置目录3. 设置静态IP4. 编辑ifcfg-eno1:15. 重启网络配置 引 同一个局域网&#xff0c;但是对接的多个子系统使用了不同的网段&#xff0c;如一个系统主机IP地址是192.168.10.1&#xff0c;另一个系统主…

智能制造热点词汇科普篇——工业微服务

随着互联网技术的不断发展&#xff0c;近十年来&#xff0c;微服务也逐渐走进人们的视线中来。何为微服务&#xff1f;让我们先来看看百度百科上的定义&#xff1a;微服务&#xff08;或称微服务架构&#xff09;是一种云原生架构方法&#xff0c;在单个应用中包含众多松散耦合…

java Web 优秀本科毕业论文系统用eclipse定制开发mysql数据库BS模式java编程jdbc

一、源码特点 JSP 优秀本科毕业论文系统是一套完善的web设计系统&#xff0c;对理解JSP java serlvet 编程开发语言有帮助&#xff0c;系统具有完整的源代码和数据库&#xff0c;系统主要采用B/S模式开发。开发环境为TOMCAT7.0,eclipse开发&#xff0c;数据库为Mysql5.0&a…