Skip to content

Commit

Permalink
rcmdcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
noriakis committed Sep 18, 2024
1 parent 3f1ad31 commit 18f67dd
Show file tree
Hide file tree
Showing 16 changed files with 145 additions and 12 deletions.
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
Package: stana
Type: Package
Title: Strain-level metagenomic analysis in R
Title: Metagenotyping analysis in R
Version: 0.99.0
License: GPL-3
Description: Analysis toolkit for intra-species diversity from metagenomics.
Description: The package aims to analyze intra-species diversity from metagenomics. The package supports the loading functions for single nucleotide variants and copy number variant profiles, filtering, and statistical analysis.
Authors@R: person("Noriaki", "Sato", email = "nori@hgc.jp", role = c("cre", "aut"))
Depends: ggplot2, ggstar, ggraph, igraph
Imports: GetoptLong, BiocFileCache, RCurl, vegan, methods, data.table, phangorn, RColorBrewer, ggtree, circlize, ComplexHeatmap, ggkegg, ape, dplyr, exactRankTests, ggblend, ggh4x, scales, tidygraph, ggplotify, ggtreeExtra, ggnewscale, scico, MKmisc, NMF, pillar, BiocStyle, cowplot, patchwork, reshape2, ggrepel, Boruta, tidyr, stringr
Imports: GetoptLong, BiocFileCache, RCurl, vegan, methods, data.table, phangorn, RColorBrewer, ggtree, circlize, ComplexHeatmap, ggkegg, ape, dplyr, exactRankTests, ggblend, ggh4x, scales, tidygraph, ggplotify, ggtreeExtra, ggnewscale, scico, MKmisc, NMF, pillar, cowplot, patchwork, reshape2, Boruta, tidyr, stringr, clusterProfiler, grDevices, stats, utils
Suggests: simplifyEnrichment, knitr, rmarkdown, NNLM, shiny, BiocStyle, matrixStats
RoxygenNote: 7.3.2
biocViews: Microbiome
VignetteBuilder: knitr
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ importFrom(scico,scale_fill_scico_d)
importFrom(stats,as.formula)
importFrom(stats,dist)
importFrom(stats,prcomp)
importFrom(tidygraph,"%E>%")
importFrom(tidygraph,"%N>%")
importFrom(utils,object.size)
importFrom(utils,read.table)
importFrom(vegan,adonis2)
2 changes: 2 additions & 0 deletions R/NMF.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ plotStackedBarPlot <- function(stana, sp, by="NMF") {
#' @param rank if NMF is not performed, this performs the NMF beforehand.
#' rank can be specified here.
#' @export
#' @return vegan::diversity results
alphaDiversityWithinSpecies <- function(stana, species, method="shannon", rank=5) {
if (is.null(stana@NMF[[species]])) {
stana <- NMF(stana, species, rank=rank)
Expand Down Expand Up @@ -261,6 +262,7 @@ alphaDiversityWithinSpecies <- function(stana, species, method="shannon", rank=5
#' @param return_data return only the data, not plot
#' @param by NMF or coef matrix set to `coefMat` slot
#' @export
#' @return ggplot object
plotAbundanceWithinSpecies <- function(stana, species, tss=TRUE, return_data=FALSE, by="NMF") {
if (by=="NMF") {
if (is.null(stana@NMF[[species]])) {
Expand Down
2 changes: 1 addition & 1 deletion R/alleleStat.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ alleleStat_metaSNV <- function(stana, sp, cl, deleteZeroDepth) {
#' @param base "maj","ref", or "majref"
#' @param deleteZeroDepth delete snvs with zero depth
#' @export
#' @return list of statistical values
#'

alleleStat <- function(stana, sp=NULL, cl=NULL, base="maj",
deleteZeroDepth=FALSE) {
if (is.null(sp)) {sp <- stana@ids[1]}
Expand Down
1 change: 1 addition & 0 deletions R/annot.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#' passed to anno_word_cloud
#' @param argList will be passed to anno_word_cloud
#' @export
#' @return the results of anno_word_cloud
anno_PATRIC_keywords <- function(split, genes, fnc="pathway_name",
removeHigh=TRUE, removeAdditional=NULL, argList=list()) {

Expand Down
2 changes: 1 addition & 1 deletion R/doBoruta.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ doBoruta <- function(stana, sp, cl=NULL, doFix=TRUE,
}
cat_subtle("# Feature number: ", dim(filtDf)[1], "\n", sep="")
transDf <- data.frame(t(filtDf),
check.names=F)
check.names=FALSE)
transDf <- transDf[intersect(row.names(transDf), cl |> unlist() |> unique()),]
gr <- NULL
for (cn in rownames(transDf)){
Expand Down
1 change: 1 addition & 0 deletions R/doGSEA.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ doGSEA <- function(stana, candSp=NULL, cl=NULL, eps=1e-2, how=sum,
#' @param return_graph return only the tbl_graph
#' @param layout graph layout in ggraph
#' @export
#' @importFrom tidygraph %N>% %E>%
#' @return ggplot object
plotGSEA <- function(stana, dataset_names=NULL, padjThreshold=0.05,
return_graph=FALSE, layout="kk") {
Expand Down
4 changes: 1 addition & 3 deletions R/plotHeatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#' @param removeHigh remove high frequent words (preset)
#' @param removeAdditional remove additional words specified
#' @param max_words max words to plot
#' @param seed random seed
#' @param filter_zero_frac genes with zero abundance over fraction of samples as this value
#' are removed before sample filtering. As typically gene matrix is large, for further filtering, please use `mat` option
#' @param filter_max_frac remove genes with values below `filter_max_value` in this fraction of sample
Expand All @@ -25,11 +24,10 @@
#' @importFrom ComplexHeatmap Heatmap
#' @export
#'
plotHeatmap <- function(stana, sp, cl=NULL, k=10, mat=NULL, seed=1,
plotHeatmap <- function(stana, sp, cl=NULL, k=10, mat=NULL,
geneID=NULL, variable=0,
fnc="KEGG_Pathway", removeHigh=TRUE, removeAdditional=NULL, max_words=10,
filter_zero_frac=0.8, filter_max_frac=0, filter_max_value=50) {
set.seed(seed)

if (!is.null(mat)) {
df <- mat
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cnDiscretize <- function(stana, species, cutoff=0.35) {
#' @export
#' @return stana
setTree <- function(stana, species, tre) {
if (class(tre)!="phylo") {stop("Please provide phylo object")}
if (!is(tre, "phylo")) {stop("Please provide phylo object")}
stana@treeList[[species]] <- tre
return(stana)
}
Expand Down
3 changes: 3 additions & 0 deletions man/alleleStat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/alphaDiversityWithinSpecies.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/anno_PATRIC_keywords.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

118 changes: 118 additions & 0 deletions man/consensusseq.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/plotAbundanceWithinSpecies.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions man/plotHeatmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vignettes/usage_of_stana.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ knitr::opts_chunk$set(echo = TRUE,
fig.height=5,
warning=FALSE,
message=FALSE)
library(BiocStyle)
```

# stana
Expand Down

0 comments on commit 18f67dd

Please sign in to comment.