Skip to content

Commit

Permalink
Use 4 spaces as indents, replace accessors @ with functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gene233 committed Mar 26, 2024
1 parent 3002a02 commit 470b22f
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 37 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Collate:
'gs_score-methods.R'
'plot.R'
'scale_mgm.R'
'smartid-package.R'
'score-methods.R'
'select_markers.R'
'smartid-package.R'
'top_markers.R'
'top_markers-methods.R'
Depends:
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ import(stats)
importClassesFrom(Matrix,dgCMatrix)
importFrom(SummarizedExperiment,SummarizedExperiment)
importFrom(SummarizedExperiment,assay)
importFrom(SummarizedExperiment,colData)
importFrom(SummarizedExperiment,metadata)
importFrom(utils,globalVariables)
importFrom(utils,stack)
10 changes: 5 additions & 5 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#' @inheritParams cal_score_init
#' @param data an expression object, can be matrix or SummarizedExperiment
#' @param slot a character, specify which slot to use when data is se object,
#' optional, default 'counts'
#' optional, default 'counts'
#' @param new.slot a character, specify the name of slot to save score in se object,
#' optional, default 'score'
#' optional, default 'score'
#'
#' @return A list of matrices or se object containing combined score
#'
Expand Down Expand Up @@ -57,7 +57,7 @@ setGeneric(
#' @inheritParams top_markers_init
#' @param data an expression object, can be matrix or SummarizedExperiment
#' @param slot a character, specify which slot to use when data is se object,
#' optional, default 'score'
#' optional, default 'score'
#'
#' @return A tibble with top n feature names, group labels and ordered scores
#'
Expand Down Expand Up @@ -93,9 +93,9 @@ setGeneric(
#' @param data an expression object, can be matrix or SummarizedExperiment
#' @param features vector or named list, feature names to compute score
#' @param slot a character, specify which slot to use when data is se object,
#' optional, default 'score'
#' optional, default 'score'
#' @param suffix a character, specify the name suffix to save score when
#' features is a named list
#' features is a named list
#'
#' @return A vector of overall score for each sample
#'
Expand Down
2 changes: 1 addition & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ plot_mm_clust <- function(score, clust) {
#' @param ref.group character, reference group name
#' @param label vector, group labels
#' @param method character, statistical test to use,
#' details in [ggpubr::stat_compare_means()]
#' details in [ggpubr::stat_compare_means()]
#'
#' @return faceted ggplot object
#' @export
Expand Down
12 changes: 6 additions & 6 deletions R/score-methods.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @include score.R
#' @include score.R smartid-package.R
NULL

#' @rdname cal_score
Expand Down Expand Up @@ -42,10 +42,10 @@ setMethod(
expr <- SummarizedExperiment::assay(data, i = slot)
## get label
if (!is.null(par.idf) & !is.null(par.idf$label)) {
par.idf$label <- data@colData[[par.idf$label]]
par.idf$label <- colData(data)[[par.idf$label]]
}
if (!is.null(par.iae) & !is.null(par.iae$label)) {
par.iae$label <- data@colData[[par.iae$label]]
par.iae$label <- colData(data)[[par.iae$label]]
}

res <- cal_score(
Expand All @@ -58,9 +58,9 @@ setMethod(
)

SummarizedExperiment::assay(data, i = new.slot) <- res$score
data@metadata$tf <- res$tf
data@metadata$idf <- res$idf
data@metadata$iae <- res$iae
metadata(data)$tf <- res$tf
metadata(data)$idf <- res$idf
metadata(data)$iae <- res$iae

return(data)
}
Expand Down
4 changes: 2 additions & 2 deletions R/score.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ idf_iae_methods <- function() {
#' @param expr a count matrix, features in row and cells in column
#' @param tf a character, specify the TF method to use, can be "tf" or "logtf"
#' @param idf a character, specify the IDF method to use. Available methods can
#' be accessed using [idf_iae_methods()]
#' be accessed using [idf_iae_methods()]
#' @param iae a character, specify the IAE method to use. Available methods can
#' be accessed using [idf_iae_methods()]
#' be accessed using [idf_iae_methods()]
#' @param par.idf other parameters for specified IDF methods
#' @param par.iae other parameters for specified IAE methods
#'
Expand Down
10 changes: 5 additions & 5 deletions R/select_markers.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ NULL
#' @param prob numeric, probability cutoff for 1st component classification
#' @param k integer, number of components of mixtures
#' @param ratio numeric, ratio cutoff of 1st component mu to 2nd component mu,
#' only when ratio > cutoff will return markers for the group
#' only when ratio > cutoff will return markers for the group
#' @param dist can be one of "norm" and "gamma", specify if to use
#' [mixtools::normalmixEM()] or [mixtools::gammamixEM()]
#' [mixtools::normalmixEM()] or [mixtools::gammamixEM()]
#' @param maxit integer, maximum number of iterations for EM
#' @param plot logical, if to plot mixture density and hist
#' @param ... other params for [mixtools::normalmixEM()] or [mixtools::gammamixEM()]
Expand Down Expand Up @@ -76,9 +76,9 @@ markers_mixmdl <- function(top_markers, column = ".dot",
#'
#' @inheritParams markers_mixmdl
#' @param s_thres NULL or numeric, only features with score > threshold will be
#' returned, if NULL will use 2 * average probability as threshold
#' @param method can be "max.one" or "remove.min", if to only keep features in 1st
#' component or return features not in the last component
#' returned, if NULL will use 2 * average probability as threshold
#' @param method can be "max.one" or "remove.min", if to only keep features in
#' 1st component or return features not in the last component
#' @param ... other params for [mclust::densityMclust()]
#'
#' @return a list of markers for each group
Expand Down
10 changes: 5 additions & 5 deletions R/smartid-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
#' @import methods
#' @import stats
#' @import graphics
#' @importFrom SummarizedExperiment SummarizedExperiment assay
#' @importFrom SummarizedExperiment SummarizedExperiment assay colData metadata
#' @importFrom utils globalVariables stack
#' @importClassesFrom Matrix dgCMatrix
NULL

#' Scoring and Marker Selection method based on modified TF-IDF
#'
#' `smartid` This package enables automated selection of group specific signature,
#' especially for rare population. The package is developed for generating
#' specific lists of signature genes based on TF-IDF modified methods. It can
#' also be used as a new gene-set scoring method or data transformation method.
#' Multiple visualization functions are implemented in this package.
#' especially for rare population. The package is developed for generating
#' specific lists of signature genes based on TF-IDF modified methods. It
#' can also be used as a new gene-set scoring method or data transformation
#' method. Multiple visualization functions are implemented in this package.
#'
#' @author Jinjin Chen \email{chen.j@@wehi.edu.au}
#' @name smartid_Package
Expand Down
4 changes: 2 additions & 2 deletions R/tf_idf_iae_wrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ idf_sd <- function(expr, features = NULL, thres = 0) {
#'
#' @inheritParams idf_rf
#' @param minPts integer, minimum size of clusters, default 2.
#' Details in [dbscan::hdbscan()].
#' Details in [dbscan::hdbscan()].
#' @param ... parameters for [dbscan::hdbscan()]
#'
#' @return a matrix of inverse cell frequency score
Expand Down Expand Up @@ -414,7 +414,7 @@ iae_sd <- function(expr, features = NULL, thres = 0) {
#'
#' @inheritParams idf_rf
#' @param minPts integer, minimum size of clusters, default 2.
#' Details in [dbscan::hdbscan()].
#' Details in [dbscan::hdbscan()].
#' @param ... parameters for [dbscan::hdbscan()]
#'
#' @return a matrix of inverse average expression score
Expand Down
2 changes: 1 addition & 1 deletion R/top_markers-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ setMethod(
## get expr
expr <- SummarizedExperiment::assay(data, i = slot)
## get label
label <- data@colData[[label]]
label <- colData(data)[[label]]

top_m <- top_markers(
data = expr,
Expand Down
4 changes: 2 additions & 2 deletions R/top_markers.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @inheritParams top_markers_abs
#' @inheritParams top_markers_glm
#' @param use.glm logical, if to use [stats::glm()] to compute group mean score,
#' if TRUE, also compute mean score difference as output
#' if TRUE, also compute mean score difference as output
#' @param ... params for [top_markers_abs()] or [top_markers_glm()]
#'
#' @return a tibble with feature names, group labels and ordered processed scores
Expand Down Expand Up @@ -49,7 +49,7 @@ top_markers_init <- function(data, label, n = 10,
#' @param label vector, group labels
#' @param n integer, number of returned top genes for each group
#' @param method character, specify metric to compute, can be one of "median",
#' "mad", "mean"
#' "mad", "mean"
#' @param scale logical, if to scale data by row
#' @param use.mgm logical, if to scale data using [scale_mgm()]
#' @param softmax logical, if to apply softmax transformation on output
Expand Down
4 changes: 2 additions & 2 deletions man/markers_hdbscan.Rd

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

4 changes: 2 additions & 2 deletions man/markers_mclust.Rd

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

6 changes: 3 additions & 3 deletions man/smartid_Package.Rd

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

0 comments on commit 470b22f

Please sign in to comment.