Skip to content

Commit

Permalink
Added documentation for the showFunctions
Browse files Browse the repository at this point in the history
  • Loading branch information
spriyansh committed Dec 27, 2023
1 parent 91a78ce commit f02323b
Show file tree
Hide file tree
Showing 16 changed files with 183 additions and 135 deletions.
1 change: 1 addition & 0 deletions R/align_pseudotime.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#' @importFrom scales rescale
#' @importFrom S4Vectors DataFrame
#'
#' @param scmpObj description
#' @param ptime_col A character string representing the column name
#' for inferred Pseudotime values in 'Sparse' data. See `colData` from the
#' \pkg{SingleCellExperiment} package. (Default is "Pseudotime")
Expand Down
158 changes: 90 additions & 68 deletions R/show_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@
# 10. showGroupCoeff():

###############################################################################

#' Show or Return the Coefficent matrix
#' @title Show or Return the Coefficent matrix
#'
#' This function is used to view or return the coeffients of the provided scMaSigPro object.
#' @description
#' This function is used to view or return the coefficents from the provided
#' scMaSigPro object.
#'
#' @param scmpObj an object of class 'ScMaSigPro'. This object should contain the computed solution.
#' @param view logical, whether to view the solution. If TRUE (default), the solution is displayed.
#' @param includeInflu description
#' @param return logical, whether to return the solution. If FALSE (default), the solution is not returned.
#' @param scmpObj An object of class \code{\link{ScMaSigPro}}.
#' @param view Whether to view the data in the explorer. (Default: FALSE)
#' @param includeInflu Whether to include genes with inluential observations.
#' @param return Whether to return the data. (Default: TRUE)
#'
#' @return The computed solution as a data.frame if return is set to TRUE.
#' If return is FALSE, the function does not return anything.
#' @return The computed Coefficent matrix as a dataframe.
#'
#' @author Priyansh Srivastava \email{spriyansh29@@gmail.com}
#'
#' @export
showCoeff <- function(scmpObj, view = FALSE, return = TRUE, includeInflu = TRUE) {
Expand Down Expand Up @@ -58,17 +60,19 @@ showCoeff <- function(scmpObj, view = FALSE, return = TRUE, includeInflu = TRUE)
}

###############################################################################

