### Install decoupleR from GitHub Source: https://github.com/saezlab/decoupler/blob/master/README.md Installs the latest development version of the decoupleR package directly from GitHub using the 'remotes' package. This is useful for accessing the newest features or if Bioconductor installation fails. ```r install.packages('remotes') remotes::install_github('saezlab/decoupleR') ``` -------------------------------- ### Install decoupleR from Bioconductor Source: https://github.com/saezlab/decoupler/blob/master/README.md Installs the decoupleR package using the BiocManager from Bioconductor. This is the recommended method for stable releases. ```r install.packages('BiocManager') BiocManager::install('saezlab/decoupleR') ``` -------------------------------- ### Install decoupleR Package Source: https://context7.com/saezlab/decoupler/llms.txt Installs the decoupleR package from Bioconductor or the development version from GitHub. Requires the 'BiocManager' or 'remotes' package respectively. ```r install.packages("BiocManager") BiocManager::install("decoupleR") install.packages("remotes") remotes::install_github("saezlab/decoupleR") ``` -------------------------------- ### Get OmniPath Kinase-Substrate Network in R Source: https://context7.com/saezlab/decoupler/llms.txt Shows how to retrieve the kinase-substrate network from OmniPath using get_ksn_omnipath. This function returns a tibble detailing kinase-substrate interactions, including the source (kinase), target (phosphosite in 'PROTEIN_RESIDUEposition' format), and mode of regulation. ```r library(decoupleR) # Get kinase-substrate network from OmniPath ksn <- get_ksn_omnipath() # Returns tibble with: source (kinase), target (phosphosite), mor # Target format: "PROTEIN_RESIDUEposition" (e.g., "AKT1_S473") ``` -------------------------------- ### Get CollecTRI Transcription Factor Network in R Source: https://context7.com/saezlab/decoupler/llms.txt Demonstrates how to fetch the CollecTRI transcription factor-target network using get_collectri. This network is an expansion of DoRothEA. Options include specifying the organism, whether to split protein complexes, and whether to load associated metadata. ```r library(decoupleR) # Get CollecTRI TF-target network (expanded DoRothEA) collectri <- get_collectri( organism = "human", split_complexes = FALSE, # Keep complexes as single entities load_meta = FALSE # Don't load metadata ) # With metadata (sources, PMIDs, sign decision) collectri_meta <- get_collectri( organism = "human", load_meta = TRUE ) ``` -------------------------------- ### Get PROGENy Pathway Signatures in R Source: https://context7.com/saezlab/decoupler/llms.txt Explains how to obtain PROGENy pathway-gene weights using the get_progeny function. This function allows specifying the organism and the number of top genes to include for each pathway. The output is a tibble mapping pathways to target genes with associated weights and p-values. ```r library(decoupleR) # Get PROGENy pathway-gene weights progeny <- get_progeny( organism = "human", # Options: "human", "mouse" top = 500 # Top genes per pathway by significance ) # Returns tibble with: source (pathway), target (gene), weight, p_value # Pathways include: Androgen, EGFR, Estrogen, Hypoxia, JAK-STAT, MAPK, NFkB, # PI3K, TGFb, TNFa, Trail, VEGF, WNT, p53 ``` -------------------------------- ### Get DoRothEA Transcription Factor Network in R Source: https://context7.com/saezlab/decoupler/llms.txt Shows how to retrieve the DoRothEA transcription factor-target network using the get_dorothea function. Users can specify the organism and confidence levels to filter the network. The function returns a tibble containing TF-target interactions with confidence scores. ```r library(decoupleR) # Get DoRothEA TF-target network dorothea <- get_dorothea( organism = "human", # Options: "human", "mouse", "rat" levels = c("A", "B", "C") # Confidence levels A (highest) to D ) # Returns tibble with: source (TF), confidence, target (gene), mor (mode of regulation) head(dorothea) ``` -------------------------------- ### Generate Toy Data for DecoupleR in R Source: https://context7.com/saezlab/decoupler/llms.txt Shows how to generate synthetic expression matrix and network data using the get_toy_data function. This is useful for testing and demonstrating decoupleR functions. The generated data includes an expression matrix and a network with TFs and interactions. ```r library(decoupleR) # Create example expression matrix and network data <- get_toy_data(n_samples = 24, seed = 42) mat <- data$mat # 12 genes x 24 samples network <- data$network # 3 TFs with 10 interactions # Matrix has two sample populations with different gene expression patterns ``` -------------------------------- ### Run Univariate and Multivariate Decision Trees in R Source: https://context7.com/saezlab/decoupler/llms.txt Demonstrates how to run univariate (UDT) and multivariate (MDT) decision trees using the run_udt and run_mdt functions. These functions take a gene expression matrix and a network as input, along with parameters for node splitting and random forest generation. The output contains the results of the decision tree analysis. ```r results_udt <- run_udt( mat = mat, network = net, .source = "source", .target = "target", .mor = "mor", min_n = 20, # Minimum samples for node split seed = 42, minsize = 0 ) # Multivariate Decision Tree (Random Forest) results_mdt <- run_mdt( mat = mat, network = net, .source = "source", .target = "target", .mor = "mor", trees = 10, # Number of trees min_n = 20, nproc = 1, seed = 42, minsize = 0 ) ``` -------------------------------- ### Show Available Statistical Methods in R Source: https://context7.com/saezlab/decoupler/llms.txt Provides a way to list all available statistical methods within the decoupleR package using the show_methods function. The function returns a tibble containing the function names and their corresponding descriptive names. ```r library(decoupleR) # List all available statistical methods show_methods() # Returns tibble with Function and Name columns ``` -------------------------------- ### Access Generic OmniPath Resources in R Source: https://context7.com/saezlab/decoupler/llms.txt Demonstrates how to access various OmniPath annotation resources using decoupleR. The show_resources function lists available resources, and get_resource allows fetching a specific resource, such as 'SIGNOR', for a given organism. ```r library(decoupleR) # Show available OmniPath annotation resources show_resources() # Get specific resource signor <- get_resource("SIGNOR", organism = "human") ``` -------------------------------- ### Run Decision Tree Methods (run_udt, run_mdt) in R Source: https://context7.com/saezlab/decoupler/llms.txt Implements tree-based feature importance methods for activity inference, specifically Unsupervised Decision Trees (UDT) and Multivariate Decision Trees (MDT). These methods utilize matrix and network inputs with specified source and target columns. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Example usage for UDT and MDT would follow here, similar to other functions. ``` -------------------------------- ### Run Multivariate Linear Model (run_mlm) and Check Correlation Source: https://context7.com/saezlab/decoupler/llms.txt Implements the Multivariate Linear Model (MLM) for activity inference, considering all regulators as covariates simultaneously. Includes a helper function `check_corr` to assess potential collinearity issues among regulators before running MLM, which is crucial for model stability. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Run MLM - accounts for shared targets between regulators results_mlm <- run_mlm( mat = mat, network = net, .source = "source", .target = "target", .mor = "mor", center = FALSE, minsize = 0 ) # Check for collinearity issues before running MLM corr_check <- check_corr( network = net, .source = "source", .target = "target", .mor = "mor" ) print(corr_check) ``` -------------------------------- ### Run Fast GSEA (run_fgsea) in R Source: https://context7.com/saezlab/decoupler/llms.txt Implements Fast Gene Set Enrichment Analysis (FGSEA) using the 'fgsea' package. It performs preranked analysis and estimates p-values through permutations. Requires a matrix, network, and specifies source, target, and moralization columns. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Run FGSEA results_fgsea <- run_fgsea( mat = mat, network = net, .source = "source", .target = "target", times = 100, # Permutations for p-value estimation nproc = 1, # Number of cores seed = 42, minsize = 0 ) # Returns: fgsea (enrichment score), norm_fgsea (normalized ES) ``` -------------------------------- ### Run WSUM with permutation testing in R Source: https://context7.com/saezlab/decoupler/llms.txt Calculates Weighted Sum (WSUM) scores with permutation testing. It returns raw weighted sum, z-score normalized against a null distribution, and a combined correlation score. Requires a matrix, network, and specifies source, target, and moralization columns. ```r library(decoupleR) results_wsum <- run_wsum( mat = mat, network = net, .source = "source", .target = "target", .mor = "mor", times = 100, # Number of permutations seed = 42, minsize = 0 ) # Returns three statistics: # - wsum: raw weighted sum # - norm_wsum: z-score normalized against null distribution # - corr_wsum: wsum * -log10(p_value) print(results_wsum) ``` -------------------------------- ### Run Z-score Method (run_zscore) in R Source: https://context7.com/saezlab/decoupler/llms.txt Calculates KSEA/RoKAI-style z-scores for kinase activity inference. Users can choose between 'RoKAI' and 'KSEA' flavors. Requires a matrix, network, and column specifications for source, target, and moralization. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Run z-score (RoKAI flavor by default) results_zscore <- run_zscore( mat = mat, network = net, .source = "source", .target = "target", .mor = "mor", flavor = "RoKAI", # Options: "RoKAI", "KSEA" minsize = 0 ) ``` -------------------------------- ### Run VIPER (run_viper) in R Source: https://context7.com/saezlab/decoupler/llms.txt Implements Virtual Inference of Protein Activity by Enriched Regulon (VIPER) analysis. This method corrects for pleiotropic regulation. Note that VIPER has a non-commercial license. Requires matrix, network, and column specifications. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Run VIPER (note: non-commercial license) results_viper <- run_viper( mat = mat, network = net, .source = "source", .target = "target", .mor = "mor", verbose = FALSE, pleiotropy = TRUE, # Correct for pleiotropic regulation eset.filter = FALSE, minsize = 0 ) ``` -------------------------------- ### Run Weighted Mean (run_wmean) in R Source: https://context7.com/saezlab/decoupler/llms.txt Performs Weighted Mean (WMEAN) analysis, normalizing by the number of targets per source. Similar to WSUM, it returns WMEAN, normalized WMEAN, and correlation scores. Requires input matrix, network, and column specifications. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Run WMEAN results_wmean <- run_wmean( mat = mat, network = net, .source = "source", .target = "target", .mor = "mor", times = 100, seed = 42, minsize = 0 ) # Returns: wmean, norm_wmean, corr_wmean statistics ``` -------------------------------- ### Network Preprocessing Functions in R Source: https://context7.com/saezlab/decoupler/llms.txt Details utility functions for network preprocessing: rename_net for standardizing column names, filt_minsize for filtering sources based on the number of targets, and extract_sets for converting a network into a list of gene sets. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Standardize network column names net_renamed <- rename_net( network = net, .source = source, .target = target, .mor = mor ) # Filter sources with minimum number of targets net_filtered <- filt_minsize( mat_f_names = rownames(mat), network = net_renamed, minsize = 4 ) # Extract gene sets from network gene_sets <- extract_sets(net_renamed) # Returns named list: list(source1 = c(target1, target2, ...), ...) ``` -------------------------------- ### Run Core decouple() Function Source: https://context7.com/saezlab/decoupler/llms.txt Executes the main decoupleR function to infer biological activities using default or specified statistical methods. It takes an expression matrix and a network as input, returning a tibble with inferred activity scores. ```r library(decoupleR) data <- get_toy_data() mat <- data$mat # Expression matrix: genes (rows) x samples (cols) network <- data$network # Network: source, target, mor columns # Run default top-performing methods (mlm, ulm, wsum) with consensus results <- decouple( mat = mat, network = network, .source = "source", .target = "target", minsize = 0 ) # Run all available methods results_all <- decouple( mat = mat, network = network, .source = "source", .target = "target", statistics = "all", minsize = 0 ) # Run specific methods with custom arguments results_custom <- decouple( mat = mat, network = network, .source = "source", .target = "target", statistics = c("gsva", "wmean", "wsum", "ulm"), args = list( gsva = list(verbose = FALSE), wmean = list(.mor = "mor"), wsum = list(.mor = "mor"), ulm = list(.mor = "mor") ), consensus_score = TRUE, consensus_stats = c("ulm", "norm_wsum"), minsize = 0 ) ``` -------------------------------- ### Run Gene Set Variation Analysis (run_gsva) in R Source: https://context7.com/saezlab/decoupler/llms.txt A wrapper for Gene Set Variation Analysis (GSVA) methods, supporting 'gsva', 'ssgsea', 'plage', and 'zscore'. It requires a matrix, network, and column specifications. GSVA methods necessitate a minimum gene set size of 1. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Run GSVA (default method) results_gsva <- run_gsva( mat = mat, network = net, .source = "source", .target = "target", verbose = FALSE, method = "gsva", # Options: "gsva", "ssgsea", "plage", "zscore" minsize = 1 # GSVA requires minsize >= 1 ) # Run ssGSEA variant results_ssgsea <- run_gsva( mat = mat, network = net, .source = "source", .target = "target", verbose = FALSE, method = "ssgsea", minsize = 1 ) ``` -------------------------------- ### Transform DecoupleR Results to Wide Matrix in R Source: https://context7.com/saezlab/decoupler/llms.txt Demonstrates how to transform the long-format results from decoupleR into a wide matrix format suitable for visualization. This involves filtering for 'consensus' statistics and using pivot_wider_profile from dplyr. ```r library(decoupleR) library(dplyr) # Generate results data <- get_toy_data() results <- decouple(data$mat, data$network, minsize = 0) # Convert long format to wide matrix for visualization activity_matrix <- results %>% filter(statistic == "consensus") %>% pivot_wider_profile( id_cols = source, names_from = condition, values_from = score, to_matrix = TRUE ) # Visualize with pheatmap # library(pheatmap) # pheatmap(activity_matrix) ``` -------------------------------- ### Compute Consensus Score from Multiple Method Results in R Source: https://context7.com/saezlab/decoupler/llms.txt Illustrates how to compute a consensus activity score from the results of multiple decoupleR methods using the run_consensus function. It involves running decouple with different statistics, then applying run_consensus to aggregate the results. The final output combines individual method results with the consensus score. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Run multiple methods without consensus results <- decouple( mat = mat, network = net, .source = "source", .target = "target", statistics = c("wmean", "ulm"), args = list( wmean = list(.mor = "mor"), ulm = list(.mor = "mor") ), consensus_score = FALSE, minsize = 0 ) # Compute consensus separately consensus <- run_consensus(results) # Combine results library(dplyr) final_results <- bind_rows(results, consensus) ``` -------------------------------- ### Run Weighted Sum (run_wsum) Source: https://context7.com/saezlab/decoupler/llms.txt Calculates enrichment scores using the Weighted Sum (WSUM) method. This approach sums weighted target expression values and provides significance testing based on permutations. Requires an expression matrix and a network. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Run WSUM (example usage would follow, similar to other run_* functions) ``` -------------------------------- ### Run Univariate Linear Model (run_ulm) Source: https://context7.com/saezlab/decoupler/llms.txt Applies the Univariate Linear Model (ULM) method to estimate biological activity. This function fits a linear model for each regulator and sample, using expression data and network weights. It requires an expression matrix and a network, outputting activity scores and p-values. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Run ULM results_ulm <- run_ulm( mat = mat, network = net, .source = "source", .target = "target", .mor = "mor", center = FALSE, minsize = 0 ) # Output: tibble with statistic, source, condition, score, p_value print(results_ulm) ``` -------------------------------- ### Run Over-Representation Analysis (run_ora) in R Source: https://context7.com/saezlab/decoupler/llms.txt Conducts Over-Representation Analysis (ORA) using Fisher's exact test. It identifies enriched features based on differential expression. Parameters include specifying top positive and bottom negative features, and background size. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Run ORA - uses top 5% of features by default results_ora <- run_ora( mat = mat, network = net, .source = "source", .target = "target", n_up = ceiling(0.05 * nrow(mat)), # Top positive features n_bottom = 0, # Bottom negative features n_background = 20000, # Background size minsize = 0 ) # Score is -log10(p_value) from Fisher's exact test ``` -------------------------------- ### Run AUCell (run_aucell) in R Source: https://context7.com/saezlab/decoupler/llms.txt Performs Area Under the Curve (AUC) based enrichment analysis, leveraging methods from the AUCell/SCENIC packages. It calculates enrichment scores based on gene expression ranks. Key parameters include `aucMaxRank` for AUC calculation. ```r library(decoupleR) inputs_dir <- system.file("testdata", "inputs", package = "decoupleR") mat <- readRDS(file.path(inputs_dir, "mat.rds")) net <- readRDS(file.path(inputs_dir, "net.rds")) # Run AUCell results_aucell <- run_aucell( mat = mat, network = net, .source = "source", .target = "target", aucMaxRank = 3, # Use top N features for AUC calculation nproc = 1, seed = 42, minsize = 0 ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.