GithubHelp home page GithubHelp logo

easymicrobiomer's Introduction

Using R language in microbiome analysis

Tao Wen2, ‡, Guoqing Niu2, ‡, Qirong Shen2, Jun Yuan2,, Yong-Xin Liu1,

image

Abstract

With the gradual maturity of sequencing technology, many microbiome studies have emerged, driving the emergence and advance of related analysis tools. R language is the widely used platform for microbiome data analysis for the powerful functions. However, the tens of thousands of R packages and numerous similar analysis tools have brought major challenges for many researchers to explore microbiome data. How to choose suitable, efficient, convenient, and easy-to-learn tools from the numerous R packages has become a problem for many microbiome researchers. We have organized 322 common R packages for microbiome analysis, classified them according to functional categories (diversity, differential, biomarker, correlation and network analysis, functional prediction, and other), which could help researchers quickly find relevant R packages for microbiome analysis. Furthermore, we systematically sorted the integrated R packages (phyloseq, microbiome, MicrobiomeAnalystR, Animalcules, microeco, and amplicon) for microbiome analysis, and summarized the advantages and limitations, which will help researchers choose the appropriate tools. Finally, we conducted a thorough review of the R packages for microbiome analysis, summarized most of the common analysis content in microbiome, and formed the most suitable pipeline for microbiome analysis. This paper accompanied by detailed code examples, which can help beginners to learn, as well as help analysts compare and test different tools. This paper systematically sorts out the application of R language in microbiome methods, providing an important theoretical basis and practical reference for the development of better microbiome tools in the future. All the code is available at GitHub: https://github.com/taowenmicro/easy_microbiome.

To install all the required R packages for this project

To install most of the required R packages for this project at once using a saved list of R packages.


#-批量全部安装R包#--------
tab= read.csv("./all.install.packages.csv")
#--查看已经加载的R包
(.packages())
#--判断用户有的R包,然后再安用户缺乏的R包
tem = as.data.frame(installed.packages())$Package
# 找到tab$x中有,但是tem中没有的包
id = setdiff(tab$x,tem)
length(id)

#-提取不好安装的R包或者github的R包
tab.gb = c("basilisk","ConQuR","EasyMicroPlot",
           "EasyStat" ,"ggClusterNet","ggtern",
           "metacoder","MicrobiomeAnalystR", "pulsar" ,
           "SpiecEasi","Tax4Fun","Tax4Fun2")


# 查看装包路径或者修改装包路径
# .libPaths(new = "C:/Users/asus/AppData/Local/R/win-library/4.3")
.libPaths()

for (i in 1:length(id)) {

  if (!requireNamespace("BiocManager", quietly = TRUE)) {
    install.packages("BiocManager",update = FALSE)
  }
  if (!requireNamespace("devtools", quietly = TRUE)) {
    install.packages("devtools",update = FALSE)
  }
  if (!requireNamespace("remotes", quietly = TRUE)) {
    install.packages("remotes",update = FALSE)
  }
  if (id[i] %in% tab.gb) {
    print("github packages")
  } else{
    if (!requireNamespace(id[i], quietly = TRUE)) {
      try(BiocManager::install(id[i],update = FALSE))
    }
  }

  tem = as.data.frame(installed.packages())$Package
  # 找到tab$x中有,但是tem中没有的包
  id = setdiff(tab$x,tem)
  length(id)


}


#-单独安装github,或者不好安装的R包
devtools::install_github("taowenmicro/EasyStat",upgrade = "never")
devtools::install_github("taowenmicro/ggClusterNet",upgrade = "never")
devtools::install_github("zdk123/SpiecEasi")
devtools::install_github("fjossandon/Tax4Fun2")
devtools::install_github("kylebittinger/qiimer")
devtools::install_github("joey711/biom",upgrade = "never",force = TRUE)
install.packages("./install.packages.for.local/Tax4Fun/", repos = NULL, type = "source")
devtools::install_github("xia-lab/MicrobiomeAnalystR",
                         build = TRUE,
                         build_opts = c("--no-resave-data", "--no-manual"))

install.packages("./install.packages.for.local/ggtern/", repos = NULL, type = "source")
# Error: Failed to install 'ggtern' from GitHub:
#   ! System command 'Rcmd.exe' failed
remotes::install_github("https://github.com/xielab2017/EasyMicroPlot",
                        subdir='Version_0.5')
install.packages("microeco")



Contents

Before microbiome data analysis

  • 1.Before microbiome data analysis/Code1A-2H.Rmd

Microbial community analysis

  • 2.Microbial community analysis/Code3A-8E.Rmd

