### Install dittoSeq from GitHub Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Install dittoSeq directly from its GitHub repository using devtools for users with older R versions or if BiocManager installation fails. ```R if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools") devtools::install_github("dtm2451/dittoSeq") ``` -------------------------------- ### Summary Output Example Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md This is an example of the summary output generated by the import function, showing lane information, Demuxlet calls, and barcode duplicate status. ```text Adding 'Lane' information as meta.data Extracting the Demuxlet calls Matching barcodes Adding Demuxlet info as metadata Checking for barcode duplicates across lanes... No barcode duplicates were found. SUMMARY: 2 lanes were identified and named: Lane1, Lane2 The average number of SNPs per cell for all lanes was: 505.3 Out of 80 cells in the Seurat object, Demuxlet assigned: 75 cells or 93.8% as singlets 4 cells or 5% as doublets and 1 cells as too ambiguous to call. 0 cells were not annotated in the demuxlet.best file. ``` -------------------------------- ### Install dittoSeq for R-4.0+ Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Use BiocManager to install the pre-compiled version of dittoSeq for R-4.0 and later. ```R if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("dittoSeq") ``` -------------------------------- ### Basic dittoBarPlot with SummarizedExperiment Object Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Illustrates the usage of dittoBarPlot for visualizing gene expression across groups, using a SummarizedExperiment object. Note the setup code for creating the SE object. ```R library(dittoSeq) library(SummarizedExperiment) # SummarizedExperiment se <- as(as.SingleCellExperiment(Seurat::pbmc_small), "SummarizedExperiment") rownames(se) <- rownames(sce) dittoBarPlot(sce, "ident", group.by = "RNA_snn_res.0.8") ``` -------------------------------- ### Import and Plotting with dittoSeq Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Demonstrates importing data using importDittoBulk and plotting with dittoDimPlot. Assumes dgelist and embeddings are pre-defined. ```R myRNA <- importDittoBulk(dgelist) # edgeR # Then add dimensionality reductions # myRNA <- addDimReduction(myRNA, embeddings, "pca") # above, embeddings = the dim-reduction matrix myRNA <- example("importDittoBulk") # You're ready! dittoDimPlot("gene1", myRNA, size = 3) ``` -------------------------------- ### Basic dittoHeatmap Usage Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Creates a heatmap to visualize the expression of multiple genes across cells. Supports annotation by metadata and custom ordering/clustering. ```R # dittoHeatmap dittoHeatmap(seurat, genes = getGenes(seurat)[1:20]) dittoHeatmap(seurat, genes = getGenes(seurat)[1:20], annot.by = c("groups", "nFeature_RNA"), scaled.to.max = TRUE, treeheight_row = 10) # Turning off cell clustering can be necessary for large scRNAseq data # Thus, clustering is turned off by default for single-cell data, but not for # bulk RNAseq data. # To control ordering/clustering separately, use 'order.by' or 'cluster_cols' ## (Not shown) ## dittoHeatmap(seurat, genes = getGenes(seurat)[1:20], order.by = "groups") dittoHeatmap(seurat, genes = getGenes(seurat)[1:20], cluster_cols = FALSE) ``` -------------------------------- ### Basic dittoPlot with Seurat Object Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Demonstrates how to use dittoPlot to visualize gene expression for a specific gene ('CD14') grouped by cell identity, using a Seurat object. ```R library(dittoSeq) # Seurat seurat <- Seurat::pbmc_small dittoPlot(seurat, "CD14", group.by = "ident") ``` -------------------------------- ### Customizing Colors in dittoBarPlot Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Illustrates how to adjust the color scheme of a dittoBarPlot using 'colors' or 'color.panel' arguments. Useful for consistent or specific color assignments. ```R # Adjust colors dittoBarPlot(seurat, "ident", group.by = "RNA_snn_res.0.8", colors = c(3,1,2)) #Just changes the color order, probably most useful for dittoDimPlots dittoBarPlot(seurat, "ident", group.by = "RNA_snn_res.0.8", color.panel = c("red", "orange", "purple")) ``` -------------------------------- ### Outputting Data from dittoBarPlot Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Demonstrates how to extract the underlying data used for plotting in dittoBarPlot by setting 'data.out = TRUE'. Useful for further analysis or custom plotting. ```R # Output data dittoBarPlot(seurat, "ident", group.by = "RNA_snn_res.0.8", data.out = TRUE) ``` -------------------------------- ### Basic dittoDimPlot with SingleCellExperiment Object Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Shows how to use dittoDimPlot for visualizing gene expression on a dimensionality reduction plot, using a SingleCellExperiment object. ```R library(dittoSeq) # SingleCellEXperiment sce <- Seurat::as.SingleCellExperiment(seurat) dittoDimPlot(sce, "CD14") ``` -------------------------------- ### Basic dittoScatterPlot Usage Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Generates scatter plots to visualize the relationship between two variables (genes or metadata). Allows coloring and shaping by other variables. ```R # dittoScatterPlot dittoScatterPlot( object = seurat, x.var = "CD3E", y.var = "nCount_RNA", color.var = "ident", shape.by = "RNA_snn_res.0.8", size = 3) dittoScatterPlot( object = seurat, x.var = "nCount_RNA", y.var = "nFeature_RNA", color.var = "CD3E", size = 1.5) ``` -------------------------------- ### Simulate Colorblindness for dittoDimPlot Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Visualize a dittoDimPlot as if viewed by a colorblind individual. Specify the type of colorblindness (deutan, protan, tritan) and provide the original plotting function and its arguments. ```R dittoDimPlot("CD3E", object = seurat, do.letter=F) ``` ```R Simulate(type = "deutan", plot.function=dittoDimPlot, "CD3E", object = seurat, do.letter=F) ``` -------------------------------- ### Basic dittoPlot Usage Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Generates various plot types (boxplot, jitter, ridgeplot) for gene expression, grouped by metadata. Allows visualization of gene expression distributions. ```R # dittoPlot dittoPlot(seurat, "CD3E", group.by = "ident") dittoPlot(seurat, "CD3E", group.by = "ident", plots = c("boxplot", "jitter")) dittoPlot(seurat, "CD3E", group.by = "ident", plots = c("ridgeplot", "jitter")) ``` -------------------------------- ### Customizing dittoBarPlot Titles and Labels Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Demonstrates how to customize titles, labels, and legend text for dittoBarPlot. Useful for creating publication-ready figures. ```R # Adjust titles dittoBarPlot(seurat, "ident", group.by = "RNA_snn_res.0.8", main = "Starters", sub = "By Type", xlab = NULL, ylab = "Generation 1", x.labels = c("Ash", "Misty"), legend.title = "Types", var.labels.rename = c("Fire", "Water", "Grass"), x.labels.rotate = FALSE) ``` -------------------------------- ### Basic dittoBarPlot Usage Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Creates a bar plot to visualize cell identity or gene expression across different groups. Useful for comparing proportions or average expression. ```R # dittoBarPlot dittoBarPlot(seurat, "ident", group.by = "RNA_snn_res.0.8") dittoBarPlot(seurat, "ident", group.by = "RNA_snn_res.0.8", scale = "count") ``` -------------------------------- ### Subsetting Cells in dittoBarPlot Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Shows how to filter cells displayed in a dittoBarPlot using the 'cells.use' argument. This allows focusing on specific cell populations or samples. ```R # Subset cells / samples dittoBarPlot(seurat, "ident", group.by = "RNA_snn_res.0.8", cells.use = meta("ident", seurat)!=1) ``` -------------------------------- ### Summarize Demuxlet Calls Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Generates a plot showing the number of Demuxlet calls made per sample, separated by lanes. By default, it only shows Singlet calls; set `singlets.only = FALSE` to include doublet calls. ```R demux.calls.summary(object) ``` -------------------------------- ### Adding Plotly Hover Information to dittoBarPlot Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Enables interactive hover information for dittoBarPlot by setting 'do.hover = TRUE'. This allows users to see data details on mouseover. ```R # Add plotly hovering dittoBarPlot(seurat, "ident", group.by = "RNA_snn_res.0.8", do.hover = TRUE) ``` -------------------------------- ### Summarize Demuxlet SNPs per Cell Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Creates a plot of the number of SNPs per cell, grouped by individual lane. This function is a wrapper for dittoPlot() with specific defaults for Demuxlet SNP analysis. ```R demux.SNP.summary(object) ``` -------------------------------- ### Extracting Metadata and Gene Information Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Helper functions to retrieve metadata and gene information from Seurat or SingleCellExperiment objects. ```R getMetas(seurat) isMeta("nCount_RNA", seurat) getGenes(myRNA) isGene("CD3E", myRNA) getReductions(sce) # View them with these: gene("CD3E", seurat, assay = "RNA", slot = "counts") meta("groups", seurat) metaLevels("groups", seurat) ``` -------------------------------- ### Basic dittoDimPlot Usage Source: https://github.com/dtm2451/dittoseq/blob/devel/README.md Generates a dimension reduction plot using dittoDimPlot. Plots gene expression or cell identity on a dimension reduction plot. ```R # dittoDimPlot dittoDimPlot(seurat, "ident", size = 3) dittoDimPlot(seurat, "CD3E", size = 3) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.