├── inst
├── extdata
│ ├── taxid.txt
│ ├── taxids2.txt
│ ├── name.txt
│ └── lineage.txt
└── CITATION
├── vignettes
├── .gitignore
└── pctax.Rmd
├── data
├── pc_tax1.rda
├── all_ec_info.rda
└── all_sp_la_zh_name.rda
├── man
├── figures
│ ├── pctax.png
│ ├── pctax1.png
│ ├── README-unnamed-chunk-2-1.png
│ └── README-unnamed-chunk-3-1.png
├── cor_net.Rd
├── pc_valid.Rd
├── print.pc_otu.Rd
├── plot.g_test.Rd
├── all_sp_la_zh_name.Rd
├── c_means.Rd
├── get_diff_type.Rd
├── bbtt.Rd
├── all_ec_info.Rd
├── summary.pc_otu.Rd
├── pre_assembly_stats.Rd
├── rarefaction.Rd
├── pre_GEO.Rd
├── pc_tax1.Rd
├── plot.pro_res.Rd
├── pipe.Rd
├── grapes-less-than-greater-than-grapes.Rd
├── pre_fastp.Rd
├── multi_conf.Rd
├── before_tree.Rd
├── df2tree1.Rd
├── gp_dis_density.Rd
├── add_tax.Rd
├── load_N_data.Rd
├── sunburst.Rd
├── suijisenlin.Rd
├── plot.a_res.Rd
├── kwtest.Rd
├── as.dist.b_dist.Rd
├── tax_lca.Rd
├── b_NTI1.Rd
├── envfitt.Rd
├── stamp_plot.Rd
├── b_res_3d.Rd
├── load_mpa_df.Rd
├── mat_dist.Rd
├── gene2id.Rd
├── time_by_cm.Rd
├── rare_curve_sample.Rd
├── convert_taxon_name.Rd
├── check_taxonkit.Rd
├── pc_otu.Rd
├── ALDEX.Rd
├── get_all_sp_la_zh_name.Rd
├── multi_bar.Rd
├── micro_sbatch.Rd
├── procrustes_analyse.Rd
├── df2tree.Rd
├── grap_p_test.Rd
├── volcano_p.Rd
├── m_group_env.Rd
├── rare_curve_species.Rd
├── install_taxonkit.Rd
├── download_taxonkit_dataset.Rd
├── add_strip.Rd
├── permanova2.Rd
├── sangji_plot.Rd
├── as.b_dist.Rd
├── diff_da.Rd
├── pctax-package.Rd
├── batch_mediate.Rd
├── aor.Rd
├── geo_sim.Rd
├── nst.Rd
├── a_diversity.Rd
├── drop_tips_update.Rd
├── ncm.Rd
├── name_or_id2df.Rd
├── pre_tax_table.Rd
├── permanova.Rd
├── z_diversity_decay.Rd
├── nti_rc.Rd
├── plot_N_cycle.Rd
├── z_diversity.Rd
├── RDA_plot.Rd
├── RCbray1.Rd
├── taxonkit_list.Rd
├── ann_tree.Rd
├── myRDA.Rd
├── taxonkit_lca.Rd
├── taxonkit_name2taxid.Rd
├── plot.b_res.Rd
├── b_analyse.Rd
├── plot_element_cycle.Rd
├── taxonkit_lineage.Rd
├── plot_two_tree.Rd
├── taxonkit_filter.Rd
└── taxonkit_reformat.Rd
├── pkgdown
└── favicon
│ ├── favicon.ico
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ ├── mstile-150x150.png
│ ├── apple-touch-icon.png
│ ├── android-chrome-192x192.png
│ ├── android-chrome-512x512.png
│ ├── browserconfig.xml
│ ├── site.webmanifest
│ └── safari-pinned-tab.svg
├── .Rbuildignore
├── pctax.Rproj
├── R
├── utils-pipe.R
├── pctax-package.R
├── data.R
├── stats.R
├── pc_otu.R
├── rarefy.R
├── a_diversity.R
├── additional.R
└── eco_micro.R
├── _pkgdown.yml
├── .gitignore
├── NEWS.md
├── .github
└── workflows
│ ├── R-CMD-check.yaml
│ ├── pkgdown.yaml
│ └── pr-commands.yaml
├── DESCRIPTION
├── README.md
├── NAMESPACE
└── README.Rmd
/inst/extdata/taxid.txt:
--------------------------------------------------------------------------------
1 | 9606
2 | 63221
3 |
--------------------------------------------------------------------------------
/vignettes/.gitignore:
--------------------------------------------------------------------------------
1 | *.html
2 | *.R
3 |
--------------------------------------------------------------------------------
/data/pc_tax1.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/data/pc_tax1.rda
--------------------------------------------------------------------------------
/data/all_ec_info.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/data/all_ec_info.rda
--------------------------------------------------------------------------------
/man/figures/pctax.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/man/figures/pctax.png
--------------------------------------------------------------------------------
/man/figures/pctax1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/man/figures/pctax1.png
--------------------------------------------------------------------------------
/data/all_sp_la_zh_name.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/data/all_sp_la_zh_name.rda
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/pkgdown/favicon/favicon.ico
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/pkgdown/favicon/favicon-16x16.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/pkgdown/favicon/favicon-32x32.png
--------------------------------------------------------------------------------
/pkgdown/favicon/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/pkgdown/favicon/mstile-150x150.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/pkgdown/favicon/apple-touch-icon.png
--------------------------------------------------------------------------------
/man/figures/README-unnamed-chunk-2-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/man/figures/README-unnamed-chunk-2-1.png
--------------------------------------------------------------------------------
/man/figures/README-unnamed-chunk-3-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/man/figures/README-unnamed-chunk-3-1.png
--------------------------------------------------------------------------------
/pkgdown/favicon/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/pkgdown/favicon/android-chrome-192x192.png
--------------------------------------------------------------------------------
/pkgdown/favicon/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Asa12138/pctax/HEAD/pkgdown/favicon/android-chrome-512x512.png
--------------------------------------------------------------------------------
/inst/extdata/taxids2.txt:
--------------------------------------------------------------------------------
1 | 131567
2 | 2
3 | 1783257
4 | 74201
5 | 203494
6 | 48461
7 | 1647988
8 | 239934
9 | 239935
10 | 349741
11 |
--------------------------------------------------------------------------------
/inst/extdata/name.txt:
--------------------------------------------------------------------------------
1 | Homo sapiens
2 | Akkermansia muciniphila ATCC BAA-835
3 | Akkermansia muciniphila
4 | Mouse Intracisternal A-particle
5 | Wei Shen
6 | uncultured murine large bowel bacterium BAC 54B
7 | Croceibacter phage P2559Y
8 |
--------------------------------------------------------------------------------
/pkgdown/favicon/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #da532c
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^.*\.Rproj$
2 | ^\.Rproj\.user$
3 | .gitignore
4 | .RData
5 | .Rhistory
6 | images
7 | images/.*
8 | ^data-raw$
9 | \.DS_Store
10 | ^_pkgdown\.yml$
11 | ^docs$
12 | ^pkgdown$
13 | ^README\.qmd$
14 | ^README\.Rmd$
15 | README_files
16 | README_files/.*
17 | README_cache
18 | README_cache/.*
19 | ^\.github$
20 | ^codecov\.yml$
21 |
--------------------------------------------------------------------------------
/man/cor_net.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eco_micro.R
3 | \name{cor_net}
4 | \alias{cor_net}
5 | \title{Correlation network, species-interaction network for omics}
6 | \usage{
7 | cor_net()
8 | }
9 | \value{
10 | No value
11 | }
12 | \description{
13 | Correlation network, species-interaction network for omics
14 | }
15 |
--------------------------------------------------------------------------------
/man/pc_valid.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/pc_otu.R
3 | \name{pc_valid}
4 | \alias{pc_valid}
5 | \title{Judge pc_otu is valid or not}
6 | \usage{
7 | pc_valid(pc)
8 | }
9 | \arguments{
10 | \item{pc}{a pc_otu object}
11 | }
12 | \value{
13 | logical
14 | }
15 | \description{
16 | Judge pc_otu is valid or not
17 | }
18 |
--------------------------------------------------------------------------------
/man/print.pc_otu.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/pc_otu.R
3 | \name{print.pc_otu}
4 | \alias{print.pc_otu}
5 | \title{Print}
6 | \usage{
7 | \method{print}{pc_otu}(x, ...)
8 | }
9 | \arguments{
10 | \item{x}{pc_otu}
11 |
12 | \item{...}{add}
13 | }
14 | \value{
15 | No value
16 | }
17 | \description{
18 | Print
19 | }
20 |
--------------------------------------------------------------------------------
/man/plot.g_test.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{plot.g_test}
4 | \alias{plot.g_test}
5 | \title{Plot g_test}
6 | \usage{
7 | \method{plot}{g_test}(x, ...)
8 | }
9 | \arguments{
10 | \item{x}{a g_test object}
11 |
12 | \item{...}{add}
13 | }
14 | \value{
15 | ggplot
16 | }
17 | \description{
18 | Plot g_test
19 | }
20 | \seealso{
21 | \code{\link{permanova}}
22 | }
23 |
--------------------------------------------------------------------------------
/man/all_sp_la_zh_name.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data.R
3 | \docType{data}
4 | \name{all_sp_la_zh_name}
5 | \alias{all_sp_la_zh_name}
6 | \title{all species latin names and chinese names}
7 | \format{
8 | a dataframe.
9 | \describe{
10 | \item{latin_name}{latin name}
11 | \item{chinese_name}{chinese name}
12 | }
13 | }
14 | \description{
15 | all species latin names and chinese names.
16 | }
17 |
--------------------------------------------------------------------------------
/man/c_means.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{plot.time_cm}
4 | \alias{plot.time_cm}
5 | \title{Plot time_cm}
6 | \usage{
7 | \method{plot}{time_cm}(x, mem_thr = 0.6, ...)
8 | }
9 | \arguments{
10 | \item{x}{time_cm}
11 |
12 | \item{mem_thr}{membership threshold}
13 |
14 | \item{...}{add}
15 | }
16 | \value{
17 | ggplot
18 | }
19 | \description{
20 | Plot time_cm
21 | }
22 |
--------------------------------------------------------------------------------
/man/get_diff_type.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{get_diff_type}
4 | \alias{get_diff_type}
5 | \title{Get mean and type}
6 | \usage{
7 | get_diff_type(otutab, group_df)
8 | }
9 | \arguments{
10 | \item{otutab}{otutab}
11 |
12 | \item{group_df}{a dataframe with rowname same to dist and one group column}
13 | }
14 | \value{
15 | No value
16 | }
17 | \description{
18 | Get mean and type
19 | }
20 |
--------------------------------------------------------------------------------
/man/bbtt.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{bbtt}
4 | \alias{bbtt}
5 | \title{ggdotchart for diff analysis}
6 | \usage{
7 | bbtt(res, pvalue = "glm.eBH", topN = 20)
8 | }
9 | \arguments{
10 | \item{res}{result of ALDEX or kwtest}
11 |
12 | \item{pvalue}{the name of pvaule}
13 |
14 | \item{topN}{topN}
15 | }
16 | \value{
17 | ggplot
18 | }
19 | \description{
20 | ggdotchart for diff analysis
21 | }
22 |
--------------------------------------------------------------------------------
/man/all_ec_info.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data.R
3 | \docType{data}
4 | \name{all_ec_info}
5 | \alias{all_ec_info}
6 | \title{all element cycle information.}
7 | \format{
8 | a list contains four tables.
9 | \describe{
10 | \item{ec_node}{chemicals}
11 | \item{ec_link}{reactions}
12 | \item{ec_gene}{genes}
13 | \item{ec_path}{reactions labels}
14 | }
15 | }
16 | \description{
17 | all element cycle information.
18 | }
19 |
--------------------------------------------------------------------------------
/man/summary.pc_otu.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/pc_otu.R
3 | \name{summary.pc_otu}
4 | \alias{summary.pc_otu}
5 | \title{Summary pc_otu}
6 | \usage{
7 | \method{summary}{pc_otu}(object, ...)
8 | }
9 | \arguments{
10 | \item{object}{pc_otu}
11 |
12 | \item{...}{add}
13 | }
14 | \value{
15 | No value
16 | }
17 | \description{
18 | Summary pc_otu
19 | }
20 | \examples{
21 | data("pc_tax1")
22 | summary(pc_tax1)
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/man/pre_assembly_stats.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/other_software.R
3 | \name{pre_assembly_stats}
4 | \alias{pre_assembly_stats}
5 | \title{Prepare the result from assembly_stats (.json file)}
6 | \usage{
7 | pre_assembly_stats(jsonfiles)
8 | }
9 | \arguments{
10 | \item{jsonfiles}{the directory contains .json file}
11 | }
12 | \value{
13 | data.frame
14 | }
15 | \description{
16 | Prepare the result from assembly_stats (.json file)
17 | }
18 |
--------------------------------------------------------------------------------
/man/rarefaction.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/rarefy.R
3 | \name{rarefaction}
4 | \alias{rarefaction}
5 | \title{Rarefy a otutab}
6 | \usage{
7 | rarefaction(otutab, sample = NULL)
8 | }
9 | \arguments{
10 | \item{otutab}{otutab}
11 |
12 | \item{sample}{number}
13 | }
14 | \value{
15 | a rarefied otutab
16 | }
17 | \description{
18 | Rarefy a otutab
19 | }
20 | \examples{
21 | data(otutab, package = "pcutils")
22 | rarefaction(otutab)
23 | }
24 |
--------------------------------------------------------------------------------
/man/pre_GEO.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/additional.R
3 | \name{pre_GEO}
4 | \alias{pre_GEO}
5 | \title{prepare the GEO data}
6 | \usage{
7 | pre_GEO(my_id, GEO_dir = "GEO_data", file = NULL)
8 | }
9 | \arguments{
10 | \item{my_id}{GEOid}
11 |
12 | \item{GEO_dir}{GEO download dir}
13 |
14 | \item{file}{the downloaded file}
15 | }
16 | \value{
17 | list(meta = meta, GSE_expr = GSE_expr)
18 | }
19 | \description{
20 | prepare the GEO data
21 | }
22 |
--------------------------------------------------------------------------------
/man/pc_tax1.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/data.R
3 | \docType{data}
4 | \name{pc_tax1}
5 | \alias{pc_tax1}
6 | \title{test data (pc_otu class) for pc_tax package.}
7 | \format{
8 | a pc_otu contains an otutab, metadata and a taxonomy table.
9 | \describe{
10 | \item{tbls}{contians otutable rawdata}
11 | \item{metas}{contians metadata}
12 | \item{otus}{contians taxomomy table}
13 | }
14 | }
15 | \description{
16 | an otutab, metadata and a taxonomy table.
17 | }
18 |
--------------------------------------------------------------------------------
/man/plot.pro_res.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{plot.pro_res}
4 | \alias{plot.pro_res}
5 | \title{Plot pro_res}
6 | \usage{
7 | \method{plot}{pro_res}(x, group, metadata = NULL, pal = NULL, ...)
8 | }
9 | \arguments{
10 | \item{x}{pro_res}
11 |
12 | \item{group}{group}
13 |
14 | \item{metadata}{metadata}
15 |
16 | \item{pal}{pal}
17 |
18 | \item{...}{add}
19 | }
20 | \value{
21 | a ggplot
22 | }
23 | \description{
24 | Plot pro_res
25 | }
26 |
--------------------------------------------------------------------------------
/man/pipe.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils-pipe.R
3 | \name{\%>\%}
4 | \alias{\%>\%}
5 | \title{Pipe operator}
6 | \usage{
7 | lhs \%>\% rhs
8 | }
9 | \arguments{
10 | \item{lhs}{A value or the magrittr placeholder.}
11 |
12 | \item{rhs}{A function call using the magrittr semantics.}
13 | }
14 | \value{
15 | The result of calling \code{rhs(lhs)}.
16 | }
17 | \description{
18 | See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details.
19 | }
20 | \keyword{internal}
21 |
--------------------------------------------------------------------------------
/pkgdown/favicon/site.webmanifest:
--------------------------------------------------------------------------------
1 | {
2 | "name": "",
3 | "short_name": "",
4 | "icons": [
5 | {
6 | "src": "/android-chrome-192x192.png",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | },
10 | {
11 | "src": "/android-chrome-512x512.png",
12 | "sizes": "512x512",
13 | "type": "image/png"
14 | }
15 | ],
16 | "theme_color": "#ffffff",
17 | "background_color": "#ffffff",
18 | "display": "standalone"
19 | }
20 |
--------------------------------------------------------------------------------
/inst/CITATION:
--------------------------------------------------------------------------------
1 | bibentry(
2 | header = "To cite pctax in publications use:",
3 | bibtype = "Article",
4 | title = "pctax: Professional Comprehensive Omics Data Analysis Pipeline",
5 | author = c(
6 | as.person("Chen Peng"),
7 | as.person("Chao Jiang")
8 | ),
9 | year = "2024",
10 | journal = "NA",
11 | textVersion = paste("C. Peng, C. Jiang.",
12 | "pctax: Professional Comprehensive Omics Data Analysis Pipeline.",
13 | "(2023). https://github.com/Asa12138/pctax")
14 | )
15 |
--------------------------------------------------------------------------------
/man/grapes-less-than-greater-than-grapes.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/utils-pipe.R
3 | \name{\%<>\%}
4 | \alias{\%<>\%}
5 | \title{Assignment pipe}
6 | \usage{
7 | lhs \%<>\% rhs
8 | }
9 | \arguments{
10 | \item{lhs}{A value or the magrittr placeholder.}
11 |
12 | \item{rhs}{A function call using the magrittr semantics.}
13 | }
14 | \value{
15 | The result of calling \code{rhs(lhs)}.
16 | }
17 | \description{
18 | See \code{magrittr::\link[magrittr:pipe]{\%<>\%}} for details.
19 | }
20 | \keyword{internal}
21 |
--------------------------------------------------------------------------------
/man/pre_fastp.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/other_software.R
3 | \name{pre_fastp}
4 | \alias{pre_fastp}
5 | \title{Prepare the result from fastp (.json file)}
6 | \usage{
7 | pre_fastp(jsonfiles, prefix = c("Raw", "Clean"))
8 | }
9 | \arguments{
10 | \item{jsonfiles}{the directory contains .json file}
11 |
12 | \item{prefix}{default c("Raw","Clean"), for the before filtering and after filtering.}
13 | }
14 | \value{
15 | data.frame
16 | }
17 | \description{
18 | Prepare the result from fastp (.json file)
19 | }
20 |
--------------------------------------------------------------------------------
/man/multi_conf.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{multi_conf}
4 | \alias{multi_conf}
5 | \title{Difference analysis}
6 | \usage{
7 | multi_conf(otutab, group_df)
8 | }
9 | \arguments{
10 | \item{otutab}{otutab}
11 |
12 | \item{group_df}{a dataframe with rowname same to dist and one group column}
13 | }
14 | \value{
15 | ggplot
16 | }
17 | \description{
18 | Difference analysis
19 | }
20 | \examples{
21 | data(otutab, package = "pcutils")
22 | multi_conf(otutab[1:10, 1:12], metadata["Group"])
23 | }
24 |
--------------------------------------------------------------------------------
/man/before_tree.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{before_tree}
4 | \alias{before_tree}
5 | \title{Before df2tree check}
6 | \usage{
7 | before_tree(f_tax)
8 | }
9 | \arguments{
10 | \item{f_tax}{table}
11 | }
12 | \value{
13 | table
14 | }
15 | \description{
16 | Before df2tree check
17 | }
18 | \examples{
19 | wrong_taxdf <- data.frame(
20 | kingdom = c(rep(c("A", "B"), each = 4), "C", NA),
21 | "phylum" = c("A", "a", "b", "c", "c", "c", "d", NA, NA, "e")
22 | )
23 | before_tree(wrong_taxdf)
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/man/df2tree1.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{df2tree1}
4 | \alias{df2tree1}
5 | \title{From a dataframe to construct a phylo (save nwk)}
6 | \usage{
7 | df2tree1(taxa)
8 | }
9 | \arguments{
10 | \item{taxa}{dataframe}
11 | }
12 | \value{
13 | phylo object
14 | }
15 | \description{
16 | NOTE: this function will transfer all space to \verb{_}
17 | }
18 | \examples{
19 | if (requireNamespace("ape")) {
20 | data(otutab, package = "pcutils")
21 | df2tree1(taxonomy) -> tax_tree
22 | print(tax_tree)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/man/gp_dis_density.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{gp_dis_density}
4 | \alias{gp_dis_density}
5 | \title{Group inter-intra density}
6 | \usage{
7 | gp_dis_density(otutab, group)
8 | }
9 | \arguments{
10 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
11 |
12 | \item{group}{group vector}
13 | }
14 | \value{
15 | ggplot
16 | }
17 | \description{
18 | Group inter-intra density
19 | }
20 | \examples{
21 | data(otutab, package = "pcutils")
22 | gp_dis_density(otutab, metadata["Group"])
23 | }
24 |
--------------------------------------------------------------------------------
/pctax.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: Sweave
13 | LaTeX: XeLaTeX
14 |
15 | AutoAppendNewline: Yes
16 | StripTrailingWhitespace: Yes
17 |
18 | BuildType: Package
19 | PackageUseDevtools: Yes
20 | PackageInstallArgs: --no-multiarch --with-keep.source
21 | PackageRoxygenize: rd,collate,namespace
22 |
23 | PythonType: conda
24 | PythonVersion: 3.9.13
25 | PythonPath: ~/opt/anaconda3/bin/python3.9
26 |
--------------------------------------------------------------------------------
/man/add_tax.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/pc_otu.R
3 | \name{add_tax}
4 | \alias{add_tax}
5 | \title{Add taxonomy for a pc_otu object}
6 | \usage{
7 | add_tax(pc, taxonomy)
8 | }
9 | \arguments{
10 | \item{pc}{a pc_otu object}
11 |
12 | \item{taxonomy}{a taxomomy data.frame, look out the rownames of taxonomy and otutab should matched!}
13 | }
14 | \value{
15 | pc_otu
16 | }
17 | \description{
18 | Add taxonomy for a pc_otu object
19 | }
20 | \examples{
21 | data(otutab, package = "pcutils")
22 | pc_tax1 <- pc_otu(otutab, metadata)
23 | pc_tax1 <- add_tax(pc_tax1, taxonomy)
24 | }
25 |
--------------------------------------------------------------------------------
/man/load_N_data.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/functional.R
3 | \name{load_N_data}
4 | \alias{load_N_data}
5 | \title{Load N-cycle data}
6 | \usage{
7 | load_N_data()
8 | }
9 | \value{
10 | list
11 | }
12 | \description{
13 | Load N-cycle data
14 | }
15 | \references{
16 | Tu, Q., Lin, L., Cheng, L., Deng, Y. & He, Z. (2019) NCycDB: a curated integrative database for fast and accurate metagenomic profiling of nitrogen cycling genes. Bioinformatics 35, 1040–1048.
17 | Kuypers, M. M. M., Marchant, H. K. & Kartal, B. (2018) The microbial nitrogen-cycling network. Nat Rev Microbiol 16, 263–276.
18 | }
19 |
--------------------------------------------------------------------------------
/man/sunburst.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/additional.R
3 | \name{sunburst}
4 | \alias{sunburst}
5 | \title{Plot a sunburst}
6 | \usage{
7 | sunburst(tree)
8 | }
9 | \arguments{
10 | \item{tree}{result from \code{\link{ann_tree}}}
11 | }
12 | \value{
13 | sunburst
14 | }
15 | \description{
16 | Plot a sunburst
17 | }
18 | \examples{
19 | \donttest{
20 | if (requireNamespace("plotly")) {
21 | data(otutab, package = "pcutils")
22 | ann_tree(taxonomy[, c(1, 5, 6, 7)], otutab) -> tree
23 | sunburst(tree)
24 | }
25 | }
26 | }
27 | \seealso{
28 | \code{\link[=sangji_plot]{sangji_plot()}}
29 | }
30 |
--------------------------------------------------------------------------------
/man/suijisenlin.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{suijisenlin}
4 | \alias{suijisenlin}
5 | \title{RandomForest}
6 | \usage{
7 | suijisenlin(otutab, group_df, topN = 10)
8 | }
9 | \arguments{
10 | \item{otutab}{otutab}
11 |
12 | \item{group_df}{a dataframe with rowname same to dist and one group column}
13 |
14 | \item{topN}{default: 10}
15 | }
16 | \value{
17 | diff
18 | }
19 | \description{
20 | RandomForest
21 | }
22 | \examples{
23 | if (requireNamespace("randomForest")) {
24 | data(otutab, package = "pcutils")
25 | suijisenlin(otutab, metadata["Group"]) -> rf_res
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/man/plot.a_res.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/a_diversity.R
3 | \name{plot.a_res}
4 | \alias{plot.a_res}
5 | \title{Plot a_res object}
6 | \usage{
7 | \method{plot}{a_res}(x, group, metadata, ...)
8 | }
9 | \arguments{
10 | \item{x}{a a_res object}
11 |
12 | \item{group}{one of colname of metadata}
13 |
14 | \item{metadata}{metadata}
15 |
16 | \item{...}{addditional parameters for \code{\link[pcutils]{group_box}} or \code{\link[pcutils]{my_lm}}}
17 | }
18 | \value{
19 | patchwork object,you can change theme with &
20 | }
21 | \description{
22 | Plot a_res object
23 | }
24 | \seealso{
25 | \code{\link{a_diversity}}
26 | }
27 |
--------------------------------------------------------------------------------
/man/kwtest.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{kwtest}
4 | \alias{kwtest}
5 | \title{KW test}
6 | \usage{
7 | kwtest(otutab, group_df, method = "kruskal.test")
8 | }
9 | \arguments{
10 | \item{otutab}{otutab}
11 |
12 | \item{group_df}{a dataframe with rowname same to dist and one group column}
13 |
14 | \item{method}{"kruskal.test", see \code{\link[ggpubr]{compare_means}}}
15 | }
16 | \value{
17 | res
18 | }
19 | \description{
20 | KW test
21 | }
22 | \examples{
23 | \donttest{
24 | data(otutab, package = "pcutils")
25 | kwtest(otutab, metadata["Group"]) -> res
26 | bbtt(res, pvalue = "p.format")
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/man/as.dist.b_dist.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{as.dist.b_dist}
4 | \alias{as.dist.b_dist}
5 | \title{Transfer b_dist to dist}
6 | \usage{
7 | \method{as.dist}{b_dist}(m, diag = FALSE, upper = FALSE)
8 | }
9 | \arguments{
10 | \item{m}{a b_dist object}
11 |
12 | \item{diag}{logical value indicating whether the diagonal of the distance matrix should be printed by \code{print.dist}.}
13 |
14 | \item{upper}{logical value indicating whether the upper triangle of the distance matrix should be printed by \code{print.dist}.}
15 | }
16 | \value{
17 | dist
18 | }
19 | \description{
20 | Transfer b_dist to dist
21 | }
22 |
--------------------------------------------------------------------------------
/man/tax_lca.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{tax_lca}
4 | \alias{tax_lca}
5 | \title{Calculate the lowest common ancestor (LCA) of a set of taxa}
6 | \usage{
7 | tax_lca(df)
8 | }
9 | \arguments{
10 | \item{df}{a data frame with taxonomic information, with columns representing taxonomic levels}
11 | }
12 | \value{
13 | character
14 | }
15 | \description{
16 | Calculate the lowest common ancestor (LCA) of a set of taxa
17 | }
18 | \examples{
19 | df <- data.frame(
20 | A = c("a", "a", "a", "a"),
21 | B = c("x", "x", "y", "y"),
22 | C = c("1", "1", "2", "3"),
23 | stringsAsFactors = FALSE
24 | )
25 | tax_lca(df)
26 | }
27 |
--------------------------------------------------------------------------------
/man/b_NTI1.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eco_micro.R
3 | \name{b_NTI1}
4 | \alias{b_NTI1}
5 | \title{Calculate beta_NTI}
6 | \usage{
7 | b_NTI1(
8 | phylo,
9 | otutab,
10 | beta.reps = 9,
11 | weighted = TRUE,
12 | threads = 1,
13 | verbose = TRUE
14 | )
15 | }
16 | \arguments{
17 | \item{phylo}{a phylo object}
18 |
19 | \item{otutab}{otutab}
20 |
21 | \item{beta.reps}{how many simulation performed?}
22 |
23 | \item{weighted}{logical}
24 |
25 | \item{threads}{use how many threads to calculate (default:4)}
26 |
27 | \item{verbose}{verbose}
28 | }
29 | \value{
30 | a dist: b_NTI
31 | }
32 | \description{
33 | Calculate beta_NTI
34 | }
35 |
--------------------------------------------------------------------------------
/man/envfitt.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{envfitt}
4 | \alias{envfitt}
5 | \title{Envfit test for RDA result}
6 | \usage{
7 | envfitt(phy.rda, env, ...)
8 | }
9 | \arguments{
10 | \item{phy.rda}{a rda result}
11 |
12 | \item{env}{environmental factors}
13 |
14 | \item{...}{add}
15 | }
16 | \value{
17 | g_test object
18 | }
19 | \description{
20 | Envfit test for RDA result
21 | }
22 | \examples{
23 | data(otutab, package = "pcutils")
24 | env <- metadata[, 6:10]
25 | # RDA
26 | myRDA(otutab, env) -> phy.rda
27 | envfitt(phy.rda, env) -> envfit_res
28 | plot(envfit_res)
29 | }
30 | \seealso{
31 | \code{\link[vegan]{envfit}}
32 | }
33 |
--------------------------------------------------------------------------------
/man/stamp_plot.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{stamp_plot}
4 | \alias{stamp_plot}
5 | \title{Stamp style plot}
6 | \usage{
7 | stamp_plot(otutab, group_df, set_order = NULL, pal = NULL)
8 | }
9 | \arguments{
10 | \item{otutab}{otutab}
11 |
12 | \item{group_df}{a dataframe with rowname same to dist and one group column}
13 |
14 | \item{set_order}{set order of factor levels}
15 |
16 | \item{pal}{palette}
17 | }
18 | \value{
19 | ggplot
20 | }
21 | \description{
22 | Stamp style plot
23 | }
24 | \examples{
25 | data(otutab, package = "pcutils")
26 | if (requireNamespace("ggfun")) stamp_plot(otutab[1:10, 1:12], metadata["Group"])
27 | }
28 |
--------------------------------------------------------------------------------
/man/b_res_3d.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{b_res_3d}
4 | \alias{b_res_3d}
5 | \title{3D plot for b_res}
6 | \usage{
7 | b_res_3d(b_res, Group, metadata = NULL, ...)
8 | }
9 | \arguments{
10 | \item{b_res}{a b_res object}
11 |
12 | \item{Group}{group vector for color}
13 |
14 | \item{metadata}{metadata contain Group}
15 |
16 | \item{...}{add}
17 | }
18 | \value{
19 | plotly list
20 | }
21 | \description{
22 | 3D plot for b_res
23 | }
24 | \examples{
25 | if (requireNamespace("plotly")) {
26 | data(otutab, package = "pcutils")
27 | b_analyse(otutab, method = "pca", ndim = 3) -> b_res
28 | b_res_3d(b_res, "Group", metadata)
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/man/load_mpa_df.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{load_mpa_df}
4 | \alias{load_mpa_df}
5 | \title{Load a metaphlan format data.frame}
6 | \usage{
7 | load_mpa_df(mpa_df, sum_unidentified = TRUE, rank_prefixes = pc_rank_prefixes)
8 | }
9 | \arguments{
10 | \item{mpa_df}{metaphlan format data.frame, rownames are taxon, all value are numeric.}
11 |
12 | \item{sum_unidentified}{logical, whether to sum the unidentified reads to the correspond level.}
13 |
14 | \item{rank_prefixes}{a named vector of rank prefixes, default is \code{pc_rank_prefixes}.}
15 | }
16 | \value{
17 | a list
18 | }
19 | \description{
20 | Load a metaphlan format data.frame
21 | }
22 |
--------------------------------------------------------------------------------
/inst/extdata/lineage.txt:
--------------------------------------------------------------------------------
1 | 9606 cellular organisms;Eukaryota;Opisthokonta;Metazoa;Eumetazoa;Bilateria;Deuterostomia;Chordata;Craniata;Vertebrata;Gnathostomata;Teleostomi;Euteleostomi;Sarcopterygii;Dipnotetrapodomorpha;Tetrapoda;Amniota;Mammalia;Theria;Eutheria;Boreoeutheria;Euarchontoglires;Primates;Haplorrhini;Simiiformes;Catarrhini;Hominoidea;Hominidae;Homininae;Homo;Homo sapiens Homo sapiens species
2 | 9913 cellular organisms;Eukaryota;Opisthokonta;Metazoa;Eumetazoa;Bilateria;Deuterostomia;Chordata;Craniata;Vertebrata;Gnathostomata;Teleostomi;Euteleostomi;Sarcopterygii;Dipnotetrapodomorpha;Tetrapoda;Amniota;Mammalia;Theria;Eutheria;Boreoeutheria;Laurasiatheria;Artiodactyla;Ruminantia;Pecora;Bovidae;Bovinae;Bos;Bos taurus Bos taurus species
3 |
--------------------------------------------------------------------------------
/man/mat_dist.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{mat_dist}
4 | \alias{mat_dist}
5 | \title{Calculate distance for otutab}
6 | \usage{
7 | mat_dist(otutab, method = "bray", spe_nwk = NULL)
8 | }
9 | \arguments{
10 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
11 |
12 | \item{method}{Dissimilarity index, partial match to "bray", "euclidean"...see \code{\link[vegan]{vegdist};\link[picante]{unifrac}}}
13 |
14 | \item{spe_nwk}{a phylo tree if use unifrac...}
15 | }
16 | \value{
17 | dist
18 | }
19 | \description{
20 | Calculate distance for otutab
21 | }
22 | \examples{
23 | data(otutab, package = "pcutils")
24 | mat_dist(otutab)
25 | }
26 |
--------------------------------------------------------------------------------
/man/gene2id.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/additional.R
3 | \name{gene2id}
4 | \alias{gene2id}
5 | \title{Gene symbolid transfer to entrezIDs (human gene)}
6 | \usage{
7 | gene2id(genes)
8 | }
9 | \arguments{
10 | \item{genes}{gene symbols e.g:ASGR2}
11 | }
12 | \value{
13 | gene entrezIDs dataframe
14 | }
15 | \description{
16 | Gene symbolid transfer to entrezIDs (human gene)
17 | }
18 | \examples{
19 | if (requireNamespace("AnnotationDbi") && requireNamespace("org.Hs.eg.db")) {
20 | genes <- c(
21 | "ASGR2", "BEST1", "SIGLEC16", "ECRP", "C1QC", "TCN2", "RNASE2",
22 | "DYSF", "C1QB", "FAM20A", "FCGR1A", "CR1", "HP", "VSIG4", "EGR1"
23 | )
24 | gene2id(genes) -> geneid
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/man/time_by_cm.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{time_by_cm}
4 | \alias{time_by_cm}
5 | \title{Time series analysis}
6 | \usage{
7 | time_by_cm(otu_time, n_cluster = 6, min.std = 0)
8 | }
9 | \arguments{
10 | \item{otu_time}{otutab hebing by a time variable}
11 |
12 | \item{n_cluster}{number of clusters}
13 |
14 | \item{min.std}{min.std}
15 | }
16 | \value{
17 | time_cm
18 | }
19 | \description{
20 | Time series analysis
21 | }
22 | \examples{
23 | \donttest{
24 | if (interactive()) {
25 | data(otutab, package = "pcutils")
26 | otu_time <- pcutils::hebing(otutab, metadata$Group)
27 | time_by_cm(otu_time, n_cluster = 4) -> time_cm_res
28 | plot(time_cm_res)
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/man/rare_curve_sample.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/rarefy.R
3 | \name{rare_curve_sample}
4 | \alias{rare_curve_sample}
5 | \alias{plot.rare_res}
6 | \title{Rare the sample}
7 | \usage{
8 | rare_curve_sample(otutab, rep = 30, count_cutoff = 1)
9 |
10 | \method{plot}{rare_res}(x, ...)
11 | }
12 | \arguments{
13 | \item{otutab}{otutab}
14 |
15 | \item{rep}{repeats number}
16 |
17 | \item{count_cutoff}{cutoff to be 0}
18 |
19 | \item{x}{AOR object}
20 |
21 | \item{...}{add}
22 | }
23 | \value{
24 | ggplot
25 |
26 | ggplot
27 | }
28 | \description{
29 | Rare the sample
30 |
31 | Plot a rare curve
32 | }
33 | \examples{
34 | data(otutab, package = "pcutils")
35 | a <- rare_curve_sample(otutab)
36 | plot(a)
37 | }
38 |
--------------------------------------------------------------------------------
/man/convert_taxon_name.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{convert_taxon_name}
4 | \alias{convert_taxon_name}
5 | \title{Convert taxon names between Chinese and Latin}
6 | \usage{
7 | convert_taxon_name(input_names, mode = "latin_to_chinese", fuzzy = FALSE)
8 | }
9 | \arguments{
10 | \item{input_names}{input names}
11 |
12 | \item{mode}{conversion mode, "latin_to_chinese" or "chinese_to_latin"}
13 |
14 | \item{fuzzy}{whether to use fuzzy matching, default is FALSE}
15 | }
16 | \value{
17 | character vector of converted names
18 | }
19 | \description{
20 | Convert taxon names between Chinese and Latin
21 | }
22 | \examples{
23 | convert_taxon_name(c("Escherichia coli", "Clostridioides difficile"))
24 | }
25 |
--------------------------------------------------------------------------------
/man/check_taxonkit.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/Rtaxonkit.R
3 | \name{check_taxonkit}
4 | \alias{check_taxonkit}
5 | \title{Check taxonkit}
6 | \usage{
7 | check_taxonkit(print = TRUE)
8 | }
9 | \arguments{
10 | \item{print}{print}
11 | }
12 | \value{
13 | taxonkit path
14 | }
15 | \description{
16 | Check taxonkit
17 | }
18 | \seealso{
19 | Other Rtaxonkit:
20 | \code{\link{download_taxonkit_dataset}()},
21 | \code{\link{install_taxonkit}()},
22 | \code{\link{name_or_id2df}()},
23 | \code{\link{taxonkit_filter}()},
24 | \code{\link{taxonkit_lca}()},
25 | \code{\link{taxonkit_lineage}()},
26 | \code{\link{taxonkit_list}()},
27 | \code{\link{taxonkit_name2taxid}()},
28 | \code{\link{taxonkit_reformat}()}
29 | }
30 | \concept{Rtaxonkit}
31 |
--------------------------------------------------------------------------------
/man/pc_otu.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/pc_otu.R
3 | \name{pc_otu}
4 | \alias{pc_otu}
5 | \title{Create a pc_otu class object}
6 | \usage{
7 | pc_otu(otutab = data.frame(), metadata = data.frame(), taxonomy = NULL, ...)
8 | }
9 | \arguments{
10 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
11 |
12 | \item{metadata}{a metadata data.frame, samples are rows}
13 |
14 | \item{taxonomy}{a taxomomy data.frame, look out the rowname of taxonomy and otutab should matched!}
15 |
16 | \item{...}{add}
17 | }
18 | \value{
19 | pc_otu
20 | }
21 | \description{
22 | Create a pc_otu class object
23 | }
24 | \examples{
25 | data(otutab, package = "pcutils")
26 | pc_tax1 <- pc_otu(otutab, metadata)
27 | print(pc_tax1)
28 | }
29 |
--------------------------------------------------------------------------------
/man/ALDEX.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{ALDEX}
4 | \alias{ALDEX}
5 | \title{ALDEX}
6 | \usage{
7 | ALDEX(otutab, group_df)
8 | }
9 | \arguments{
10 | \item{otutab}{otutab}
11 |
12 | \item{group_df}{a dataframe with rowname same to dist and one group column}
13 | }
14 | \value{
15 | diff
16 | }
17 | \description{
18 | ALDEX
19 | }
20 | \examples{
21 | \donttest{
22 | if (requireNamespace("ALDEx2")) {
23 | data(otutab, package = "pcutils")
24 | ALDEX(otutab, metadata["Group"]) -> res
25 | res \%>\%
26 | dplyr::top_n(9, -glm.eBH) \%>\%
27 | .[, "tax"] -> sig
28 | data.frame(t(otutab[sig, ])) \%>\% pcutils::group_box(., "Group", metadata)
29 | }
30 | }
31 | }
32 | \references{
33 | \url{https://cloud.tencent.com/developer/article/1621879}
34 | }
35 |
--------------------------------------------------------------------------------
/man/get_all_sp_la_zh_name.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{get_all_sp_la_zh_name}
4 | \alias{get_all_sp_la_zh_name}
5 | \title{get all species Latin and Chinese name from the CCTCC database}
6 | \usage{
7 | get_all_sp_la_zh_name(
8 | download_dir = "~/Documents/",
9 | each_verbose = FALSE,
10 | max_requests = 50,
11 | max_id = 30609,
12 | failure_ids = NULL
13 | )
14 | }
15 | \arguments{
16 | \item{download_dir}{default}
17 |
18 | \item{each_verbose}{each_verbose}
19 |
20 | \item{max_requests}{default 50}
21 |
22 | \item{max_id}{default 30609, try to make sure on the website}
23 |
24 | \item{failure_ids}{failure_ids}
25 | }
26 | \value{
27 | No value
28 | }
29 | \description{
30 | get all species Latin and Chinese name from the CCTCC database
31 | }
32 |
--------------------------------------------------------------------------------
/R/utils-pipe.R:
--------------------------------------------------------------------------------
1 | #' Pipe operator
2 | #'
3 | #' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details.
4 | #'
5 | #' @name %>%
6 | #' @rdname pipe
7 | #' @keywords internal
8 | #' @export
9 | #' @importFrom magrittr %>%
10 | #' @usage lhs \%>\% rhs
11 | #' @param lhs A value or the magrittr placeholder.
12 | #' @param rhs A function call using the magrittr semantics.
13 | #' @return The result of calling `rhs(lhs)`.
14 | NULL
15 |
16 | #' Assignment pipe
17 | #'
18 | #' See \code{magrittr::\link[magrittr:pipe]{\%<>\%}} for details.
19 | #'
20 | #' @name %<>%
21 | #' @keywords internal
22 | #' @export
23 | #' @importFrom magrittr %<>%
24 | #' @usage lhs \%<>\% rhs
25 | #' @param lhs A value or the magrittr placeholder.
26 | #' @param rhs A function call using the magrittr semantics.
27 | #' @return The result of calling `rhs(lhs)`.
28 | NULL
29 |
--------------------------------------------------------------------------------
/man/multi_bar.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{multi_bar}
4 | \alias{multi_bar}
5 | \title{Difference analysis}
6 | \usage{
7 | multi_bar(
8 | otutab,
9 | group_df,
10 | mode = 1,
11 | text_df = NULL,
12 | text_x = NULL,
13 | text_angle = -90,
14 | errorbar = "bottom"
15 | )
16 | }
17 | \arguments{
18 | \item{otutab}{otutab}
19 |
20 | \item{group_df}{a dataframe with rowname same to dist and one group column}
21 |
22 | \item{mode}{1~2}
23 |
24 | \item{text_df}{text_df}
25 |
26 | \item{text_x}{text_x}
27 |
28 | \item{text_angle}{text_angle}
29 |
30 | \item{errorbar}{top, bottom, none}
31 | }
32 | \value{
33 | ggplot
34 | }
35 | \description{
36 | Difference analysis
37 | }
38 | \examples{
39 | data(otutab, package = "pcutils")
40 | multi_bar(otutab[1:10, ], metadata["Group"])
41 | }
42 |
--------------------------------------------------------------------------------
/man/micro_sbatch.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/other_software.R
3 | \name{micro_sbatch}
4 | \alias{micro_sbatch}
5 | \title{Microbiome sbatch}
6 | \usage{
7 | micro_sbatch(
8 | work_dir = "/share/home/jianglab/pengchen/work/asthma/",
9 | step = "fastp",
10 | all_sample_num = 40,
11 | array = 1,
12 | partition = "cpu",
13 | cpus_per_task = 1,
14 | mem_per_cpu = "2G"
15 | )
16 | }
17 | \arguments{
18 | \item{work_dir}{work_dir}
19 |
20 | \item{step}{"fastp","rm_human","megahit","prodigal","salmon-quant",...}
21 |
22 | \item{all_sample_num}{all sample number}
23 |
24 | \item{array}{array number}
25 |
26 | \item{partition}{partition}
27 |
28 | \item{cpus_per_task}{cpus_per_task}
29 |
30 | \item{mem_per_cpu}{mem_per_cpu, "2G"}
31 | }
32 | \value{
33 | No value
34 | }
35 | \description{
36 | Microbiome sbatch
37 | }
38 |
--------------------------------------------------------------------------------
/man/procrustes_analyse.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{procrustes_analyse}
4 | \alias{procrustes_analyse}
5 | \title{Procrustes Rotation of Two Configurations and PROTEST}
6 | \usage{
7 | procrustes_analyse(b_res1, b_res2, nperm = 999, ...)
8 | }
9 | \arguments{
10 | \item{b_res1}{Target matrix}
11 |
12 | \item{b_res2}{Matrix to be rotated}
13 |
14 | \item{nperm}{numbers of permutations to perform}
15 |
16 | \item{...}{additional}
17 | }
18 | \value{
19 | pro_res
20 | }
21 | \description{
22 | Procrustes Rotation of Two Configurations and PROTEST
23 | }
24 | \examples{
25 | data(otutab, package = "pcutils")
26 | b_analyse(otutab, method = "pca") -> b_res1
27 | b_analyse(otutab * abs(rnorm(10)), method = "pca") -> b_res2
28 | pro_res <- procrustes_analyse(b_res1, b_res2)
29 | plot(pro_res, "Group", metadata)
30 | }
31 |
--------------------------------------------------------------------------------
/man/df2tree.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{df2tree}
4 | \alias{df2tree}
5 | \title{From a dataframe to construct a phylo}
6 | \usage{
7 | df2tree(data, edge_df = FALSE, ignore_pattern = NULL)
8 | }
9 | \arguments{
10 | \item{data}{dataframe}
11 |
12 | \item{edge_df}{if the data is edge_df ?}
13 |
14 | \item{ignore_pattern}{An optional regular expression pattern to match tip or node labels for dropping.}
15 | }
16 | \value{
17 | phylo object
18 | }
19 | \description{
20 | NOTE: this function will do \code{before_tree} first.
21 | }
22 | \examples{
23 | data(otutab, package = "pcutils")
24 | df2tree(taxonomy) -> tax_tree
25 | print(tax_tree)
26 | # check all nodes matched!
27 | if (requireNamespace("picante")) {
28 | picante::match.phylo.comm(tax_tree, t(otutab)) -> nn
29 | nrow(nn$comm) == nrow(t(otutab))
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/man/grap_p_test.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{grap_p_test}
4 | \alias{grap_p_test}
5 | \title{Performs graph-based permutation tests}
6 | \usage{
7 | grap_p_test(otutab, metadata, group = "Group", nperm = 999, ...)
8 | }
9 | \arguments{
10 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
11 |
12 | \item{metadata}{metadata}
13 |
14 | \item{group}{one group name in columns of metadata}
15 |
16 | \item{nperm}{numbers of permutations to perform}
17 |
18 | \item{...}{additional}
19 | }
20 | \value{
21 | ggplot
22 | }
23 | \description{
24 | Performs graph-based permutation tests
25 | }
26 | \examples{
27 | \donttest{
28 | if (requireNamespace("phyloseqGraphTest") && requireNamespace("phyloseq")) {
29 | data(otutab, package = "pcutils")
30 | grap_p_test(otutab, metadata, "Group")
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/man/volcano_p.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{volcano_p}
4 | \alias{volcano_p}
5 | \title{Volcano plot for difference analysis}
6 | \usage{
7 | volcano_p(
8 | res,
9 | logfc = 1,
10 | adjp = 0.05,
11 | text = TRUE,
12 | repel = TRUE,
13 | mode = 1,
14 | number = FALSE
15 | )
16 | }
17 | \arguments{
18 | \item{res}{result of \code{diff_da} which have colnames: tax, log2FoldChange, padj, compare, sig}
19 |
20 | \item{logfc}{log_fold_change threshold}
21 |
22 | \item{adjp}{adjust_p_value threshold}
23 |
24 | \item{text}{text, TRUE}
25 |
26 | \item{repel}{repel, TRUE}
27 |
28 | \item{mode}{1:normal; 2:multi_contrast}
29 |
30 | \item{number}{show the tax number}
31 | }
32 | \value{
33 | ggplot
34 | }
35 | \description{
36 | Volcano plot for difference analysis
37 | }
38 | \seealso{
39 | \code{\link{diff_da}}
40 | }
41 |
--------------------------------------------------------------------------------
/man/m_group_env.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/additional.R
3 | \name{m_group_env}
4 | \alias{m_group_env}
5 | \alias{plot.mant_g}
6 | \title{Multi-table test with env}
7 | \usage{
8 | m_group_env(g_otutab, env)
9 |
10 | \method{plot}{mant_g}(x, ...)
11 | }
12 | \arguments{
13 | \item{g_otutab}{multi-otutabs with first column is group}
14 |
15 | \item{env}{environmental factors}
16 |
17 | \item{x}{mant_g object}
18 |
19 | \item{...}{add}
20 | }
21 | \value{
22 | a mant_g object
23 |
24 | a ggplot
25 | }
26 | \description{
27 | Multi-table test with env
28 |
29 | Plot mant_g object
30 | }
31 | \examples{
32 | if (requireNamespace("linkET")) {
33 | data(otutab, package = "pcutils")
34 | cbind(group = rep(c("a", "b", "c"), c(200, 100, 185)), otutab) -> g_otutab
35 | metadata[, 3:8, drop = FALSE] -> env
36 | m_group_env(g_otutab, env) -> mant_g
37 | plot(mant_g)
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/man/rare_curve_species.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/rarefy.R
3 | \name{rare_curve_species}
4 | \alias{rare_curve_species}
5 | \title{Rare the species}
6 | \usage{
7 | rare_curve_species(
8 | otutab,
9 | step = 2000,
10 | method = "richness",
11 | mode = 2,
12 | reps = 3,
13 | threads = 1,
14 | verbose = TRUE
15 | )
16 | }
17 | \arguments{
18 | \item{otutab}{otutab}
19 |
20 | \item{step}{default 2000}
21 |
22 | \item{method}{one of "richness","chao1","ace","gc","shannon","simpson","pd","pielou"}
23 |
24 | \item{mode}{1 for little table, 2 for big}
25 |
26 | \item{reps}{reps}
27 |
28 | \item{threads}{use how many threads to calculate (default:1)}
29 |
30 | \item{verbose}{verbose}
31 | }
32 | \value{
33 | ggplot
34 | }
35 | \description{
36 | Rare the species
37 | }
38 | \examples{
39 | data(otutab, package = "pcutils")
40 | a <- rare_curve_species(otutab, mode = 1)
41 | plot(a)
42 | }
43 |
--------------------------------------------------------------------------------
/man/install_taxonkit.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/Rtaxonkit.R
3 | \name{install_taxonkit}
4 | \alias{install_taxonkit}
5 | \title{Install taxonkit}
6 | \usage{
7 | install_taxonkit(make_sure = FALSE, taxonkit_tar_gz = NULL)
8 | }
9 | \arguments{
10 | \item{make_sure}{make sure to do this}
11 |
12 | \item{taxonkit_tar_gz}{your download taxonkit_tar_gz file from https://github.com/shenwei356/taxonkit/releases/}
13 | }
14 | \value{
15 | No value
16 | }
17 | \description{
18 | Install taxonkit
19 | }
20 | \seealso{
21 | Other Rtaxonkit:
22 | \code{\link{check_taxonkit}()},
23 | \code{\link{download_taxonkit_dataset}()},
24 | \code{\link{name_or_id2df}()},
25 | \code{\link{taxonkit_filter}()},
26 | \code{\link{taxonkit_lca}()},
27 | \code{\link{taxonkit_lineage}()},
28 | \code{\link{taxonkit_list}()},
29 | \code{\link{taxonkit_name2taxid}()},
30 | \code{\link{taxonkit_reformat}()}
31 | }
32 | \concept{Rtaxonkit}
33 |
--------------------------------------------------------------------------------
/man/download_taxonkit_dataset.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/Rtaxonkit.R
3 | \name{download_taxonkit_dataset}
4 | \alias{download_taxonkit_dataset}
5 | \title{Download taxonkit dataset}
6 | \usage{
7 | download_taxonkit_dataset(make_sure = FALSE, taxdump_tar_gz = NULL)
8 | }
9 | \arguments{
10 | \item{make_sure}{make sure to do this}
11 |
12 | \item{taxdump_tar_gz}{your download taxdump_tar_gz file from https://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz}
13 | }
14 | \value{
15 | No value
16 | }
17 | \description{
18 | Download taxonkit dataset
19 | }
20 | \seealso{
21 | Other Rtaxonkit:
22 | \code{\link{check_taxonkit}()},
23 | \code{\link{install_taxonkit}()},
24 | \code{\link{name_or_id2df}()},
25 | \code{\link{taxonkit_filter}()},
26 | \code{\link{taxonkit_lca}()},
27 | \code{\link{taxonkit_lineage}()},
28 | \code{\link{taxonkit_list}()},
29 | \code{\link{taxonkit_name2taxid}()},
30 | \code{\link{taxonkit_reformat}()}
31 | }
32 | \concept{Rtaxonkit}
33 |
--------------------------------------------------------------------------------
/man/add_strip.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{add_strip}
4 | \alias{add_strip}
5 | \title{add strips for a tree plot}
6 | \usage{
7 | add_strip(trp, some_tax, flat_n = 5, strip_params = NULL)
8 | }
9 | \arguments{
10 | \item{trp}{tree plot from \code{ggtree}}
11 |
12 | \item{some_tax}{some tax you want to add strip}
13 |
14 | \item{flat_n}{flat the text when taxa number more than \code{flat_n}.}
15 |
16 | \item{strip_params}{parameters parse to \code{\link[ggtree]{geom_strip}}}
17 | }
18 | \value{
19 | tree plot
20 | }
21 | \description{
22 | add strips for a tree plot
23 | }
24 | \examples{
25 | \donttest{
26 | data(otutab, package = "pcutils")
27 | # run yourself
28 | if (interactive()) {
29 | ann_tree(taxonomy, otutab) -> tree
30 | easy_tree(tree) -> p
31 | some_tax <- table(taxonomy$Phylum) \%>\%
32 | sort(decreasing = TRUE) \%>\%
33 | head(5) \%>\%
34 | names()
35 | add_strip(p, some_tax)
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/R/pctax-package.R:
--------------------------------------------------------------------------------
1 | #' @keywords internal
2 | "_PACKAGE"
3 |
4 |
5 | ## usethis namespace: start
6 | #' @importFrom utils data
7 | #' @importFrom utils head tail
8 | #' @importFrom stats aggregate median var sd setNames runif relevel time na.omit kmeans anova t.test
9 | #' @importFrom tibble column_to_rownames
10 | #' @importFrom tibble rownames_to_column
11 | #' @importFrom reshape2 melt
12 | #' @importFrom pcutils lib_ps hebing trans dabiao generate_labels update_param get_cols t2 change_fac_lev
13 | #' @import dplyr
14 | #' @import ggplot2
15 | ## usethis namespace: end
16 | NULL
17 |
18 | ## quiets concerns of R CMD check re: the .'s that appear in pipelines
19 | if (getRversion() >= "2.15.1") utils::globalVariables(c("."))
20 |
21 | pctax_theme <- {
22 | ggplot2::theme_classic(base_size = 13) +
23 | ggplot2::theme(
24 | axis.text = ggplot2::element_text(color = "black"),
25 | plot.margin = grid::unit(rep(0.5, 4), "lines"),
26 | strip.background = ggplot2::element_rect(fill = NA)
27 | )
28 | }
29 |
--------------------------------------------------------------------------------
/man/permanova2.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/additional.R
3 | \name{permanova2}
4 | \alias{permanova2}
5 | \title{Permanova between a otutab and a variable (added \code{two})}
6 | \usage{
7 | permanova2(
8 | otutab,
9 | envs,
10 | norm = TRUE,
11 | each = TRUE,
12 | method = "adonis",
13 | dist = "bray",
14 | two = FALSE,
15 | nperm = 999,
16 | ...
17 | )
18 | }
19 | \arguments{
20 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
21 |
22 | \item{envs}{factors need to test}
23 |
24 | \item{norm}{should normalize?(default:TRUE)}
25 |
26 | \item{each}{test factor one by one, rather than whole}
27 |
28 | \item{method}{adonis/mrpp/anosim/mantel}
29 |
30 | \item{dist}{if use pcoa or nmds, your can choose a dist method (default: bray)}
31 |
32 | \item{two}{two by two adonis test}
33 |
34 | \item{nperm}{numbers of permutations to perform}
35 |
36 | \item{...}{additional}
37 | }
38 | \description{
39 | Permanova between a otutab and a variable (added \code{two})
40 | }
41 |
--------------------------------------------------------------------------------
/man/sangji_plot.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/additional.R
3 | \name{sangji_plot}
4 | \alias{sangji_plot}
5 | \title{Plot a sankey}
6 | \usage{
7 | sangji_plot(
8 | tree,
9 | top_N = 5,
10 | notshow = c(),
11 | intermediate = FALSE,
12 | width = 3000,
13 | height = 500,
14 | ...
15 | )
16 | }
17 | \arguments{
18 | \item{tree}{result from \code{\link{ann_tree}}}
19 |
20 | \item{top_N}{each level has top_N}
21 |
22 | \item{notshow}{some words you don't want to show}
23 |
24 | \item{intermediate}{logical, show the intermediate rank}
25 |
26 | \item{width}{width}
27 |
28 | \item{height}{height}
29 |
30 | \item{...}{look for parameters in \code{\link[sankeyD3]{sankeyNetwork}}}
31 | }
32 | \value{
33 | html widget
34 | }
35 | \description{
36 | Plot a sankey
37 | }
38 | \examples{
39 | \donttest{
40 | if (requireNamespace("sankeyD3") && requireNamespace("tidytree")) {
41 | data(otutab, package = "pcutils")
42 | ann_tree(taxonomy[, c(1, 5, 6, 7)], otutab) -> tree
43 | sangji_plot(tree)
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/man/as.b_dist.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{as.b_dist}
4 | \alias{as.b_dist}
5 | \alias{plot.dist}
6 | \alias{plot.b_dist}
7 | \title{Transfer dist to b_dist}
8 | \usage{
9 | as.b_dist(dist, group_df = NULL)
10 |
11 | \method{plot}{dist}(x, group_df = NULL, ...)
12 |
13 | \method{plot}{b_dist}(x, mode = 1, c_group = "inter", ...)
14 | }
15 | \arguments{
16 | \item{dist}{a dist object}
17 |
18 | \item{group_df}{a dataframe with rowname same to dist and one group column}
19 |
20 | \item{x}{a b_dist}
21 |
22 | \item{...}{additional}
23 |
24 | \item{mode}{1~3}
25 |
26 | \item{c_group}{"inter" or "intra" or both to plot}
27 | }
28 | \value{
29 | a b_dist with annotation by group
30 |
31 | a pheatmap
32 |
33 | a ggplot or pheatmap
34 | }
35 | \description{
36 | Transfer dist to b_dist
37 |
38 | Plot dist
39 |
40 | Plot b_dist
41 | }
42 | \examples{
43 | data(otutab, package = "pcutils")
44 | mat_dist(otutab) \%>\% as.b_dist(., group_df = metadata["Group"]) -> aa
45 | plot(aa)
46 | plot(aa, mode = 2)
47 | }
48 |
--------------------------------------------------------------------------------
/R/data.R:
--------------------------------------------------------------------------------
1 | #' @title test data (pc_otu class) for pc_tax package.
2 | #' @description an otutab, metadata and a taxonomy table.
3 | #'
4 | #' @docType data
5 | #' @name pc_tax1
6 | #' @format a pc_otu contains an otutab, metadata and a taxonomy table.
7 | #' \describe{
8 | #' \item{tbls}{contians otutable rawdata}
9 | #' \item{metas}{contians metadata}
10 | #' \item{otus}{contians taxomomy table}
11 | #' }
12 | NULL
13 |
14 | #' @title all element cycle information.
15 | #' @description all element cycle information.
16 | #'
17 | #' @docType data
18 | #' @name all_ec_info
19 | #' @format a list contains four tables.
20 | #' \describe{
21 | #' \item{ec_node}{chemicals}
22 | #' \item{ec_link}{reactions}
23 | #' \item{ec_gene}{genes}
24 | #' \item{ec_path}{reactions labels}
25 | #' }
26 | NULL
27 |
28 | #' @title all species latin names and chinese names
29 | #' @description all species latin names and chinese names.
30 | #'
31 | #' @docType data
32 | #' @name all_sp_la_zh_name
33 | #' @format a dataframe.
34 | #' \describe{
35 | #' \item{latin_name}{latin name}
36 | #' \item{chinese_name}{chinese name}
37 | #' }
38 | NULL
39 |
--------------------------------------------------------------------------------
/man/diff_da.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/diff_analyse.R
3 | \name{diff_da}
4 | \alias{diff_da}
5 | \title{Difference analysis}
6 | \usage{
7 | diff_da(
8 | otutab,
9 | group_df,
10 | ctrl = NULL,
11 | method = "deseq2",
12 | log = TRUE,
13 | add_mini = NULL,
14 | ...
15 | )
16 | }
17 | \arguments{
18 | \item{otutab}{otutab}
19 |
20 | \item{group_df}{a dataframe with rowname same to dist and one group column}
21 |
22 | \item{ctrl}{the control group, one level of groups}
23 |
24 | \item{method}{one of "deseq2","edger","limma","t.test","wilcox.test"}
25 |
26 | \item{log}{do log transfer for limma?}
27 |
28 | \item{add_mini}{add_mini when calculate the logFC. e.g (10+0.1)/(0+0.1), default \code{0.5*min(abundance)}}
29 |
30 | \item{...}{other parameters}
31 | }
32 | \value{
33 | a dataframe
34 | }
35 | \description{
36 | Difference analysis
37 | }
38 | \examples{
39 | \donttest{
40 | if (requireNamespace("limma")) {
41 | data(otutab, package = "pcutils")
42 | diff_da(otutab, metadata["Group"], method = "limma") -> res
43 | volcano_p(res)
44 | volcano_p(res, mode = 2)
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/man/pctax-package.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/pctax-package.R
3 | \docType{package}
4 | \name{pctax-package}
5 | \alias{pctax}
6 | \alias{pctax-package}
7 | \title{pctax: Professional Comprehensive Omics Data Analysis}
8 | \description{
9 | Provides a comprehensive suite of tools for analyzing omics data. It includes functionalities for alpha diversity analysis, beta diversity analysis, differential abundance analysis, community assembly analysis, visualization of phylogenetic tree, and functional enrichment analysis. With a progressive approach, the package offers a range of analysis methods to explore and understand the complex communities. It is designed to support researchers and practitioners in conducting in-depth and professional omics data analysis.
10 | }
11 | \seealso{
12 | Useful links:
13 | \itemize{
14 | \item \url{https://github.com/Asa12138/pctax}
15 | \item Report bugs at \url{https://github.com/Asa12138/pctax/issues}
16 | }
17 |
18 | }
19 | \author{
20 | \strong{Maintainer}: Chen Peng \email{pengchen2001@zju.edu.cn} (\href{https://orcid.org/0000-0002-9449-7606}{ORCID})
21 |
22 | }
23 | \keyword{internal}
24 |
--------------------------------------------------------------------------------
/_pkgdown.yml:
--------------------------------------------------------------------------------
1 | url: ~
2 | template:
3 | params:
4 | bootswatch: cosmo
5 | docsearch:
6 | api_key: 599cec31baffa4868cae4e79f180729b
7 | index_name: docsearch
8 |
9 | navbar:
10 | title: "pctax"
11 | left:
12 | - icon: fa-home fa-lg
13 | href: index.html
14 | - text: "Vignettes"
15 | href: articles/index.html
16 | - text: "Functions"
17 | href: reference/index.html
18 | - text: "News"
19 | href: news/index.html
20 | - text: "Other Packages"
21 | menu:
22 | - text: "pcutils"
23 | href: https://asa12138.github.io/pcutils
24 | - text: "pctax"
25 | href: https://asa12138.github.io/pctax
26 | - text: "ReporterScore"
27 | href: https://asa12138.github.io/ReporterScore
28 | - text: "MetaNet"
29 | href: https://asa12138.github.io/MetaNet
30 | - text: "iPhylo"
31 | href: https://iphylo.net
32 | - text: "plot4fun"
33 | href: https://asa12138.github.io/plot4fun
34 | - text: "Asa_web"
35 | href: https://asa12138.github.io/
36 | right:
37 | - icon: fa-github
38 | href: https://github.com/Asa12138/pctax
39 |
--------------------------------------------------------------------------------
/man/batch_mediate.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/stats.R
3 | \name{batch_mediate}
4 | \alias{batch_mediate}
5 | \title{Batch mediate}
6 | \usage{
7 | batch_mediate(data, mediator_df, nsims = 500, conf.level = 0.95)
8 | }
9 | \arguments{
10 | \item{data}{data.frame with two columns: X (independent variable) and Y (dependent variable).}
11 |
12 | \item{mediator_df}{data.frame with mediators, each column representing a different mediator variable.}
13 |
14 | \item{nsims}{Number of bootstrap simulations for estimating confidence intervals (default is 500).}
15 |
16 | \item{conf.level}{Confidence level for the confidence intervals (default is 0.95).}
17 | }
18 | \value{
19 | data.frame
20 | }
21 | \description{
22 | Batch mediate
23 | }
24 | \examples{
25 | set.seed(123)
26 | n <- 200
27 | X <- rnorm(n)
28 | M1 <- 0.5 * X + rnorm(n)
29 | M2 <- 0.3 * X + rnorm(n)
30 | M3 <- 0.1 * X + rnorm(n)
31 | Y <- 0.3 * X + 0.4 * M1 + 0.2 * M2 + rnorm(n)
32 | data <- data.frame(X, Y)
33 | mediators <- data.frame(M1, M2, M3)
34 | if (requireNamespace("mediation")) {
35 | results <- batch_mediate(data, mediators)
36 | print(results)
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/man/aor.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/rarefy.R
3 | \name{aor}
4 | \alias{aor}
5 | \alias{aor.data.frame}
6 | \alias{plot.AOR}
7 | \title{Calculate Abundance-occupancy_relationship}
8 | \usage{
9 | aor(otutab, ...)
10 |
11 | \method{aor}{data.frame}(
12 | otutab,
13 | top_r = 0.7,
14 | ocup_n = ceiling(0.8 * ncol(otutab)),
15 | special_n = ceiling(0.1 * ncol(otutab)),
16 | ...
17 | )
18 |
19 | \method{plot}{AOR}(x, ...)
20 | }
21 | \arguments{
22 | \item{otutab}{otutab}
23 |
24 | \item{...}{add}
25 |
26 | \item{top_r}{percentage of top relative abundance}
27 |
28 | \item{ocup_n}{percentage of top occupied}
29 |
30 | \item{special_n}{how many occupancy define as specialists}
31 |
32 | \item{x}{AOR object}
33 | }
34 | \value{
35 | AOR
36 |
37 | ggplot
38 | }
39 | \description{
40 | Calculate Abundance-occupancy_relationship
41 |
42 | Plot a AOR
43 | }
44 | \examples{
45 | data(otutab, package = "pcutils")
46 | aor(otutab) -> AOR
47 | plot(AOR)
48 | }
49 | \references{
50 | Barberán, A., Bates, S. T., Casamayor, E. & Fierer, N. (2012) Using network analysis to explore co-occurrence patterns in soil microbial communities.
51 | }
52 |
--------------------------------------------------------------------------------
/man/geo_sim.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{geo_sim}
4 | \alias{geo_sim}
5 | \title{Lm for sample similarity and geographical distance}
6 | \usage{
7 | geo_sim(otutab, geo, method = "bray", spe_nwk = NULL, ...)
8 | }
9 | \arguments{
10 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
11 |
12 | \item{geo}{a two-columns dataframe, first is latitude, second is longitude}
13 |
14 | \item{method}{Dissimilarity index, partial match to "bray", "euclidean"...see \code{\link[vegan]{vegdist};\link[picante]{unifrac}}}
15 |
16 | \item{spe_nwk}{a phylo tree if use unifrac...}
17 |
18 | \item{...}{additional}
19 | }
20 | \value{
21 | a ggplot
22 | }
23 | \description{
24 | Lm for sample similarity and geographical distance
25 | }
26 | \examples{
27 | if (requireNamespace("geosphere")) {
28 | library(ggplot2)
29 | data(otutab, package = "pcutils")
30 | metadata[, c("lat", "long")] -> geo
31 | geo_sim(otutab, geo) -> geo_res
32 | }
33 | }
34 | \references{
35 | Graco-Roza, C. et al. (2022) Distance decay 2.0 - A global synthesis of taxonomic and functional turnover in ecological communities. Glob Ecol Biogeogr 31, 1399–1421.
36 | }
37 |
--------------------------------------------------------------------------------
/man/nst.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eco_micro.R
3 | \name{nst}
4 | \alias{nst}
5 | \title{Calculate NST for each group}
6 | \usage{
7 | nst(otutab, group_df, threads = 1, file = NULL, rep = 20, save = FALSE)
8 | }
9 | \arguments{
10 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
11 |
12 | \item{group_df}{a dataframe with rowname and one group column}
13 |
14 | \item{threads}{default:4}
15 |
16 | \item{file}{filename to save}
17 |
18 | \item{rep}{repeat numbers: suggest 999}
19 |
20 | \item{save}{save the file}
21 | }
22 | \value{
23 | a b_dist object, dis is MSTij
24 | }
25 | \description{
26 | Calculate NST for each group
27 | }
28 | \examples{
29 | \donttest{
30 | if (requireNamespace("NST")) {
31 | library(ggplot2)
32 | data(otutab, package = "pcutils")
33 | nst(otutab, metadata["Group"]) -> nst_res
34 | plot(nst_res, c_group = "intra") + geom_hline(yintercept = 0.5, lty = 2) + ylab("NST")
35 | }
36 | }
37 | }
38 | \references{
39 | Ning, D., Deng, Y., Tiedje, J. M. & Zhou, J. (2019) A general framework for quantitatively assessing ecological stochasticity. Proceedings of the National Academy of Sciences 116, 16892–16898.
40 | }
41 |
--------------------------------------------------------------------------------
/man/a_diversity.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/a_diversity.R
3 | \name{a_diversity}
4 | \alias{a_diversity}
5 | \alias{a_diversity.data.frame}
6 | \alias{a_diversity.pc_otu}
7 | \alias{a_diversity.numeric}
8 | \title{Calculate a_diversity of otutab}
9 | \usage{
10 | a_diversity(otutab, ...)
11 |
12 | \method{a_diversity}{data.frame}(
13 | otutab,
14 | method = c("richness", "shannon"),
15 | tree = NULL,
16 | digits = 4,
17 | ...
18 | )
19 |
20 | \method{a_diversity}{pc_otu}(otutab, method = "all", tbl = "otutab", ...)
21 |
22 | \method{a_diversity}{numeric}(otutab, ...)
23 | }
24 | \arguments{
25 | \item{otutab}{numeric}
26 |
27 | \item{...}{pass to \code{a_diversity.data.frame}}
28 |
29 | \item{method}{one of "all","richness","chao1","ace","gc","shannon","simpson","pd","pielou"}
30 |
31 | \item{tree}{a iphylo object match the rownames of otutab}
32 |
33 | \item{digits}{maintance how many digits}
34 |
35 | \item{tbl}{which table}
36 | }
37 | \value{
38 | a a_res object
39 | }
40 | \description{
41 | Calculate a_diversity of otutab
42 | }
43 | \examples{
44 | data(otutab, package = "pcutils")
45 | a_diversity(otutab) -> a_res
46 | plot(a_res, "Group", metadata)
47 | }
48 |
--------------------------------------------------------------------------------
/man/drop_tips_update.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{drop_tips_update}
4 | \alias{drop_tips_update}
5 | \title{Drop Tips and Update a Phylogenetic Tree}
6 | \usage{
7 | drop_tips_update(tr, drop_name, pattern = NULL)
8 | }
9 | \arguments{
10 | \item{tr}{A phylogenetic tree of class \code{phylo}.}
11 |
12 | \item{drop_name}{A character vector of tip or node names to drop.
13 | If missing and \code{pattern} is provided, names matching the pattern will be dropped.}
14 |
15 | \item{pattern}{An optional regular expression pattern to match tip or node labels for dropping.}
16 | }
17 | \value{
18 | A \code{phylo} object with specified tips removed.
19 | }
20 | \description{
21 | This function iteratively removes specified tips (or tips matching a pattern)
22 | from a phylogenetic tree without collapsing internal nodes or singleton nodes.
23 | }
24 | \examples{
25 | if (requireNamespace("ape")) {
26 | library(ape)
27 | tr <- rtree(10)
28 | plot(tr)
29 | # Drop tips containing "t1" or "t2" in their label
30 | tr2 <- drop_tips_update(tr, pattern = "t1|t2")
31 | plot(tr2)
32 |
33 | # Alternatively, specify tips directly
34 | tr3 <- drop_tips_update(tr, drop_name = c("t3", "t5"))
35 | plot(tr3)
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/man/ncm.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eco_micro.R
3 | \name{ncm}
4 | \alias{ncm}
5 | \alias{plot.ncm_res}
6 | \title{Sloan Neutral Model}
7 | \usage{
8 | ncm(otutab, model = "nls")
9 |
10 | \method{plot}{ncm_res}(
11 | x,
12 | mycols = c(Above = "#069870", Below = "#e29e02", In = "#1e353a"),
13 | text_position = NULL,
14 | pie_text_params = list(size = 2.5),
15 | ...
16 | )
17 | }
18 | \arguments{
19 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
20 |
21 | \item{model}{fit method, one of "nls","mle"}
22 |
23 | \item{x}{a ncm_res object}
24 |
25 | \item{mycols}{mycols}
26 |
27 | \item{text_position}{text_position}
28 |
29 | \item{pie_text_params}{pie text parameters}
30 |
31 | \item{...}{add}
32 | }
33 | \value{
34 | ncm_res
35 |
36 | ggplot
37 | }
38 | \description{
39 | Sloan Neutral Model
40 |
41 | Plot ncm_res
42 | }
43 | \examples{
44 | \donttest{
45 | if (requireNamespace("Hmisc") && requireNamespace("minpack.lm")) {
46 | data(otutab, package = "pcutils")
47 | ncm(otutab) -> ncm_res
48 | plot(ncm_res)
49 | }
50 | }
51 | }
52 | \references{
53 | Sloan, W. TRUE. et al. (2006) Quantifying the roles of immigration and chance in shaping prokaryote community structure. Environmental Microbiology 8, 732–740.
54 | }
55 |
--------------------------------------------------------------------------------
/man/name_or_id2df.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/Rtaxonkit.R
3 | \name{name_or_id2df}
4 | \alias{name_or_id2df}
5 | \title{Transfer taxon name or taxid to the lineage dataframe}
6 | \usage{
7 | name_or_id2df(
8 | name_or_id,
9 | mode = "name",
10 | add_prefix = TRUE,
11 | fill_miss_rank = TRUE,
12 | data_dir = NULL
13 | )
14 | }
15 | \arguments{
16 | \item{name_or_id}{name or taxid}
17 |
18 | \item{mode}{"id" or "name"}
19 |
20 | \item{add_prefix}{add_prefix}
21 |
22 | \item{fill_miss_rank}{fill_miss_rank}
23 |
24 | \item{data_dir}{directory containing nodes.dmp and names.dmp (default "/Users/asa/.taxonkit")}
25 | }
26 | \value{
27 | dataframe
28 | }
29 | \description{
30 | Transfer taxon name or taxid to the lineage dataframe
31 | }
32 | \examples{
33 | \dontrun{
34 | name_or_id2df(c("Homo sapiens", "Akkermansia muciniphila ATCC BAA-835"))
35 | }
36 | }
37 | \seealso{
38 | Other Rtaxonkit:
39 | \code{\link{check_taxonkit}()},
40 | \code{\link{download_taxonkit_dataset}()},
41 | \code{\link{install_taxonkit}()},
42 | \code{\link{taxonkit_filter}()},
43 | \code{\link{taxonkit_lca}()},
44 | \code{\link{taxonkit_lineage}()},
45 | \code{\link{taxonkit_list}()},
46 | \code{\link{taxonkit_name2taxid}()},
47 | \code{\link{taxonkit_reformat}()}
48 | }
49 | \concept{Rtaxonkit}
50 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Common R files
2 | .Rproj.user
3 | .Rhistory
4 | .RData
5 | .Ruserdata
6 | .Renviron
7 | *.Rproj
8 | .quarto
9 | .quarto/
10 | .DS_Store
11 | **/.DS_Store
12 | .DS_Store?
13 | *_cache/
14 | /cache/
15 | # R books
16 | _bookdown_files
17 | _book
18 | _freeze
19 | # pkgdown site
20 | docs/
21 | # RStudio Connect folder
22 | rsconnect/
23 | # History files
24 | .Rhistory
25 | .Rapp.history
26 |
27 | # Session Data files
28 | .RData
29 |
30 | # User-specific files
31 | .Ruserdata
32 |
33 | # Example code in package build process
34 | *-Ex.R
35 |
36 | # Output files from R CMD build
37 | /*.tar.gz
38 |
39 | # Output files from R CMD check
40 | /*.Rcheck/
41 |
42 | # RStudio files
43 | .Rproj.user/
44 |
45 | # produced vignettes
46 | vignettes/*.html
47 | vignettes/*.pdf
48 |
49 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
50 | .httr-oauth
51 |
52 | # knitr and R markdown default cache directories
53 | *_cache/
54 | /cache/
55 |
56 | # Temporary files created by R markdown
57 | *.utf8.md
58 | *.knit.md
59 |
60 | # R Environment Variables
61 | .Renviron
62 |
63 | RMT_temp/
64 | *.csv
65 | .DS_Store
66 |
67 | inst/doc
68 | /doc/
69 | /Meta/
70 |
71 | article
72 | article/*
73 | README.qmd
74 | README.html
75 | README_cache/
76 | .DS_Store
77 | */.DS_Store
78 | *.Rproj
79 | .gitignore
80 | docs
81 |
82 |
--------------------------------------------------------------------------------
/man/pre_tax_table.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{pre_tax_table}
4 | \alias{pre_tax_table}
5 | \title{Complete a taxonomy table}
6 | \usage{
7 | pre_tax_table(
8 | tax_table,
9 | tax_levels = c("k", "p", "c", "o", "f", "g", "s", "st"),
10 | na_tax = "Unclassified|uncultured|Ambiguous|Unknown|unknown|metagenome|Unassig",
11 | ignore.case = TRUE,
12 | na_repalce = "Unknown"
13 | )
14 | }
15 | \arguments{
16 | \item{tax_table}{taxonomy table}
17 |
18 | \item{tax_levels}{a vector whose length longer than \code{ncol(taxdf)}, use to be prefix. Default: c("k", "p", "c", "o", "f", "g","s", "st")}
19 |
20 | \item{na_tax}{grepl some words and turn to \code{na_repalce}, default: "Unclassified|uncultured|Ambiguous|Unknown|unknown|metagenome|Unassig"}
21 |
22 | \item{ignore.case}{ignore.case for \code{na_tax}}
23 |
24 | \item{na_repalce}{defalut: Unknown}
25 | }
26 | \value{
27 | a good taxonomy table
28 | }
29 | \description{
30 | Complete a taxonomy table
31 | }
32 | \examples{
33 | taxmat <- matrix(sample("onelevel", 7 * 2, replace = TRUE), nrow = 2, ncol = 7) \%>\% as.data.frame()
34 | colnames(taxmat) <- c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Species")
35 | pre_tax_table(taxmat)
36 | }
37 | \references{
38 | \code{MicrobiotaProcess}
39 | }
40 |
--------------------------------------------------------------------------------
/NEWS.md:
--------------------------------------------------------------------------------
1 | # pctax v0.1.6 Notes
2 |
3 | ## Fixed
4 |
5 | - fixed `taxonkit` function for windows <2025-06-12, Thu>
6 |
7 | # pctax v0.1.5 Notes
8 |
9 | ## Added
10 |
11 | - added `load_mpa_df` function <2025-06-12, Thu>
12 | - added `pre_assembly_stats` function <2025-06-12, Thu>
13 |
14 | # pctax v0.1.4 Notes
15 |
16 | ## Added
17 |
18 | - added `stamp_plot` function <2025-06-12, Thu>
19 | - added `multi_conf` function <2025-06-12, Thu>
20 |
21 | # pctax v0.1.3 Notes
22 |
23 | ## Added
24 |
25 | - added mode 4 for `plot.b_res` function <2025-04-27, Sun>
26 | - added `drop_tips_update()` function <2025-04-27, Sun>
27 | - added `stamp_plot` function <2025-01-14, Tue>
28 | - added `convert_taxon_name` function <2024-11-19, Tue>
29 | - added `plot_two_tree` function <2024-10-22, Tue>
30 |
31 | ## Fixed
32 |
33 | - fixed the file.path in windows for taxonkit <2024-11-27, Wed>
34 |
35 | # pctax v0.1.2 Notes
36 |
37 | ## Added
38 |
39 | - added `topN` argument for `easy_tree()` <2024-06-25, Tue>
40 |
41 | # pctax v0.1.1 Notes
42 |
43 | ## Fixed
44 |
45 | - Use `ggforce` to replace `ggchicklet` as `ggchicklet` is not available at CRAN <2024-03-08, Fri>
46 |
47 | ## Added
48 |
49 | - improved the `plot.b_res`, added the `permanova_res` argument <2024-03-23, Sat>
50 |
51 | # pctax v0.1.0 Notes
52 |
53 | ## Added
54 |
55 | - available at CRAN <2024-02-29, Thu>
56 |
57 | ## Fixed
58 |
59 | - fixed the `ann_tree` <2024-02-29, Thu>
60 |
61 |
--------------------------------------------------------------------------------
/man/permanova.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{permanova}
4 | \alias{permanova}
5 | \title{Permanova between a otutab and a variable}
6 | \usage{
7 | permanova(
8 | otutab,
9 | envs,
10 | norm = TRUE,
11 | each = TRUE,
12 | method = "adonis",
13 | dist = "bray",
14 | nperm = 999,
15 | ...
16 | )
17 | }
18 | \arguments{
19 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
20 |
21 | \item{envs}{factors need to test}
22 |
23 | \item{norm}{should normalize?(default:TRUE)}
24 |
25 | \item{each}{test factor one by one, rather than whole}
26 |
27 | \item{method}{adonis/mrpp/anosim/mantel}
28 |
29 | \item{dist}{if use pcoa or nmds, your can choose a dist method (default: bray)}
30 |
31 | \item{nperm}{numbers of permutations to perform}
32 |
33 | \item{...}{additional}
34 | }
35 | \value{
36 | a g_test object with these columns
37 | \item{group}{the test group or factor}
38 | \item{r}{relationship}
39 | \item{r2}{model R-square}
40 | \item{p_value}{model test p_value}
41 | \item{sig}{whether significant}
42 | }
43 | \description{
44 | Permanova between a otutab and a variable
45 | }
46 | \examples{
47 | data(otutab, package = "pcutils")
48 | permanova(otutab, metadata[, c(2:10)]) -> adonis_res
49 | print(adonis_res)
50 | plot(adonis_res)
51 | }
52 | \references{
53 | \url{https://blog.csdn.net/qq_42458954/article/details/110390488}
54 | }
55 |
--------------------------------------------------------------------------------
/man/z_diversity_decay.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/a_diversity.R
3 | \name{z_diversity_decay}
4 | \alias{z_diversity_decay}
5 | \alias{plot.zeta_decay}
6 | \title{Calculate Zeta Diversity with Distance}
7 | \usage{
8 | z_diversity_decay(otutab, xy_df, group_df = NULL, zetadiv_params = list())
9 |
10 | \method{plot}{zeta_decay}(x, ribbon = TRUE, ...)
11 | }
12 | \arguments{
13 | \item{otutab}{A matrix or data frame containing OTU (Operational Taxonomic Unit) counts.}
14 |
15 | \item{xy_df}{Site coordinates.}
16 |
17 | \item{group_df}{A data frame containing group information.}
18 |
19 | \item{zetadiv_params}{Additional parameters to be passed to the Zeta.ddecay function from the zetadiv package.}
20 |
21 | \item{x}{Zeta diversity results obtained from z_diversity_decay function.}
22 |
23 | \item{ribbon}{Logical, whether to add a ribbon to the plot for standard deviation.}
24 |
25 | \item{...}{Additional arguments to be passed to ggplot2 functions.}
26 | }
27 | \value{
28 | zeta_decay
29 |
30 | A ggplot object.
31 | }
32 | \description{
33 | This function calculates Zeta diversity for each group in the provided otutab.
34 | }
35 | \examples{
36 | if (requireNamespace("zetadiv")) {
37 | data(otutab, package = "pcutils")
38 | zeta_decay_result <- z_diversity_decay(otutab, metadata[, c("lat", "long")],
39 | metadata["Group"],
40 | zetadiv_params = list(sam = 10)
41 | )
42 | plot(zeta_decay_result)
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/man/nti_rc.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eco_micro.R
3 | \name{nti_rc}
4 | \alias{nti_rc}
5 | \alias{plot.NTI_RC}
6 | \title{Calculate b_NTI and RC_bray for each group}
7 | \usage{
8 | nti_rc(
9 | otutab,
10 | phylo,
11 | group_df,
12 | threads = 1,
13 | file = NULL,
14 | rep = 20,
15 | save = FALSE
16 | )
17 |
18 | \method{plot}{NTI_RC}(x, ...)
19 | }
20 | \arguments{
21 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
22 |
23 | \item{phylo}{a phylo object}
24 |
25 | \item{group_df}{a dataframe with rowname and one group column}
26 |
27 | \item{threads}{default:4}
28 |
29 | \item{file}{filename to save}
30 |
31 | \item{rep}{repeat numbers: suggest 999}
32 |
33 | \item{save}{save the file}
34 |
35 | \item{x}{NTI_RC object}
36 |
37 | \item{...}{pass to \code{\link[pcutils]{stackplot}}}
38 | }
39 | \value{
40 | a b_dist object, dis is MSTij
41 |
42 | ggplot
43 | }
44 | \description{
45 | Calculate b_NTI and RC_bray for each group
46 |
47 | Plot NTI_RC object
48 | }
49 | \examples{
50 | \donttest{
51 | if (requireNamespace("NST") && requireNamespace("pctax")) {
52 | data(otutab, package = "pcutils")
53 | pctax::df2tree(taxonomy) -> phylo
54 | nti_rc(otutab, phylo, metadata["Group"]) -> nti_res
55 | plot(nti_res)
56 | }
57 | }
58 | }
59 | \references{
60 | Ning, D., Deng, Y., Tiedje, J. M. & Zhou, J. (2019) A general framework for quantitatively assessing ecological stochasticity. Proceedings of the National Academy of Sciences 116, 16892–16898.
61 | }
62 |
--------------------------------------------------------------------------------
/vignettes/pctax.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Quick start: pctax"
3 | output:
4 | prettydoc::html_pretty:
5 | keep_md: true
6 | toc: true
7 | toc_depth: 3
8 | theme: architect
9 | vignette: >
10 | %\VignetteIndexEntry{pctax}
11 | %\VignetteEngine{knitr::rmarkdown}
12 | %\VignetteEncoding{UTF-8}
13 | ---
14 |
15 | ```{r, include = FALSE}
16 | knitr::opts_chunk$set(
17 | collapse = TRUE, cache = TRUE,
18 | comment = "#>",
19 | dpi = 72
20 | )
21 | ```
22 |
23 | ```{r setup,include=FALSE}
24 | library(pctax)
25 | library(pcutils)
26 | ```
27 |
28 | # pctax
29 |
30 | `pctax` provides a comprehensive suite of tools for analyzing omics data.
31 |
32 | ## Vignette
33 |
34 | Please go to for the full vignette.
35 |
36 | ## Install
37 |
38 | ```{r eval=FALSE}
39 | install.packages("devtools")
40 | devtools::install_github("Asa12138/pcutils")
41 | devtools::install_github("Asa12138/pctax")
42 | ```
43 |
44 | ## Usage
45 | It includes functionalities for α-diversity analysis, β-diversity analysis, differential abundance analysis, community assembly, visualization of phylogenetic tree and functional enrichment analysis...
46 |
47 | Look at the test data:
48 | ```{r lib}
49 | library(pctax)
50 | library(pcutils)
51 | data(otutab, package = "pcutils")
52 | # help(otutab)
53 |
54 | head(otutab)
55 | head(metadata)
56 | head(taxonomy)
57 | ```
58 |
59 | ## Citation
60 | Please cite:
61 |
62 | Chen Peng (2023). _pctax: Professional Comprehensive Omics Data Analysis_. R package, .
63 |
--------------------------------------------------------------------------------
/pkgdown/favicon/safari-pinned-tab.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
27 |
--------------------------------------------------------------------------------
/.github/workflows/R-CMD-check.yaml:
--------------------------------------------------------------------------------
1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3 | on:
4 | push:
5 | branches: [main, master]
6 | pull_request:
7 | branches: [main, master]
8 |
9 | name: R-CMD-check
10 |
11 | jobs:
12 | R-CMD-check:
13 | runs-on: ${{ matrix.config.os }}
14 |
15 | name: ${{ matrix.config.os }} (${{ matrix.config.r }})
16 |
17 | strategy:
18 | fail-fast: false
19 | matrix:
20 | config:
21 | # - {os: macos-latest, r: 'release'}
22 | - {os: windows-latest, r: 'release'}
23 | - {os: ubuntu-latest, r: 'release'}
24 |
25 | env:
26 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
27 | R_KEEP_PKG_SOURCE: yes
28 |
29 | steps:
30 | - uses: actions/checkout@v4
31 |
32 | - uses: r-lib/actions/setup-pandoc@v2
33 |
34 | - uses: r-lib/actions/setup-r@v2
35 | with:
36 | r-version: ${{ matrix.config.r }}
37 | http-user-agent: ${{ matrix.config.http-user-agent }}
38 | use-public-rspm: true
39 |
40 | - uses: r-lib/actions/setup-r-dependencies@v2
41 | with:
42 | extra-packages: any::rcmdcheck, any::knitr, any::rmarkdown, any::prettydoc
43 | needs: check
44 | dependencies: '"hard"'
45 |
46 | - uses: r-lib/actions/check-r-package@v2
47 | with:
48 | upload-snapshots: true
49 | build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
50 |
--------------------------------------------------------------------------------
/.github/workflows/pkgdown.yaml:
--------------------------------------------------------------------------------
1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3 | on:
4 | push:
5 | branches: [main, master]
6 | pull_request:
7 | branches: [main, master]
8 | release:
9 | types: [published]
10 | workflow_dispatch:
11 |
12 | name: pkgdown
13 |
14 | jobs:
15 | pkgdown:
16 | runs-on: ubuntu-latest
17 | # Only restrict concurrency for non-PR jobs
18 | concurrency:
19 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
20 | env:
21 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
22 | permissions:
23 | contents: write
24 | steps:
25 | - uses: actions/checkout@v4
26 |
27 | - uses: r-lib/actions/setup-pandoc@v2
28 |
29 | - uses: r-lib/actions/setup-r@v2
30 | with:
31 | use-public-rspm: true
32 |
33 | - uses: r-lib/actions/setup-r-dependencies@v2
34 | with:
35 | extra-packages: any::pkgdown, local::., any::knitr, any::rmarkdown, any::prettydoc
36 | needs: website
37 | dependencies: '"hard"'
38 |
39 | - name: Build site
40 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
41 | shell: Rscript {0}
42 |
43 | - name: Deploy to GitHub pages 🚀
44 | if: github.event_name != 'pull_request'
45 | uses: JamesIves/github-pages-deploy-action@v4.5.0
46 | with:
47 | clean: false
48 | branch: gh-pages
49 | folder: docs
50 |
--------------------------------------------------------------------------------
/man/plot_N_cycle.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/functional.R
3 | \name{plot_N_cycle}
4 | \alias{plot_N_cycle}
5 | \title{Plot the N-cycling pathway and genes}
6 | \usage{
7 | plot_N_cycle(
8 | my_N_genes = NULL,
9 | just_diff = FALSE,
10 | path_col = NULL,
11 | type_col = c(up = "red", down = "blue", none = NA),
12 | fill_alpha = 0.5,
13 | arrow_size = 0.1,
14 | line_width = 1,
15 | title = "Nitrogen cycling",
16 | legend.position = c(0.85, 0.15)
17 | )
18 | }
19 | \arguments{
20 | \item{my_N_genes}{dataframe, "Gene_families","type" should in colnames of my_N_genes}
21 |
22 | \item{just_diff}{logical, just plot the different genes?}
23 |
24 | \item{path_col}{colors of pathways}
25 |
26 | \item{type_col}{colors of types}
27 |
28 | \item{fill_alpha}{alpha, default 0.5}
29 |
30 | \item{arrow_size}{arrow_size, default 0.1}
31 |
32 | \item{line_width}{line_width, default 1}
33 |
34 | \item{title}{title, default "Nitrogen cycling"}
35 |
36 | \item{legend.position}{default c(0.85,0.15)}
37 | }
38 | \value{
39 | ggplot
40 | }
41 | \description{
42 | Plot the N-cycling pathway and genes
43 | }
44 | \examples{
45 | N_data <- load_N_data()
46 | my_N_genes <- data.frame(
47 | `Gene_families` = sample(N_data$N_genes$Gene_families, 10, replace = FALSE),
48 | change = rnorm(10), check.names = FALSE
49 | )
50 | my_N_genes <- dplyr::mutate(my_N_genes,
51 | type = ifelse(change > 0, "up", ifelse(change < 0, "down", "none"))
52 | )
53 | plot_N_cycle(my_N_genes, just_diff = FALSE, fill_alpha = 0.2)
54 | # ggsave(filename = "test.pdf", width = 14, height = 10)
55 | }
56 |
--------------------------------------------------------------------------------
/man/z_diversity.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/a_diversity.R
3 | \name{z_diversity}
4 | \alias{z_diversity}
5 | \alias{plot.zeta_res}
6 | \title{Calculate Zeta Diversity}
7 | \usage{
8 | z_diversity(otutab, group_df = NULL, zetadiv_params = list())
9 |
10 | \method{plot}{zeta_res}(x, lm_model = c("exp", "pl")[1], ribbon = FALSE, text = TRUE, ...)
11 | }
12 | \arguments{
13 | \item{otutab}{A matrix or data frame containing OTU (Operational Taxonomic Unit) counts.}
14 |
15 | \item{group_df}{A data frame containing group information.}
16 |
17 | \item{zetadiv_params}{Additional parameters to be passed to the Zeta.decline.mc function from the zetadiv package.}
18 |
19 | \item{x}{Zeta diversity results obtained from z_diversity function.}
20 |
21 | \item{lm_model}{The linear model to be used for fitting ('exp' or 'pl').}
22 |
23 | \item{ribbon}{Logical, whether to add a ribbon to the plot for standard deviation.}
24 |
25 | \item{text}{Logical, whether to add R-squared and p-value text annotations.}
26 |
27 | \item{...}{Additional arguments to be passed to ggplot2 functions.}
28 | }
29 | \value{
30 | zeta_res
31 |
32 | A ggplot object.
33 | }
34 | \description{
35 | This function calculates Zeta diversity for each group in the provided otutab.
36 |
37 | This function plots the Zeta diversity results obtained from the z_diversity function.
38 | }
39 | \examples{
40 | \donttest{
41 | if (requireNamespace("zetadiv")) {
42 | data(otutab, package = "pcutils")
43 | zeta_result <- z_diversity(otutab, metadata["Group"], zetadiv_params = list(sam = 10))
44 | plot(zeta_result, lm_model = "exp", text = TRUE)
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/man/RDA_plot.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{RDA_plot}
4 | \alias{RDA_plot}
5 | \title{Plot RDA res}
6 | \usage{
7 | RDA_plot(
8 | phy.rda,
9 | Group,
10 | metadata = NULL,
11 | Group2 = NULL,
12 | env_rate = 1,
13 | mode = 1,
14 | tri = FALSE,
15 | Topn = 10,
16 | rate = 1,
17 | margin = FALSE,
18 | box_margin = TRUE,
19 | pal = NULL,
20 | sample_label = TRUE,
21 | stat_ellipse = TRUE,
22 | ellipse_level = 0.95,
23 | coord_fix = FALSE,
24 | bi_text_size = 3,
25 | env_text_param = NULL,
26 | ...
27 | )
28 | }
29 | \arguments{
30 | \item{phy.rda}{rda/cca object}
31 |
32 | \item{Group}{group vector for color}
33 |
34 | \item{metadata}{metadata contain Group}
35 |
36 | \item{Group2}{mapping point shape}
37 |
38 | \item{env_rate}{default 1}
39 |
40 | \item{mode}{plot mode:1~3}
41 |
42 | \item{tri}{plot variables segments?}
43 |
44 | \item{Topn}{how many variables to show?}
45 |
46 | \item{rate}{segments length rate}
47 |
48 | \item{margin}{plot the margin boxplot?}
49 |
50 | \item{box_margin}{margin plot box or density?}
51 |
52 | \item{pal}{colors for group}
53 |
54 | \item{sample_label}{plot the labels of samples?}
55 |
56 | \item{stat_ellipse}{plot the stat_ellipse?}
57 |
58 | \item{ellipse_level}{the level of stat_ellipse, defalut 0.95}
59 |
60 | \item{coord_fix}{fix the coordinates y/x ratio}
61 |
62 | \item{bi_text_size}{biplot text size}
63 |
64 | \item{env_text_param}{parameters pass to \code{\link[ggplot2]{geom_text}}}
65 |
66 | \item{...}{add}
67 | }
68 | \value{
69 | ggplot
70 | }
71 | \description{
72 | Plot RDA res
73 | }
74 | \seealso{
75 | \code{\link{myRDA}}
76 | }
77 |
--------------------------------------------------------------------------------
/man/RCbray1.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eco_micro.R
3 | \name{RCbray1}
4 | \alias{RCbray1}
5 | \title{Calculate RCbray-curtis}
6 | \usage{
7 | RCbray1(
8 | otutab,
9 | reps = 9,
10 | threads = 1,
11 | classic_metric = TRUE,
12 | split_ties = TRUE
13 | )
14 | }
15 | \arguments{
16 | \item{otutab}{otutab}
17 |
18 | \item{reps}{how many simulation performed?}
19 |
20 | \item{threads}{use how many threads to calculate (default:4)}
21 |
22 | \item{classic_metric}{standardizes the metric to range from -1 to 1}
23 |
24 | \item{split_ties}{adds half of the number of null observations that are equal to the observed number of shared species to the calculation- this is highly recommended}
25 | }
26 | \value{
27 | a dist
28 | }
29 | \description{
30 | Calculate RCbray-curtis
31 | }
32 | \details{
33 | Parallelized version of the Raup-Crick algorithm for "abundance" data (Stegen et al. 2013).
34 | }
35 | \examples{
36 | \donttest{
37 | if (requireNamespace("picante")) {
38 | data(otutab, package = "pcutils")
39 | df2tree(taxonomy) -> phylo
40 | b_NTI1(phylo, otutab) -> bnti_res
41 | RCbray1(otutab, reps = 9) -> rc_res
42 |
43 | data.frame(
44 | type = factor(c("Homo_S", "Heter_S", "Homo_D", "D_limit", "Undominated"),
45 | levels = c("Homo_S", "Heter_S", "Homo_D", "D_limit", "Undominated")
46 | ),
47 | number = c(
48 | sum(bnti_res < (-2)), sum(bnti_res > 2),
49 | sum((abs(bnti_res) < 2) & (abs(rc_res) < 0.95)),
50 | sum((abs(bnti_res) < 2) & (rc_res < (-0.95))),
51 | sum((abs(bnti_res) < 2) & (rc_res > 0.95))
52 | )
53 | ) -> com_pro
54 | pcutils::gghuan(com_pro, reorder = FALSE)
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/man/taxonkit_list.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/Rtaxonkit.R
3 | \name{taxonkit_list}
4 | \alias{taxonkit_list}
5 | \title{Taxonkit list}
6 | \usage{
7 | taxonkit_list(
8 | ids,
9 | indent = " ",
10 | json = FALSE,
11 | show_name = FALSE,
12 | show_rank = FALSE,
13 | data_dir = NULL
14 | )
15 | }
16 | \arguments{
17 | \item{ids}{A character vector of TaxIDs to retrieve information for.}
18 |
19 | \item{indent}{The indentation string to use for pretty-printing the output. Default is " ".}
20 |
21 | \item{json}{Logical value indicating whether to output the result in JSON format. Default is FALSE.}
22 |
23 | \item{show_name}{Logical value indicating whether to show the scientific names of taxa. Default is FALSE.}
24 |
25 | \item{show_rank}{Logical value indicating whether to show the ranks of taxa. Default is FALSE.}
26 |
27 | \item{data_dir}{directory containing nodes.dmp and names.dmp (default "/Users/asa/.taxonkit")}
28 | }
29 | \value{
30 | The output of the Taxonkit list operation.
31 | }
32 | \description{
33 | This function uses Taxonkit to perform the "list" operation, which retrieves
34 | information about taxa based on their TaxIDs.
35 | }
36 | \examples{
37 | \dontrun{
38 | taxonkit_list(ids = c(9605), indent = "-", show_name = TRUE, show_rank = TRUE)
39 | }
40 | }
41 | \seealso{
42 | Other Rtaxonkit:
43 | \code{\link{check_taxonkit}()},
44 | \code{\link{download_taxonkit_dataset}()},
45 | \code{\link{install_taxonkit}()},
46 | \code{\link{name_or_id2df}()},
47 | \code{\link{taxonkit_filter}()},
48 | \code{\link{taxonkit_lca}()},
49 | \code{\link{taxonkit_lineage}()},
50 | \code{\link{taxonkit_name2taxid}()},
51 | \code{\link{taxonkit_reformat}()}
52 | }
53 | \concept{Rtaxonkit}
54 |
--------------------------------------------------------------------------------
/man/ann_tree.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{ann_tree}
4 | \alias{ann_tree}
5 | \alias{easy_tree}
6 | \title{Annotate a tree}
7 | \usage{
8 | ann_tree(f_tax, otutab = NULL, level = ncol(f_tax), ignore_pattern = NULL)
9 |
10 | easy_tree(
11 | tree,
12 | highlight = "Phylum",
13 | colorfill = "color",
14 | topN = NULL,
15 | pal = NULL,
16 | name_prefix = FALSE,
17 | basic_params = NULL,
18 | add_abundance = TRUE,
19 | color_name = "abundance",
20 | add_tiplab = TRUE,
21 | fontsize = NULL
22 | )
23 | }
24 | \arguments{
25 | \item{f_tax}{taxonomy dataframe}
26 |
27 | \item{otutab}{otutab, rowname==rowname(taxonomy)}
28 |
29 | \item{level}{1~7}
30 |
31 | \item{ignore_pattern}{An optional regular expression pattern to match tip or node labels for dropping.}
32 |
33 | \item{tree}{result from \code{ann_tree}}
34 |
35 | \item{highlight}{highlight which level, one of \code{tree$level}}
36 |
37 | \item{colorfill}{"color" or "fill"}
38 |
39 | \item{topN}{topN to show}
40 |
41 | \item{pal}{color pal}
42 |
43 | \item{name_prefix}{keep the prefix like "k__" or "p__" in the label? Default: FALSE}
44 |
45 | \item{basic_params}{parameters parse to \code{\link[ggtree]{ggtree}}}
46 |
47 | \item{add_abundance}{logical}
48 |
49 | \item{color_name}{color name}
50 |
51 | \item{add_tiplab}{logical}
52 |
53 | \item{fontsize}{tip label fontsize}
54 | }
55 | \value{
56 | a treedata
57 |
58 | a ggplot
59 | }
60 | \description{
61 | Annotate a tree
62 |
63 | Easy way to plot a phylogenetic tree
64 | }
65 | \examples{
66 | if (interactive()) {
67 | data(otutab, package = "pcutils")
68 | ann_tree(taxonomy, otutab) -> tree
69 | # run yourself
70 | easy_tree(tree, add_abundance = FALSE) -> p
71 | p
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/man/myRDA.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{myRDA}
4 | \alias{myRDA}
5 | \alias{myCCA}
6 | \alias{myCAP}
7 | \alias{mydbRDA}
8 | \title{RDA}
9 | \usage{
10 | myRDA(
11 | otutab,
12 | env,
13 | norm = TRUE,
14 | scale = FALSE,
15 | choose_var = FALSE,
16 | direction = "forward",
17 | nperm = 499,
18 | verbose = TRUE,
19 | method = "rda",
20 | dist = "bray"
21 | )
22 |
23 | myCCA(
24 | otutab,
25 | env,
26 | norm = TRUE,
27 | scale = FALSE,
28 | choose_var = FALSE,
29 | nperm = 499,
30 | verbose = TRUE
31 | )
32 |
33 | myCAP(
34 | otutab,
35 | env,
36 | norm = TRUE,
37 | scale = FALSE,
38 | choose_var = FALSE,
39 | nperm = 499,
40 | verbose = TRUE,
41 | dist = "bray"
42 | )
43 | }
44 | \arguments{
45 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
46 |
47 | \item{env}{environmental factors}
48 |
49 | \item{norm}{should normalize? (default:TRUE)}
50 |
51 | \item{scale}{should scale species? (default:FALSE)}
52 |
53 | \item{choose_var}{should choose variables? use forward step}
54 |
55 | \item{direction}{The direction of the stepwise selection, "both", "forward" or "backward", default is "forward"}
56 |
57 | \item{nperm}{number of permutation}
58 |
59 | \item{verbose}{verbose}
60 |
61 | \item{method}{"rda", "cca", "cap", "dbrda"}
62 |
63 | \item{dist}{The name of the dissimilarity (or distance) index for "cap" or "dbrda", for \code{\link[vegan]{vegdist}}}
64 | }
65 | \value{
66 | rda/cca
67 | }
68 | \description{
69 | RDA
70 | }
71 | \examples{
72 | data(otutab, package = "pcutils")
73 | env <- metadata[, 6:10]
74 | # RDA
75 | myRDA(otutab, env) -> phy.rda
76 | RDA_plot(phy.rda, "Group", metadata)
77 | }
78 | \seealso{
79 | \code{\link[vegan]{vegdist};\link[picante]{unifrac}}
80 | }
81 |
--------------------------------------------------------------------------------
/man/taxonkit_lca.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/Rtaxonkit.R
3 | \name{taxonkit_lca}
4 | \alias{taxonkit_lca}
5 | \title{Compute Lowest Common Ancestor (LCA) of TaxIDs}
6 | \usage{
7 | taxonkit_lca(
8 | file_path,
9 | buffer_size = "1M",
10 | separator = " ",
11 | skip_deleted = FALSE,
12 | skip_unfound = FALSE,
13 | taxids_field = NULL,
14 | text = FALSE,
15 | data_dir = NULL
16 | )
17 | }
18 | \arguments{
19 | \item{file_path}{The path to the input file containing TaxIDs. Or file text (text=TRUE)}
20 |
21 | \item{buffer_size}{The size of the line buffer (supported units: K, M, G).}
22 |
23 | \item{separator}{The separator for TaxIDs.}
24 |
25 | \item{skip_deleted}{Whether to skip deleted TaxIDs and compute with the remaining ones.}
26 |
27 | \item{skip_unfound}{Whether to skip unfound TaxIDs and compute with the remaining ones.}
28 |
29 | \item{taxids_field}{The field index of TaxIDs. Input data should be tab-separated (default 1).}
30 |
31 | \item{text}{logical}
32 |
33 | \item{data_dir}{directory containing nodes.dmp and names.dmp (default "/Users/asa/.taxonkit")}
34 | }
35 | \value{
36 | A character vector containing the computed LCAs.
37 | }
38 | \description{
39 | This function uses the "taxonkit lca" command to compute the Lowest Common Ancestor (LCA) of TaxIDs.
40 | }
41 | \examples{
42 | \dontrun{
43 | taxonkit_lca("239934, 239935, 349741", text = TRUE, separator = ", ")
44 | }
45 | }
46 | \seealso{
47 | Other Rtaxonkit:
48 | \code{\link{check_taxonkit}()},
49 | \code{\link{download_taxonkit_dataset}()},
50 | \code{\link{install_taxonkit}()},
51 | \code{\link{name_or_id2df}()},
52 | \code{\link{taxonkit_filter}()},
53 | \code{\link{taxonkit_lineage}()},
54 | \code{\link{taxonkit_list}()},
55 | \code{\link{taxonkit_name2taxid}()},
56 | \code{\link{taxonkit_reformat}()}
57 | }
58 | \concept{Rtaxonkit}
59 |
--------------------------------------------------------------------------------
/man/taxonkit_name2taxid.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/Rtaxonkit.R
3 | \name{taxonkit_name2taxid}
4 | \alias{taxonkit_name2taxid}
5 | \title{Convert Taxonomic Names to TaxIDs}
6 | \usage{
7 | taxonkit_name2taxid(
8 | file_path,
9 | name_field = NULL,
10 | sci_name = FALSE,
11 | show_rank = FALSE,
12 | text = FALSE,
13 | data_dir = NULL
14 | )
15 | }
16 | \arguments{
17 | \item{file_path}{The path to the input file containing taxonomic names. Or file text (text=TRUE)}
18 |
19 | \item{name_field}{The field index of the taxonomic name in the input file (default is 1).}
20 |
21 | \item{sci_name}{Logical value indicating whether to search only for scientific names (default is FALSE).}
22 |
23 | \item{show_rank}{Logical value indicating whether to show the taxonomic rank in the output (default is FALSE).}
24 |
25 | \item{text}{Logical}
26 |
27 | \item{data_dir}{directory containing nodes.dmp and names.dmp (default "/Users/asa/.taxonkit")}
28 | }
29 | \value{
30 | A character vector containing the output of the "taxonkit_name2taxid" command.
31 | }
32 | \description{
33 | This function uses the "taxonkit taxonkit_name2taxid" command to convert taxonomic names to corresponding taxonomic IDs (TaxIDs).
34 | }
35 | \examples{
36 | \dontrun{
37 | names <- system.file("extdata/name.txt", package = "pctax")
38 | taxonkit_name2taxid(names, name_field = 1, sci_name = FALSE, show_rank = FALSE)
39 | "Homo sapiens" \%>\% taxonkit_name2taxid(text = TRUE)
40 | }
41 | }
42 | \seealso{
43 | Other Rtaxonkit:
44 | \code{\link{check_taxonkit}()},
45 | \code{\link{download_taxonkit_dataset}()},
46 | \code{\link{install_taxonkit}()},
47 | \code{\link{name_or_id2df}()},
48 | \code{\link{taxonkit_filter}()},
49 | \code{\link{taxonkit_lca}()},
50 | \code{\link{taxonkit_lineage}()},
51 | \code{\link{taxonkit_list}()},
52 | \code{\link{taxonkit_reformat}()}
53 | }
54 | \concept{Rtaxonkit}
55 |
--------------------------------------------------------------------------------
/man/plot.b_res.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{plot.b_res}
4 | \alias{plot.b_res}
5 | \title{Plot a b_res}
6 | \usage{
7 | \method{plot}{b_res}(
8 | x,
9 | Group,
10 | metadata = NULL,
11 | Group2 = NULL,
12 | mode = 1,
13 | bi = FALSE,
14 | Topn = 10,
15 | rate = 1,
16 | margin = FALSE,
17 | margin_label = TRUE,
18 | permanova_res = NULL,
19 | text_param = list(),
20 | box_margin = TRUE,
21 | box_param = list(),
22 | pal = NULL,
23 | sample_label = TRUE,
24 | stat_ellipse = TRUE,
25 | ellipse_level = 0.95,
26 | add_centroid_label = TRUE,
27 | coord_fix = FALSE,
28 | bi_text_size = 3,
29 | ...
30 | )
31 | }
32 | \arguments{
33 | \item{x}{a b_res object}
34 |
35 | \item{Group}{group vector for color}
36 |
37 | \item{metadata}{metadata contain Group}
38 |
39 | \item{Group2}{mapping point shape}
40 |
41 | \item{mode}{plot mode:1~3}
42 |
43 | \item{bi}{plot variables segments?}
44 |
45 | \item{Topn}{how many variables to show?}
46 |
47 | \item{rate}{segments length rate}
48 |
49 | \item{margin}{plot the margin boxplot?}
50 |
51 | \item{margin_label}{margin_label, TRUE}
52 |
53 | \item{permanova_res}{permanova result}
54 |
55 | \item{text_param}{text_param for \code{\link[ggplot2]{annotate}}}
56 |
57 | \item{box_margin}{margin plot box or density?}
58 |
59 | \item{box_param}{box_param for \code{\link[pcutils]{group_box}}}
60 |
61 | \item{pal}{colors for group}
62 |
63 | \item{sample_label}{plot the labels of samples?}
64 |
65 | \item{stat_ellipse}{plot the stat_ellipse?}
66 |
67 | \item{ellipse_level}{the level of stat_ellipse, defalut 0.95}
68 |
69 | \item{add_centroid_label}{add the centroid label in mode 3?}
70 |
71 | \item{coord_fix}{fix the coordinates y/x ratio}
72 |
73 | \item{bi_text_size}{biplot text size}
74 |
75 | \item{...}{add}
76 | }
77 | \value{
78 | a ggplot
79 | }
80 | \description{
81 | Plot a b_res
82 | }
83 | \seealso{
84 | \code{\link{b_analyse}}
85 | }
86 |
--------------------------------------------------------------------------------
/man/b_analyse.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/b_analyse.R
3 | \name{b_analyse}
4 | \alias{b_analyse}
5 | \alias{b_analyse.data.frame}
6 | \title{Beta_diversity Ordination: dimensionality reduction}
7 | \usage{
8 | b_analyse(otutab, ...)
9 |
10 | \method{b_analyse}{data.frame}(
11 | otutab,
12 | norm = TRUE,
13 | method = c("pca"),
14 | group = NULL,
15 | dist = "bray",
16 | ndim = 2,
17 | scale = FALSE,
18 | ...
19 | )
20 | }
21 | \arguments{
22 | \item{otutab}{an otutab data.frame, samples are columns, taxs are rows.}
23 |
24 | \item{...}{add}
25 |
26 | \item{norm}{should normalized or not? (hellinger)}
27 |
28 | \item{method}{one of "pca","pcoa","ca","dca","nmds","plsda","tsne","umap","lda","all"}
29 |
30 | \item{group}{if needed, give a group vector}
31 |
32 | \item{dist}{if use pcoa or nmds, your can choose a dist method (default: bray) or input a distance matrix.}
33 |
34 | \item{ndim}{how many dimension be kept? (default:2). 3 for b_res_3d()}
35 |
36 | \item{scale}{scale, default: FALSE}
37 | }
38 | \value{
39 | b_res object
40 | }
41 | \description{
42 | Species abundance data can be preprocessed with Hellinger transformation or chord transformation data before PCA analysis. Because the Hellinger distance or chord distance with-without data is equal to \eqn{\sqrt2\sqrt{1-Ochiai\ similarity}}, therefore, the sorting diagram (type 1 scale) of PCA analysis after Hellinger transformation or chord transformation with-without data is internal sample The distance between the squares is the Ochiai distance. \eqn{\sqrt2\sqrt{1-Ochiai\ similarity}} is a distance measure, which is also suitable for the analysis of species data. The processed data is then used for pca without norm.
43 | }
44 | \examples{
45 | data(otutab, package = "pcutils")
46 | b_analyse(otutab, method = "pca") -> b_res
47 | plot(b_res, "Group", metadata)
48 | }
49 | \references{
50 | \url{https://www.jianshu.com/p/9694c0b6302d}
51 | \url{https://zhuanlan.zhihu.com/p/25501130}
52 | }
53 |
--------------------------------------------------------------------------------
/man/plot_element_cycle.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/functional.R
3 | \name{plot_element_cycle}
4 | \alias{plot_element_cycle}
5 | \title{Plot element cycle}
6 | \usage{
7 | plot_element_cycle(
8 | cycle = "Nitrogen cycle",
9 | anno_df = NULL,
10 | only_anno = FALSE,
11 | cell_fill = NA,
12 | cell_color = "orange",
13 | use_chinese = FALSE,
14 | chemical_size = 7,
15 | chemical_bold = TRUE,
16 | chemical_color = "black",
17 | chemical_label = TRUE,
18 | reaction_width = 1,
19 | reaction_arrow_size = 4,
20 | reaction_arrow_closed = TRUE,
21 | gene_or_ko = "gene",
22 | gene_size = 3,
23 | gene_x_offset = 0.3,
24 | gene_y_offset = 0.15,
25 | gene_label = TRUE,
26 | gene_color = NULL,
27 | gene_bold = TRUE,
28 | gene_italic = TRUE,
29 | gene_label_fill = "white"
30 | )
31 | }
32 | \arguments{
33 | \item{cycle}{one of c("Carbon cycle","Nitrogen cycle","Phosphorus cycle","Sulfur cycle","Iron cycle")}
34 |
35 | \item{anno_df}{anno_df, columns should contains Gene or KO and Group}
36 |
37 | \item{only_anno}{only show genes in anno_df?}
38 |
39 | \item{cell_fill}{cell fill color}
40 |
41 | \item{cell_color}{cell border color}
42 |
43 | \item{use_chinese}{use chinese label?}
44 |
45 | \item{chemical_size}{chemical text size}
46 |
47 | \item{chemical_bold}{chemical text bold}
48 |
49 | \item{chemical_color}{chemical text color}
50 |
51 | \item{chemical_label}{chemical text in geom_label or geom_text?}
52 |
53 | \item{reaction_width}{reaction line width}
54 |
55 | \item{reaction_arrow_size}{reaction arrow size}
56 |
57 | \item{reaction_arrow_closed}{reaction arrow closed?}
58 |
59 | \item{gene_or_ko}{"gene" or "ko"}
60 |
61 | \item{gene_size}{gene text size}
62 |
63 | \item{gene_x_offset}{gene_x_offset}
64 |
65 | \item{gene_y_offset}{gene_y_offset}
66 |
67 | \item{gene_label}{gene text in geom_label or geom_text?}
68 |
69 | \item{gene_color}{gene text color}
70 |
71 | \item{gene_bold}{gene text blod?}
72 |
73 | \item{gene_italic}{gene text italic?}
74 |
75 | \item{gene_label_fill}{gene label fill color}
76 | }
77 | \value{
78 | ggplot
79 | }
80 | \description{
81 | Plot element cycle
82 | }
83 | \examples{
84 | if (requireNamespace("ggforce")) plot_element_cycle()
85 | }
86 |
--------------------------------------------------------------------------------
/man/taxonkit_lineage.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/Rtaxonkit.R
3 | \name{taxonkit_lineage}
4 | \alias{taxonkit_lineage}
5 | \title{Retrieve Taxonomic Lineage using taxonkit}
6 | \usage{
7 | taxonkit_lineage(
8 | file_path,
9 | delimiter = ";",
10 | no_lineage = FALSE,
11 | show_lineage_ranks = FALSE,
12 | show_lineage_taxids = FALSE,
13 | show_name = FALSE,
14 | show_rank = FALSE,
15 | show_status_code = FALSE,
16 | taxid_field = 1,
17 | text = FALSE,
18 | data_dir = NULL
19 | )
20 | }
21 | \arguments{
22 | \item{file_path}{The path to the input file with taxonomic IDs. Or file text (text=TRUE)}
23 |
24 | \item{delimiter}{The field delimiter in the lineage (default ";").}
25 |
26 | \item{no_lineage}{Logical, indicating whether to exclude lineage information (default: FALSE).}
27 |
28 | \item{show_lineage_ranks}{Logical, indicating whether to append ranks of all levels in the lineage (default: FALSE).}
29 |
30 | \item{show_lineage_taxids}{Logical, indicating whether to append lineage consisting of taxids (default: FALSE).}
31 |
32 | \item{show_name}{Logical, indicating whether to append scientific name (default: FALSE).}
33 |
34 | \item{show_rank}{Logical, indicating whether to append rank of taxids (default: FALSE).}
35 |
36 | \item{show_status_code}{Logical, indicating whether to show status code before lineage (default: FALSE).}
37 |
38 | \item{taxid_field}{The field index of taxid. Input data should be tab-separated (default: 1).}
39 |
40 | \item{text}{logical,}
41 |
42 | \item{data_dir}{directory containing nodes.dmp and names.dmp (default "/Users/asa/.taxonkit")}
43 | }
44 | \value{
45 | A character vector containing the taxonomic lineage information.
46 | }
47 | \description{
48 | Retrieve Taxonomic Lineage using taxonkit
49 | }
50 | \examples{
51 | \dontrun{
52 | taxonkit_lineage("9606\n63221", show_name = TRUE, show_rank = TRUE, text = TRUE)
53 | }
54 | }
55 | \seealso{
56 | Other Rtaxonkit:
57 | \code{\link{check_taxonkit}()},
58 | \code{\link{download_taxonkit_dataset}()},
59 | \code{\link{install_taxonkit}()},
60 | \code{\link{name_or_id2df}()},
61 | \code{\link{taxonkit_filter}()},
62 | \code{\link{taxonkit_lca}()},
63 | \code{\link{taxonkit_list}()},
64 | \code{\link{taxonkit_name2taxid}()},
65 | \code{\link{taxonkit_reformat}()}
66 | }
67 | \concept{Rtaxonkit}
68 |
--------------------------------------------------------------------------------
/man/plot_two_tree.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/phylogenetic.R
3 | \name{plot_two_tree}
4 | \alias{plot_two_tree}
5 | \title{Plot two trees in one plot}
6 | \usage{
7 | plot_two_tree(
8 | tree1,
9 | tree2,
10 | edge_df = NULL,
11 | tree2_x = 10,
12 | filter_link = FALSE,
13 | tree1_param = list(),
14 | tree2_param = list(),
15 | line_param = list(),
16 | tree1_tip = FALSE,
17 | tip1_param = list(),
18 | tree2_tip = FALSE,
19 | tip2_param = list(),
20 | tree1_highlight = NULL,
21 | highlight1_param = list(),
22 | highlight1_scale = NULL,
23 | tree2_highlight = NULL,
24 | highlight2_param = list(),
25 | highlight2_scale = ggplot2::scale_fill_hue(na.value = NA)
26 | )
27 | }
28 | \arguments{
29 | \item{tree1}{phylo object}
30 |
31 | \item{tree2}{phylo object}
32 |
33 | \item{edge_df}{dataframe with edge information, containing "from" and "to" columns}
34 |
35 | \item{tree2_x}{x position of tree2}
36 |
37 | \item{filter_link}{filter the link between tree1 and tree2}
38 |
39 | \item{tree1_param}{parameters for \code{\link[ggtree]{geom_tree}}}
40 |
41 | \item{tree2_param}{parameters for \code{\link[ggtree]{geom_tree}}}
42 |
43 | \item{line_param}{parameters for \code{\link[ggplot2]{geom_line}}}
44 |
45 | \item{tree1_tip}{tree tip label}
46 |
47 | \item{tip1_param}{parameters for \code{\link[ggtree]{geom_tiplab}}}
48 |
49 | \item{tree2_tip}{tree tip label}
50 |
51 | \item{tip2_param}{parameters for \code{\link[ggtree]{geom_tiplab}}}
52 |
53 | \item{tree1_highlight}{tree1 highlight data.frame}
54 |
55 | \item{highlight1_param}{parameters for \code{\link[ggtree]{geom_hilight}}}
56 |
57 | \item{highlight1_scale}{scale_fill_ for highlight1}
58 |
59 | \item{tree2_highlight}{tree2 highlight data.frame}
60 |
61 | \item{highlight2_param}{parameters for \code{\link[ggtree]{geom_hilight}}}
62 |
63 | \item{highlight2_scale}{scale_fill_ for highlight2}
64 | }
65 | \value{
66 | ggplot object
67 | }
68 | \description{
69 | Plot two trees in one plot
70 | }
71 | \examples{
72 | if (requireNamespace("ggtree")) {
73 | data(otutab, package = "pcutils")
74 | df2tree(taxonomy[1:50, ]) -> tax_tree
75 | df2tree(taxonomy[51:100, ]) -> tax_tree2
76 | link <- data.frame(from = sample(tax_tree$tip.label, 20), to = sample(tax_tree2$tip.label, 20))
77 | plot_two_tree(tax_tree, tax_tree2, link)
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: pctax
2 | Type: Package
3 | Title: Professional Comprehensive Omics Data Analysis
4 | Version: 0.1.6
5 | Authors@R:
6 | person("Chen", "Peng", email ="pengchen2001@zju.edu.cn", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9449-7606"))
7 | Description:
8 | Provides a comprehensive suite of tools for analyzing omics data.
9 | It includes functionalities for alpha diversity analysis, beta diversity analysis, differential abundance analysis, community assembly analysis, visualization of phylogenetic tree, and functional enrichment analysis.
10 | With a progressive approach, the package offers a range of analysis methods to explore and understand the complex communities.
11 | It is designed to support researchers and practitioners in conducting in-depth and professional omics data analysis.
12 | License: GPL-3
13 | Encoding: UTF-8
14 | Roxygen: list(markdown = TRUE)
15 | RoxygenNote: 7.3.2
16 | Depends:
17 | R (>= 4.2.0)
18 | LazyData: true
19 | Imports:
20 | pcutils (>= 0.2.5),
21 | dplyr,
22 | ggplot2 (>= 3.2.0),
23 | vegan,
24 | magrittr,
25 | grDevices,
26 | RColorBrewer,
27 | ggrepel,
28 | reshape2,
29 | stats,
30 | tibble,
31 | utils,
32 | ggpubr,
33 | patchwork,
34 | ggnewscale,
35 | ade4,
36 | scales
37 | Suggests:
38 | picante,
39 | httr,
40 | NST,
41 | permute,
42 | aplot,
43 | ggfun,
44 | pheatmap,
45 | MASS,
46 | Rtsne,
47 | mixOmics,
48 | geosphere,
49 | phyloseq,
50 | phyloseqGraphTest,
51 | plotly,
52 | umap,
53 | Hmisc,
54 | minpack.lm,
55 | bbmle,
56 | snow,
57 | foreach,
58 | doSNOW,
59 | tidytree,
60 | ggtree,
61 | ggtreeExtra,
62 | vctrs,
63 | zoo,
64 | ape,
65 | DESeq2,
66 | limma,
67 | ALDEx2,
68 | Mfuzz,
69 | edgeR,
70 | methods,
71 | randomForest,
72 | knitr,
73 | rmarkdown,
74 | MetaNet,
75 | showtext,
76 | jsonlite,
77 | prettydoc,
78 | readxl,
79 | clipr,
80 | zetadiv,
81 | ggforce,
82 | AnnotationDbi,
83 | org.Hs.eg.db,
84 | linkET,
85 | mediation,
86 | pairwiseAdonis,
87 | sankeyD3,
88 | Biobase,
89 | GEOquery
90 | VignetteBuilder: knitr
91 | BugReports: https://github.com/Asa12138/pctax/issues
92 | URL: https://github.com/Asa12138/pctax
93 | ByteCompile: true
94 | biocViews: Microbiome, Software, Visualization
95 |
--------------------------------------------------------------------------------
/man/taxonkit_filter.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/Rtaxonkit.R
3 | \name{taxonkit_filter}
4 | \alias{taxonkit_filter}
5 | \title{Filter TaxIDs based on Taxonomic Ranks}
6 | \usage{
7 | taxonkit_filter(
8 | file_path,
9 | black_list = NULL,
10 | discard_noranks = FALSE,
11 | discard_root = FALSE,
12 | equal_to = NULL,
13 | higher_than = NULL,
14 | lower_than = NULL,
15 | rank_file = NULL,
16 | root_taxid = NULL,
17 | save_predictable_norank = FALSE,
18 | taxid_field = NULL,
19 | text = FALSE,
20 | data_dir = NULL
21 | )
22 | }
23 | \arguments{
24 | \item{file_path}{The path to the input file containing TaxIDs. Or file text (text=TRUE)}
25 |
26 | \item{black_list}{A character vector specifying the ranks to discard.}
27 |
28 | \item{discard_noranks}{Logical value indicating whether to discard all ranks without order (default is FALSE).}
29 |
30 | \item{discard_root}{Logical value indicating whether to discard the root taxid (default is FALSE).}
31 |
32 | \item{equal_to}{A character vector specifying the ranks for which TaxIDs should be equal to.}
33 |
34 | \item{higher_than}{The rank above which the TaxIDs should be (exclusive).}
35 |
36 | \item{lower_than}{The rank below which the TaxIDs should be (exclusive).}
37 |
38 | \item{rank_file}{The path to a user-defined ordered taxonomic ranks file.}
39 |
40 | \item{root_taxid}{The root taxid (default is 1).}
41 |
42 | \item{save_predictable_norank}{Logical value indicating whether to save some special ranks without order when using lower_than (default is FALSE).}
43 |
44 | \item{taxid_field}{The field index of the taxid in the input file (default is 1).}
45 |
46 | \item{text}{logical}
47 |
48 | \item{data_dir}{directory containing nodes.dmp and names.dmp (default "/Users/asa/.taxonkit")}
49 | }
50 | \value{
51 | A character vector containing the output of the "taxonkit filter" command.
52 | }
53 | \description{
54 | This function uses the "taxonkit filter" command to filter TaxIDs based on taxonomic ranks.
55 | }
56 | \examples{
57 | \dontrun{
58 | taxids2 <- system.file("extdata/taxids2.txt", package = "pctax")
59 | taxonkit_filter(taxids2, lower_than = "genus")
60 | }
61 | }
62 | \seealso{
63 | Other Rtaxonkit:
64 | \code{\link{check_taxonkit}()},
65 | \code{\link{download_taxonkit_dataset}()},
66 | \code{\link{install_taxonkit}()},
67 | \code{\link{name_or_id2df}()},
68 | \code{\link{taxonkit_lca}()},
69 | \code{\link{taxonkit_lineage}()},
70 | \code{\link{taxonkit_list}()},
71 | \code{\link{taxonkit_name2taxid}()},
72 | \code{\link{taxonkit_reformat}()}
73 | }
74 | \concept{Rtaxonkit}
75 |
--------------------------------------------------------------------------------
/R/stats.R:
--------------------------------------------------------------------------------
1 | #' Batch mediate
2 | #'
3 | #' @param data data.frame with two columns: X (independent variable) and Y (dependent variable).
4 | #' @param mediator_df data.frame with mediators, each column representing a different mediator variable.
5 | #' @param nsims Number of bootstrap simulations for estimating confidence intervals (default is 500).
6 | #' @param conf.level Confidence level for the confidence intervals (default is 0.95).
7 | #'
8 | #' @return data.frame
9 | #'
10 | #' @examples
11 | #' set.seed(123)
12 | #' n <- 200
13 | #' X <- rnorm(n)
14 | #' M1 <- 0.5 * X + rnorm(n)
15 | #' M2 <- 0.3 * X + rnorm(n)
16 | #' M3 <- 0.1 * X + rnorm(n)
17 | #' Y <- 0.3 * X + 0.4 * M1 + 0.2 * M2 + rnorm(n)
18 | #' data <- data.frame(X, Y)
19 | #' mediators <- data.frame(M1, M2, M3)
20 | #' if (requireNamespace("mediation")) {
21 | #' results <- batch_mediate(data, mediators)
22 | #' print(results)
23 | #' }
24 | #' @export
25 | batch_mediate <- function(data, mediator_df, nsims = 500, conf.level = 0.95) {
26 | # 检查必要的包是否已安装
27 | lib_ps("mediation", library = FALSE)
28 |
29 | message("Use the first two columns of data as X and Y")
30 | colnames(data) <- c("X", "Y")
31 |
32 | # 初始化结果数据框
33 | results <- data.frame(
34 | Mediator = character(),
35 | ACME = numeric(), # 平均因果中介效应
36 | ADE = numeric(), # 平均直接效应
37 | Total_Effect = numeric(), # 总效应
38 | Prop_Mediated = numeric(), # 中介比例
39 | ACME_p = numeric(), # ACME的p值
40 | ADE_p = numeric(), # ADE的p值
41 | Total_p = numeric(), # 总效应的p值
42 | stringsAsFactors = FALSE
43 | )
44 |
45 | # 循环处理每个中介变量
46 | for (mediator_name in colnames(mediator_df)) {
47 | # 合并数据
48 | full_data <- cbind(data, mediator_df[mediator_name])
49 | colnames(full_data)[ncol(full_data)] <- "M_temp"
50 |
51 | # 拟合模型
52 | model.m <- lm(M_temp ~ X, data = full_data[, c("X", "M_temp"), drop = FALSE])
53 | model.y <- lm(Y ~ ., data = full_data[, c("Y", "X", "M_temp")])
54 |
55 | # 进行中介分析
56 | med <- mediation::mediate(
57 | model.m,
58 | model.y,
59 | treat = "X",
60 | mediator = "M_temp",
61 | boot = TRUE,
62 | sims = nsims,
63 | conf.level = conf.level
64 | )
65 |
66 | # 提取结果
67 | res_row <- data.frame(
68 | Mediator = mediator_name,
69 | ACME = med$d0,
70 | ADE = med$z0,
71 | Total_Effect = med$tau.coef,
72 | Prop_Mediated = med$n0,
73 | ACME_p = med$d0.p,
74 | ADE_p = med$z0.p,
75 | Total_p = med$tau.p,
76 | stringsAsFactors = FALSE
77 | )
78 |
79 | # 添加到结果数据框
80 | results <- rbind(results, res_row)
81 | }
82 |
83 | # 计算置信区间
84 | ci_lower <- (1 - conf.level) / 2
85 | ci_upper <- conf.level + ci_lower
86 |
87 | return(results)
88 | }
89 |
--------------------------------------------------------------------------------
/.github/workflows/pr-commands.yaml:
--------------------------------------------------------------------------------
1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3 | on:
4 | issue_comment:
5 | types: [created]
6 |
7 | name: Commands
8 |
9 | jobs:
10 | document:
11 | if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
12 | name: document
13 | runs-on: ubuntu-latest
14 | env:
15 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16 | steps:
17 | - uses: actions/checkout@v4
18 |
19 | - uses: r-lib/actions/pr-fetch@v2
20 | with:
21 | repo-token: ${{ secrets.GITHUB_TOKEN }}
22 |
23 | - uses: r-lib/actions/setup-r@v2
24 | with:
25 | use-public-rspm: true
26 |
27 | - uses: r-lib/actions/setup-r-dependencies@v2
28 | with:
29 | extra-packages: any::roxygen2
30 | needs: pr-document
31 | dependencies: '"hard"'
32 |
33 | - name: Document
34 | run: roxygen2::roxygenise()
35 | shell: Rscript {0}
36 |
37 | - name: commit
38 | run: |
39 | git config --local user.name "$GITHUB_ACTOR"
40 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
41 | git add man/\* NAMESPACE
42 | git commit -m 'Document'
43 |
44 | - uses: r-lib/actions/pr-push@v2
45 | with:
46 | repo-token: ${{ secrets.GITHUB_TOKEN }}
47 |
48 | style:
49 | if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
50 | name: style
51 | runs-on: ubuntu-latest
52 | env:
53 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
54 | steps:
55 | - uses: actions/checkout@v4
56 |
57 | - uses: r-lib/actions/pr-fetch@v2
58 | with:
59 | repo-token: ${{ secrets.GITHUB_TOKEN }}
60 |
61 | - uses: r-lib/actions/setup-r@v2
62 |
63 | - name: Install dependencies
64 | run: install.packages("styler")
65 | shell: Rscript {0}
66 |
67 | - name: Style
68 | run: styler::style_pkg()
69 | shell: Rscript {0}
70 |
71 | - name: commit
72 | run: |
73 | git config --local user.name "$GITHUB_ACTOR"
74 | git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
75 | git add \*.R
76 | git commit -m 'Style'
77 |
78 | - uses: r-lib/actions/pr-push@v2
79 | with:
80 | repo-token: ${{ secrets.GITHUB_TOKEN }}
81 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # pctax
5 |
6 |
7 |
8 | [](https://github.com/Asa12138/pctax/actions/workflows/R-CMD-check.yaml)
9 | [](https://asa-blog.netlify.app/)
10 | [](https://cran.r-project.org/package=pctax)
11 | [](https://cran.r-project.org/package=pctax)
12 | [](https://cran.r-project.org/package=pctax)
13 | [](https://github.com/Asa12138/pctax)
14 |
15 |
16 | `pctax` provides a comprehensive suite of tools for analyzing omics
17 | data.
18 |
19 | The HTML documentation of the latest version is available at [Github
20 | page](https://asa12138.github.io/pctax/).
21 |
22 | Please go to for the full
23 | vignette.
24 |
25 | ## Installation
26 |
27 | The stable version is available on CRAN:
28 |
29 | install.packages("pctax")
30 |
31 | Or you can install the development version of pctax from
32 | [GitHub](https://github.com/) with:
33 |
34 | ``` r
35 | # install.packages("devtools")
36 | devtools::install_github("Asa12138/pctax")
37 | ```
38 |
39 | ## 🚀 NEWS 🚀
40 |
41 | Recently, I added a function to draw two trees and their relationships:
42 |
43 | ``` r
44 | data(otutab, package = "pcutils")
45 | df2tree(taxonomy[1:50, ]) -> tax_tree
46 | df2tree(taxonomy[51:100, ]) -> tax_tree2
47 | link <- data.frame(from = sample(tax_tree$tip.label, 20), to = sample(tax_tree2$tip.label, 20))
48 | plot_two_tree(tax_tree, tax_tree2, link,
49 | tree1_tip = T, tree2_tip = T,
50 | tip1_param = list(size = 2), tip2_param = list(size = 2)
51 | )
52 | ```
53 |
54 |
55 |
56 |
57 |
58 | Two trees and their relationships
59 |
60 |
61 |
62 |
63 | Recently I added a function to plot element cycling because element
64 | cycling genes are important in the microbiome (especially the
65 | environmental microbiome). Supports simple cycle diagram drawing of C,
66 | N, P, S, Fe (manual arrangement, there must be some missing parts, will
67 | be continuously added in the future):
68 |
69 | ``` r
70 | plot_element_cycle(cycle = "Nitrogen cycle")
71 | #> recommend ggsave(width = 12,height = 10)
72 | ```
73 |
74 |