### Get Bibliography for tidybulk Methods Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Retrieves the bibliography for all methods used within the tidybulk workflow. This function helps in citing the underlying tools and packages correctly. ```r tidybulk::bibliography() ``` -------------------------------- ### Get tidybulk Bibliography - R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md This R code snippet retrieves the bibliography of methods used within the tidybulk package. It takes an input object (e.g., 'airway') and applies the 'get_bibliography()' function to generate a list of cited works. No specific external packages are required beyond tidybulk itself. ```r library(tidybulk) # Assuming 'airway' is a pre-existing object # For example purposes, let's create a dummy object if it doesn't exist if (!exists("airway")) { # This is a placeholder. Replace with actual data loading if needed. airway <- list(counts = matrix(rpois(100, lambda=10), ncol=10), samples = data.frame(condition=rep(c("A","B"), each=5))) } bibliography <- airway |> get_bibliography() print(bibliography) ``` -------------------------------- ### Running Tidybulk Tests (R) Source: https://github.com/stemangiola/tidybulk/blob/master/tests/testthat/README.md This R code snippet demonstrates how to run all unit tests for the tidybulk package using the testthat library. It loads the necessary libraries and then executes tests from a specified directory. Alternatively, specific test files can be run. ```r library(testthat) library(tidybulk) test_dir('tests/testthat/', reporter = 'summary') ``` ```r test_file('tests/testthat/test-data-transformation.R') ``` ```r test_file('tests/testthat/test-abundance-normalization.R') ``` -------------------------------- ### Utility Functions in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md This snippet includes various utility functions from the tidybulk R package, such as describing transcript characteristics, retrieving bibliography information, and resolving confounders. ```R describe_transcript() get_bibliography() resolve_complete_confounders_of_non_interest() ``` -------------------------------- ### Load airway dataset in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Loads the airway dataset, which is a SummarizedExperiment object containing RNA-seq data. This dataset is required for downstream analysis and is available in the 'airway' R package. ```r library(airway) data(airway) ``` -------------------------------- ### Clustering Functions in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md This snippet details R functions for clustering elements using various methods such as K-means, SNN, hierarchical, and DBSCAN. These are provided by the tidybulk package for grouping similar transcripts or samples. ```R cluster_elements() kmeans clustering SNN clustering hierarchical clustering DBSCAN clustering ``` -------------------------------- ### Plot Log-Fold Change vs. Mean with DESeq2 Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Creates a log-fold change vs. mean plot (MA plot) for DESeq2 results, highlighting significant genes. Requires the DESeq2 library. ```r library(DESeq2) metadata(airway)$tidybulk$DESeq2_object |> plotMA() ``` -------------------------------- ### Plot Log-Fold Change vs. Mean with edgeR Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Generates a log-fold change vs. mean plot for edgeR analysis. This visualization aids in identifying differentially expressed genes. Requires the edgeR library. ```r library(edgeR) metadata(airway)$tidybulk$edgeR_quasi_likelihood_fit |> plotMD() ``` -------------------------------- ### Abundance Normalization Functions in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md This snippet covers R functions for scaling, quantile normalizing, adjusting for unwanted variation, and handling missing values in abundance data. It is part of the tidybulk R package and operates on transcriptomic abundance data. ```R scale_abundance() quantile_normalise_abundance() adjust_abundance() fill_missing_abundance() impute_missing_abundance() ``` -------------------------------- ### Differential Expression Analysis with Multiple Methods in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Performs differential expression analysis on the airway dataset using multiple methods provided by tidybulk. Methods include edgeR quasi-likelihood, robust likelihood ratio, DESeq2, and limma-voom with and without sample weights. Each method is applied with a specified prefix for easy identification of results. ```r airway = airway |> # Use QL method test_differential_expression(~ dex, method = "edgeR_quasi_likelihood", prefix = "ql__") |> # Use edger_robust_likelihood_ratio test_differential_expression(~ dex, method = "edger_robust_likelihood_ratio", prefix = "lr_robust__") |> # Use DESeq2 method test_differential_expression(~ dex, method = "DESeq2", prefix = "deseq2__") |> # Use limma_voom test_differential_expression(~ dex, method = "limma_voom", prefix = "voom__") |> # Use limma_voom_sample_weights test_differential_expression(~ dex, method = "limma_voom_sample_weights", prefix = "voom_weights__") ``` -------------------------------- ### Validation and Utility Functions in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md This snippet lists R functions from tidybulk for data validation, including checking for NA counts, duplicated genes, and input errors. It also includes data transformation functions like log10 reverse and logit transformations. ```R check_if_counts_is_na() check_if_duplicated_genes() check_if_wrong_input() log10_reverse_trans() logit_trans() ``` -------------------------------- ### Filtering and Selection Functions in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md This snippet includes R functions from the tidybulk package for identifying, keeping, or filtering transcripts based on abundance and variability. These functions help in selecting relevant features for downstream analysis. ```R identify_abundant() keep_abundant() keep_variable() filterByExpr() ``` -------------------------------- ### Plot Mean-Variance Trend with DESeq2 Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Visualizes the mean-variance trend for DESeq2 analysis. This plot is useful for assessing dispersion estimation. Requires the DESeq2 library. ```r library(DESeq2) metadata(airway)$tidybulk$DESeq2_object |> plotDispEsts() ``` -------------------------------- ### Visualize P-value Distributions Across Methods in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Generates histograms of p-values obtained from different differential expression methods. This helps in visually comparing the distribution of significance across methods and identifying potential signals or biases. Requires the 'ggplot2' package for plotting. ```r airway |> pivot_transcript() |> select( ql__PValue, lr_robust__PValue, voom__P.Value, voom_weights__P.Value, deseq2__pvalue ) |> pivot_longer(everything(), names_to = "method", values_to = "pvalue") |> ggplot(aes(x = pvalue, fill = method)) + geom_histogram(binwidth = 0.01) + facet_wrap(~method) + my_theme + labs(title = "Histogram of p-values across methods") ``` -------------------------------- ### Pairwise P-value Comparison Plot in R (GGpairs) Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Creates a pairwise comparison plot of p-values across different differential expression methods using the 'GGally' package. This visualization helps to identify concordance or discordance in statistical significance between methods. Custom logarithmic scales are applied for better visualization of p-values near zero. ```r library(GGally) airway |> pivot_transcript() |> select(ql__PValue, lr_robust__PValue, voom__P.Value, voom_weights__P.Value, deseq2__pvalue) |> ggpairs(columns = 1:5) + scale_x_continuous(trans = tidybulk::log10_reverse_trans()) + scale_y_continuous(trans = tidybulk::log10_reverse_trans()) + my_theme + labs(title = "Pairplot of p-values across methods") ``` -------------------------------- ### Generate Volcano Plots for Differential Expression Methods Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Generates volcano plots to visualize the significance and effect size of differential expression results across multiple methods (edgeR, DESeq2, limma-voom). It processes the data into a tidy format, harmonizes column names, and uses ggplot2 for plotting. Requires libraries like dplyr, tidyr, and ggplot2. ```r # Create volcano plots airway |> # Select the columns we want to plot pivot_transcript() |> select( .feature, ql__logFC, ql__PValue, lr_robust__logFC, lr_robust__PValue, voom__logFC, voom__P.Value, voom_weights__logFC, voom_weights__P.Value, deseq2__log2FoldChange, deseq2__pvalue ) |> # Pivot longer to get a tidy data frame pivot_longer( - .feature, names_to = c("method", "stat"), values_to = "value", names_sep = "__" ) |> # Harmonize column names mutate(stat = case_when( stat %in% c("logFC", "log2FoldChange") ~ "logFC", stat %in% c("PValue", "pvalue", "P.Value", "p.value") ~ "PValue" )) |> pivot_wider(names_from = "stat", values_from = "value") |> unnest(c(logFC, PValue)) |> # Plot ggplot(aes(x = logFC, y = PValue)) + geom_point(aes(color = PValue < 0.05, size = PValue < 0.05)) + scale_y_continuous(trans = tidybulk::log10_reverse_trans()) + scale_color_manual(values = c("TRUE" = "red", "FALSE" = "black")) + scale_size_manual(values = c("TRUE" = 0.5, "FALSE" = 0.1)) + facet_wrap(~method) + my_theme + labs(title = "Volcano Plots by Method") ``` -------------------------------- ### Differential Expression Testing Function in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md This snippet highlights the R function `test_differential_expression()` from the tidybulk package, used to perform differential expression analysis using various statistical methods. ```R test_differential_expression() ``` -------------------------------- ### Summarize Differential Expression Results in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Calculates summary statistics (min, median, max) for log fold change (logFC) values across different differential expression methods. This provides a quantitative comparison of effect sizes obtained from each method. Note: The `across()` usage is deprecated in newer dplyr versions. ```r # Summary statistics airway |> pivot_transcript() |> select(contains("ql|lr_robust|voom|voom_weights|deseq2")) |> select(contains("logFC")) |> summarise(across(everything(), list(min = min, median = median, max = max), na.rm = TRUE)) ``` -------------------------------- ### Plot BCV Trend with edgeR Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Plots the biological coefficient of variation (BCV) trend for edgeR analysis. This helps in understanding the dispersion of the data. Requires the edgeR library. ```r library(edgeR) metadata(airway)$tidybulk$edgeR_quasi_likelihood_object |> plotBCV() ``` -------------------------------- ### Cellularity Analysis Functions in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md This snippet lists R functions from tidybulk for deconvolving cellularity and performing CIBERSORT analysis. These functions are useful for estimating cell type composition from transcriptomic data. ```R deconvolve_cellularity() cibersort() ``` -------------------------------- ### Pairwise Effect Size Comparison Plot in R (GGpairs) Source: https://github.com/stemangiola/tidybulk/blob/master/README.md Generates a pairwise comparison plot of effect sizes (log fold change) across different differential expression methods using the 'GGally' package. This plot aids in understanding the agreement in magnitude and direction of gene expression changes estimated by various methods. ```r library(GGally) airway |> pivot_transcript() |> select(ql__logFC, lr_robust__logFC, voom__logFC, voom_weights__logFC, deseq2__log2FoldChange) |> ggpairs(columns = 1:5) + my_theme + labs(title = "Pairplot of effect sizes across methods") ``` -------------------------------- ### Gene Enrichment Analysis Functions in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md This snippet covers R functions from tidybulk for performing gene enrichment analysis, including overrepresentation and rank-based tests. These functions help in identifying biological pathways or functions associated with gene sets. ```R test_gene_enrichment() test_gene_overrepresentation() test_gene_rank() ``` -------------------------------- ### Dimensionality Reduction Functions in R Source: https://github.com/stemangiola/tidybulk/blob/master/README.md This snippet lists R functions from tidybulk for performing dimensionality reduction using methods like PCA, MDS, tSNE, and UMAP. It also includes functions for rotating and removing redundant dimensions. ```R reduce_dimensions() rotate_dimensions() remove_redundancy() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.