Integrated R packages for microbiome

  • 3.Integrated R packages for microbiome/Pipeline1-6/01.phyloseq/pipeline.1.phyloseq.Rmd

  • 3.Integrated R packages for microbiome/Pipeline1-6/02.microbiome/pipeline.2.microbiome.Rmd

  • 3.Integrated R packages for microbiome/Pipeline1-6/03.MicrobiomeAnalystR/pipeline.2.microbiome.Rmd

  • 3.Integrated R packages for microbiome/Pipeline1-6/04.animalcules/pipeline.2.microbiome.Rmd

  • 3.Integrated R packages for microbiome/Pipeline1-6/05.microeco/pipeline.2.microbiome.Rmd

  • 3.Integrated R packages for microbiome/Pipeline1-6/06.EasyAmplicon/pipeline.6.Amplicon.Rmd

The best practice R pipeline

  • 4.The best practice R pipeline/Pipeline.BestPractice.Rmd

image

Other results that can be obtained from running this project can be displayed

image

image

image

image

image

reference

Wen, T., G. Niu, T. Chen, Q. Shen, J. Yuan and Y. X. Liu (2023). "The best practice for microbiome analysis using R." Protein Cell. https://doi.org/10.1093/procel/pwad024.

easymicrobiomer's People

Contributors

taowenmicro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

easymicrobiomer's Issues

Random Forest

mbSet<-RF.Anal(mbSet, 500,7,1,"Class","OTU")

Error: meta.vec.rf not found

a

Dear Easy Microbiome User,

Error in code

Dear Tao Wen
I trust you are doing well
While I am new to EasyMicrobiomeR,
I was trying to run the example after successfully installing the packages.
I tried to run the first code to get the example datafile, however I got this error
otu = read.delim("./data/otutab.txt",row.names = 1)
Error in file(file, "rt") : cannot open the connection

Kindly please suggest
Thanks and Regards

Can't find Tax4Fun2_ReferenceData_v2

老师您好,
我正在根据您的文章一点一点学习整个pipeline, 在进行功能预测的时候我没有找到Tax4Fun2_ReferenceData_v2 这个文件, 请问可否问一下这个文件在github的路径?

谢谢老师!

lefse分析模块出现问题

老师,您好
感谢您们提供了菌群下游分析的代码。
我在学习的过程中发现了个问题,在版本是4.3.1运行4.The.best.practice.Rmd的lefse分析模块中,在4067-4099行的代码中出现以下报错:
Error in h(simpleError(msg, call)) :
在为'as.data.frame'函数选择方法时评估'x'参数出了错: 在为'tax_table'函数选择方法时评估'object'参数出了错: 在为'taxa_are_rows'函数选择方法时评估'physeq'参数出了错: 函数‘tax_table’标签‘"phyloseq"’找不到继承方法。

我怀疑是phyloseq文件读取过程出现问题,但是没有找到解决的办法,希望能收到老师您的回复,十分感谢!!

invalid tree object when running ### Species Taxonomic Tree(物种分类树)

老师您好,
我在跑以下这段代码的时候出现了Error:
ℹ invalid tbl_tree object. Missing column: parent,node.
ℹ invalid tbl_tree object. Missing column: parent,node.
Error in if (stats::var(as.numeric(dat[[xid]]), na.rm = TRUE) != 0) { :
missing value where TRUE/FALSE needed

我没有找到解决办法, 请问可否给一点提示? 比如tree object 在哪里被调用的? 谢谢老师!

Species Taxonomic Tree(物种分类树)

....
otu$id = row.names(otu)
ringdat = otu %>% tidyfst::longer_dt(id)
ringdat$value = log2(ringdat$value+1)
ringdat$id = paste("st__",ringdat$id,sep = "")
head(ringdat)
num <- ringdat$name %>% unique() %>% length()
p3 <- p2 +
geom_fruit(
data=ringdat,
geom=geom_star,
mapping=aes(
y=id,
x=name,
size=value,
fill= name
),
starshape = 13,
starstroke = 0,
offset=-0.9,
pwidth=0.8,
grid.params=list(linetype=3)
) +
scale_size_continuous(range=c(0, 2),
limits=c(sort(ringdat$value)[2], max(ringdat$value)),
breaks=c(1, 2, 3),
name=bquote(paste(Log[2],"(",.("Count+1"), ")")),
guide=guide_legend(keywidth = 0.4, keyheight = 0.4, order=4,
override.aes = list(starstroke=0.3))
) +
scale_fill_manual(
values=colorRampPalette(RColorBrewer::brewer.pal(12,"Spectral"))(num),
guide=guide_legend(keywidth = 0.4, keyheight = 0.4, order=3)
)

包版本冲突

Hello作者大大!
result1 = EasyStat::FacetMuiPlotresultBox(data = data,num = c(3:5),
result = result,
sig_show ="abc",ncol = 3 )
提示需要0.7.0版本的dplyr,
但是ggtree需要新版本的dplyr

FEAST相关

老师您好,我正在使用示例数据进行R语言FEAST学习,用的FEAST_example_Multiple_sinks代码,当我print(Proportions_est)得到列表以后,运行FEAST_output = as.data.frame(Proportions_est)这个代码,R语言出现报错Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
参数值意味着不同的行数: 4, 3
请问老师这怎么解决呢?非常感谢您

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.