Skip to content

Commit

Permalink
remove unnecessary examples + add tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
kollo97 committed Nov 15, 2024
1 parent 653bc7a commit c1e6244
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 226 deletions.
21 changes: 2 additions & 19 deletions R/anglemanise_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ get_dstat <- function(corr_matrix) {
#'
#' @param anglem_object An \code{anglem} object containing the list of FBMs.
#' @return A new \code{\link[bigstatsr]{FBM}} object containing the mean values.
#' @examples
#' combined_matrix <- big_mat_list_mean(anglem_object)
#' @importFrom bigstatsr FBM
big_mat_list_mean <- function(anglem_object) {
if (!inherits(anglem_object, "anglem")) {
Expand Down Expand Up @@ -185,8 +183,6 @@ big_mat_list_mean <- function(anglem_object) {
#' \code{sds_zscore}, and \code{sn_zscore}.
#' @importFrom bigstatsr FBM big_apply
#' @seealso \code{\link[bigstatsr]{big_apply}}, \code{\link[bigstatsr]{FBM}}
#' @examples
#' stats_results <- get_list_stats(anglem_object)
#' @export
get_list_stats <- function(anglem_object) {
if (!inherits(anglem_object, "anglem")) {
Expand Down Expand Up @@ -280,8 +276,8 @@ get_list_stats <- function(anglem_object) {
#' @examples
#' \dontrun{
#' gene_pairs <- data.frame(
#' geneA = c("Gene1", "Gene2"),
#' geneB = c("Gene3", "Gene4")
#' geneA = c("Gene1", "Gene2", "Gene3", "Gene4"),
#' geneB = c("Gene3", "Gene4", "Gene5", "Gene6")
#' )
#' unique_genes <- extract_rows_for_unique_genes(
#' gene_pairs,
Expand Down Expand Up @@ -337,19 +333,6 @@ extract_rows_for_unique_genes <- function(dt, max_n_genes) {
#' \item Updates the \code{integration_genes} slot of the \code{anglem_object}
#' with the selected genes and their statistics.
#' }
#' @examples
#' \dontrun{
#' # Assume anglem_object is already created and contains necessary statistical
#' # matrices
#' anglem_object <- select_genes(
#' anglem_object,
#' zscore_mean_threshold = 2,
#' zscore_sn_threshold = 2,
#' max_n_genes = 2000
#' )
#' # Inspect the selected genes and their statistics
#' head(anglem_object@integration_genes$info)
#' }
#' @seealso \code{\link{extract_rows_for_unique_genes}},
#' \code{\link{intersect_genes}}, \code{\link{list_stats}}
#' @export
Expand Down
8 changes: 5 additions & 3 deletions R/big_anglemanise.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,19 @@
#'
#' @examples
#' \dontrun{
#'
#' # Assuming you have an anglem_object already created
#' anglem_object <- big_anglemanise(
#' anglem_object,
#'
#' angl <- big_anglemanise(
#' angl,
#' method = "pearson",
#' zscore_mean_threshold = 2,
#' zscore_sn_threshold = 2,
#' max_n_genes = 2000
#' )
#'
#' # Access the selected genes
#' selected_genes <- anglem_object@integration_genes$genes
#' selected_genes <- extract_integration_genes(angl)
#' }
#'
#' @export
Expand Down
26 changes: 0 additions & 26 deletions R/big_extract_corr.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,6 @@
#' \code{\link[bigstatsr]{FBM}},
#' \code{\link{big_factorise}}
#'
#' @examples
#' \dontrun{
#' # Load necessary library
#' library(bigstatsr)
#'
#' # Create a random gene expression FBM for demonstration
#' n_genes <- 1000
#' n_samples <- 500
#' set.seed(123)
#' x_mat <- FBM(
#' n_genes,
#' n_samples,
#' init = rpois(n_genes * n_samples, lambda = 5)
#' )
#'
#' # Compute the gene-gene correlation matrix using Pearson correlation
#' corr_matrix <- big_extract_corr(x_mat, method = "pearson")
#'
#' # Compute the gene-gene correlation matrix using Spearman correlation
#' corr_matrix_spearman <- big_extract_corr(x_mat, method = "spearman")
#'
#' # Access a subset of the correlation matrix
#' corr_subset <- corr_matrix[1:5, 1:5]
#' print(corr_subset)
#' }
#'
#' @export
big_extract_corr <- function(
x_mat,
Expand Down
27 changes: 0 additions & 27 deletions R/big_factorise.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,6 @@
#' \code{\link[bigstatsr]{big_apply}},
#' \code{\link[bigstatsr]{FBM}}
#'
#' @examples
#' \dontrun{
#' # Load necessary packages
#' library(bigstatsr)
#'
#' # Assume x_mat is a normalized and scaled FBM gene expression matrix
#' # For example, create a random FBM for demonstration
#' set.seed(123)
#' n_genes <- 1000
#' n_samples <- 500
#' x_mat <- FBM(
#' n_genes,
#' n_samples,
#' init = rnorm(n_genes * n_samples)
#' )
#'
#' # Run big_factorise
#' zscore_matrix <- big_factorise(
#' x_mat = x_mat,
#' method = "pearson",
#' seed = 123
#' )
#'
#' # View a portion of the z-score matrix
#' zscore_submatrix <- zscore_matrix[1:5, 1:5]
#' print(zscore_submatrix)
#' }
#' @export
big_factorise <- function(
x_mat,
Expand Down
48 changes: 0 additions & 48 deletions R/integrate_by_features.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,6 @@
#' \code{\link[Seurat]{IntegrateData}},
#' \code{\link[Seurat]{FindIntegrationAnchors}}
#'
#' @examples
#' \dontrun{
#' # Load required libraries
#' library(Seurat)
#' library(pbapply)
#'
#' # Assume seurat_object is a Seurat object containing all samples/batches
#' # and anglem_object is an anglem object with integration genes identified
#'
#' # Integrate the Seurat object using the anglem object
#' integrated_seurat <- integrate_by_features(
#' seurat_object = seurat_object,
#' anglem_object = anglem_object,
#' process = TRUE,
#' verbose = TRUE
#' )
#'
#' # Access the integrated assay
#' DefaultAssay(integrated_seurat) # Should be "integrated"
#'
#' # Visualize UMAP embedding
#' DimPlot(integrated_seurat, reduction = "umap", group.by = "batch")
#' }
#'
#' @export
integrate_by_features <- function(
seurat_object,
Expand Down Expand Up @@ -185,30 +161,6 @@ integrate_by_features <- function(
#' \code{\link[Seurat]{RunPCA}},
#' \code{\link[Seurat]{RunUMAP}}
#'
#' @examples
#' \dontrun{
#' # Load required libraries
#' library(Seurat)
#' library(pbapply)
#'
#' # Assume seurat_list is a list of Seurat objects representing different
#' # samples and features is a vector of gene names used for integration
#'
#' # Integrate the Seurat list
#' integrated_seurat <- integrate_seurat_list(
#' seurat_list = seurat_list,
#' features = features,
#' process = TRUE,
#' verbose = TRUE
#' )
#'
#' # Access the integrated assay
#' DefaultAssay(integrated_seurat) # Should be "integrated"
#'
#' # Visualize UMAP embedding
#' DimPlot(integrated_seurat, reduction = "umap", group.by = "batch")
#' }
#'
#' @export
integrate_seurat_list <- function(
seurat_list,
Expand Down
Loading

0 comments on commit c1e6244

Please sign in to comment.