#' Show or Return the matrix of influential genes
#' @title Return the matrix of genes with influential observation
#'
#' This function is used to view or return the solution of the provided scMaSigPro object.
#' @description
#' This function is used to view or return the matrix of genes with influential
#' observation from the provided scMaSigPro object.
#'
#' @param scmpObj an object of class 'ScMaSigPro'. This object should contain the computed solution.
#' @param view logical, whether to view the solution. If TRUE (default), the solution is displayed.
#' @param return logical, whether to return the solution. If FALSE (default), the solution is not returned.
#' @param scmpObj An object of class \code{\link{ScMaSigPro}}.
#' @param view Whether to view the data in the explorer. (Default: FALSE)
#' @param return Whether to return the data. (Default: TRUE)
#'
#' @return The computed solution as a data.frame if return is set to TRUE.
#' If return is FALSE, the function does not return anything.
#' @return Matrix of genes with influential observation.
#'
#' @author Priyansh Srivastava \email{spriyansh29@@gmail.com}
#'
#' @export
showInflu <- function(scmpObj, view = FALSE, return = TRUE) {
Expand Down Expand Up @@ -97,18 +101,20 @@ showInflu <- function(scmpObj, view = FALSE, return = TRUE) {
}

###############################################################################

#' Show or Return the t scores
#' @title Show or Return the t-score matrix
#'
#' This function is used to view or return the solution of the provided scMaSigPro object.
#' @description
#' This function is used to view or return the t-scores from the provided
#' scMaSigPro object.
#'
#' @param scmpObj an object of class 'ScMaSigPro'. This object should contain the computed solution.
#' @param view logical, whether to view the solution. If TRUE (default), the solution is displayed.
#' @param includeInflu logical, whether to add gene with influential data in the solution.
#' @param return logical, whether to return the solution. If FALSE (default), the solution is not returned.
#' @param scmpObj An object of class \code{\link{ScMaSigPro}}.
#' @param view Whether to view the data in the explorer. (Default: FALSE)
#' @param includeInflu Whether to include genes with inluential observations.
#' @param return Whether to return the data. (Default: TRUE)
#'
#' @return The computed solution as a data.frame if return is set to TRUE.
#' If return is FALSE, the function does not return anything.
#' @return The computed t-score matrix as a dataframe.
#'
#' @author Priyansh Srivastava \email{spriyansh29@@gmail.com}
#'
#' @export
showTS <- function(scmpObj, view = FALSE, return = TRUE, includeInflu = TRUE) {
Expand Down Expand Up @@ -142,18 +148,20 @@ showTS <- function(scmpObj, view = FALSE, return = TRUE, includeInflu = TRUE) {
}

###############################################################################

#' Show or Return the Solution
#' @title Show or Return the P-values after model fitting.
#'
#' This function is used to view or return the solution of the provided scMaSigPro object.
#' @description
#' This function is used to view or return the matrix of p-values for each term
#' and the full model from the provided scMaSigPro object.
#'
#' @param scmpObj an object of class 'ScMaSigPro'. This object should contain the computed solution.
#' @param view logical, whether to view the solution. If TRUE (default), the solution is displayed.
#' @param includeInflu logical, whether to add gene with influential data in the solution.
#' @param return logical, whether to return the solution. If TRUE (default), returned.
#' @param scmpObj An object of class \code{\link{ScMaSigPro}}.
#' @param view Whether to view the data in the explorer. (Default: FALSE)
#' @param includeInflu Whether to include genes with inluential observations.
#' @param return Whether to return the data. (Default: TRUE)
#'
#' @return The computed solution as a data.frame if return is set to TRUE.
#' If return is FALSE, the function does not return anything.
#' @return The computed p-values for each term and full model as a dataframe.
#'
#' @author Priyansh Srivastava \email{spriyansh29@@gmail.com}
#'
#' @export
showSol <- function(scmpObj, view = FALSE, return = TRUE, includeInflu = TRUE) {
Expand Down Expand Up @@ -187,18 +195,23 @@ showSol <- function(scmpObj, view = FALSE, return = TRUE, includeInflu = TRUE) {
}

###############################################################################
#' Show or Return the Solution
#' @title Show or Return the counts for non-flat profile.
#'
#' This function is used to view or return the solution of the provided scMaSigPro object.
#' @description
#' This function is used to view or return the pseudo-bulk counts of the genes
#' with non-flat profiles. from the provided scMaSigPro object.
#'
#' @param scmpObj an object of class 'ScMaSigPro'. This object should contain the computed solution.
#' @param view logical, whether to view the solution. If TRUE (default), the solution is displayed.
#' @param includeInflu logical, whether to add gene with influential data in the solution.
#' @param return logical, whether to return the solution. If FALSE (default), the solution is not returned.
#'
#' @return The computed solution as a data.frame if return is set to TRUE.
#' If return is FALSE, the function does not return anything.
#' @importFrom utils View
#'
#' @param scmpObj An object of class \code{\link{ScMaSigPro}}.
#' @param view Whether to view the data in the explorer. (Default: FALSE)
#' @param includeInflu Whether to include genes with inluential observations.
#' @param return Whether to return the data. (Default: TRUE)
#'
#' @return Pseudo-bulk counts as matrix for genes with non-flat profiles.
#'
#' @author Priyansh Srivastava \email{spriyansh29@@gmail.com}
#'
#' @export
showSigProf <- function(scmpObj, view = FALSE, return = TRUE, includeInflu = FALSE) {
# Check Object Validity
Expand Down Expand Up @@ -234,13 +247,16 @@ showSigProf <- function(scmpObj, view = FALSE, return = TRUE, includeInflu = FAL
}

###############################################################################
#' Show the terms of the polynomial term
#' @title Print the full model formula.
#'
#' @description
#' Print the full model formula in console as a string.
#'
#' This function is used to view or return the solution of the provided scMaSigPro object.
#' @param scmpObj An object of class \code{\link{ScMaSigPro}}.
#'
#' @param scmpObj an object of class 'ScMaSigPro'. This object should contain the computed solution.
#' @return Character string of the formula for the full model.
#'
#' @return Return the terms of the polynomial model.
#' @author Priyansh Srivastava \email{spriyansh29@@gmail.com}
#'
#' @export
showPoly <- function(scmpObj) {
Expand Down Expand Up @@ -273,17 +289,23 @@ showPoly <- function(scmpObj) {
}

###############################################################################
#' Show or Return the parameters used during the analysis
#' @title Show the parameters used during the workflow.
#'
#' This function is used to view or return the solution of the provided scMaSigPro object.
#' @description
#' Get or View all the parameters used during the workflow.
#'
#' @param scmpObj an object of class 'ScMaSigPro'. This object should contain the computed solution.
#' @param view logical, whether to view the solution. If TRUE (default), the solution is displayed.
#' @param return logical, whether to return the solution. If FALSE (default), the solution is not returned.
#' @importFrom methods slot slotNames
#' @param scmpObj An object of class \code{\link{ScMaSigPro}}.
#' @param view Whether to view the data in the explorer. (Default: FALSE)
#' @param return Whether to return the data. (Default: TRUE)
#'
#' @return The computed solution as a data.frame if return is set to TRUE.
#' If return is FALSE, the function does not return anything.
#' @importFrom methods slot slotNames
#'
#' @return Dataframe of the parameters used in the analysis.
#'
#' @author Priyansh Srivastava \email{spriyansh29@@gmail.com}
#'
#' @export
showParams <- function(scmpObj, view = FALSE, return = TRUE) {
# Check Object Validity
Expand Down Expand Up @@ -336,17 +358,18 @@ showParams <- function(scmpObj, view = FALSE, return = TRUE) {
}

###############################################################################
#' Show or Return the Group wise coefficents
#' @title Show or Return the Branching Path Coefficent matrix
#'
#' This function is used to view or return the group of the provided scMaSigPro object.
#' @description
#' This function is used to view or return the branching paths coefficents from
#' the provided scMaSigPro object.
#'
#' @param scmpObj an object of class 'ScMaSigPro'. This object should contain the computed solution.
#' @param view logical, whether to view the solution. If TRUE (default), the solution is displayed.
#' @param return logical, whether to return the solution. If FALSE (default), the solution is not returned.
#' @param includeInflu description
#' @param scmpObj An object of class \code{\link{ScMaSigPro}}.
#' @param view Whether to view the data in the explorer. (Default: FALSE)
#' @param return Whether to return the data. (Default: TRUE)
#' @param includeInflu Whether to include genes with inluential observations.
#'
#' @return The computed solution as a data.frame if return is set to TRUE.
#' If return is FALSE, the function does not return anything.
#' @return The computed branching path coefficent matrix as a dataframe.
#'
#' @export
showGroupCoeff <- function(scmpObj, view = FALSE, return = TRUE, includeInflu = TRUE) {
Expand Down Expand Up @@ -380,11 +403,12 @@ showGroupCoeff <- function(scmpObj, view = FALSE, return = TRUE, includeInflu =
}

###############################################################################
#' Show ScMaSigPro Object Information
#' @title Show ScMaSigPro Object Information
#'
#' This method displays basic information about the ScMaSigPro object when the object
#' is printed in the console. The method is automatically called when the user writes
#' the name of the object in the console.
#' @description
#' This method displays basic information about the ScMaSigPro object when the
#' object is printed in the console. The method is automatically called when the
#' user writes the name of the object in the console.
#'
#' @param object An object of class \code{ScMaSigPro}.
#'
Expand Down Expand Up @@ -452,5 +476,3 @@ extract_info <- function(data, return_type = "avg_bin_size", bin_size_col, path_
stop("Invalid return_type. Choose between 'avg_bin_size' and 'num_bins'.")
}
}

#-X-#
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ data("splat.sim", package = "scMaSigPro")

```
# Helper Function to convert annotated SCE object to scmpObject
scmp.ob <- as.scmp(
scmp.ob <- as_scmp(
object = splat.sim, from = "sce",
align_pseudotime = FALSE,
verbose = TRUE,
additional_params = list(
labels_exist = TRUE,
existing_pseudotime_colname = "Step",
existing_path_colname = "Group"
exist_ptime_col = "Step",
exist_path_col = "Group"
)
)
```
Expand Down
2 changes: 2 additions & 0 deletions man/align_pseudotime.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/dot-ScMaSigPro_show.Rd

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

2 changes: 1 addition & 1 deletion man/plotIntersect.Rd

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

2 changes: 1 addition & 1 deletion man/sc.set.poly.Rd

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

8 changes: 4 additions & 4 deletions man/sc.squeeze.Rd

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

17 changes: 10 additions & 7 deletions man/showCoeff.Rd

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

Loading

0 comments on commit f02323b

Please sign in to comment.