Title: | Custom Visualizations & Functions for Streamlined Analyses of Single Cell Sequencing |
---|---|
Description: | Collection of functions created and/or curated to aid in the visualization and analysis of single-cell data using 'R'. 'scCustomize' aims to provide 1) Customized visualizations for aid in ease of use and to create more aesthetic and functional visuals. 2) Improve speed/reproducibility of common tasks/pieces of code in scRNA-seq analysis with a single or group of functions. For citation please use: Marsh SE (2021) "Custom Visualizations & Functions for Streamlined Analyses of Single Cell Sequencing" <doi:10.5281/zenodo.5706430> RRID:SCR_024675. |
Authors: | Samuel Marsh [aut, cre] , Ming Tang [ctb], Velina Kozareva [ctb], Lucas Graybuck [ctb] |
Maintainer: | Samuel Marsh <[email protected]> |
License: | GPL (>= 3) |
Version: | 2.1.2 |
Built: | 2024-10-25 05:35:51 UTC |
Source: | https://github.com/samuel-marsh/sccustomize |
Add alternative feature ids to the assay level meta.data slot in Assay5 compatible object (Seurat V5.0.0 or greater)
Add_Alt_Feature_ID( seurat_object, features_tsv_file = NULL, hdf5_file = NULL, assay = NULL )
Add_Alt_Feature_ID( seurat_object, features_tsv_file = NULL, hdf5_file = NULL, assay = NULL )
seurat_object |
object name. |
features_tsv_file |
output file from Cell Ranger used for creation of Seurat object.
(Either provide this of |
hdf5_file |
output file from Cell Ranger used for creation of Seurat object.
(Either provide this of |
assay |
name of assay(s) to add the alternative features to. Can specify "all" to add to all assays. |
Seurat Object with new entries in the obj@[email protected]
slot.
## Not run: # Using features.tsv.gz file # Either file from filtered or raw outputs can be used as they are identical. obj <- Add_Alt_Feature_ID(seurat_object = obj, features_tsv = "sample01/outs/filtered_feature_bc_matrix/features.tsv.gz", assay = "RNA") #' # Using hdf5 file # Either filtered_feature_bc or raw_feature_bc can be used as the features slot is identical # Though it is faster to load filtered_feature_bc file due to droplet filtering obj <- Add_Alt_Feature_ID(seurat_object = obj, hdf5_file = "sample01/outs/outs/filtered_feature_bc_matrix.h5", assay = "RNA") ## End(Not run)
## Not run: # Using features.tsv.gz file # Either file from filtered or raw outputs can be used as they are identical. obj <- Add_Alt_Feature_ID(seurat_object = obj, features_tsv = "sample01/outs/filtered_feature_bc_matrix/features.tsv.gz", assay = "RNA") #' # Using hdf5 file # Either filtered_feature_bc or raw_feature_bc can be used as the features slot is identical # Though it is faster to load filtered_feature_bc file due to droplet filtering obj <- Add_Alt_Feature_ID(seurat_object = obj, hdf5_file = "sample01/outs/outs/filtered_feature_bc_matrix.h5", assay = "RNA") ## End(Not run)
Add measure of cell complexity/novelty (log10GenesPerUMI) for data QC.
Add_Cell_Complexity(object, ...) ## S3 method for class 'liger' Add_Cell_Complexity( object, meta_col_name = "log10GenesPerUMI", overwrite = FALSE, ... ) ## S3 method for class 'Seurat' Add_Cell_Complexity( object, meta_col_name = "log10GenesPerUMI", assay = "RNA", overwrite = FALSE, ... )
Add_Cell_Complexity(object, ...) ## S3 method for class 'liger' Add_Cell_Complexity( object, meta_col_name = "log10GenesPerUMI", overwrite = FALSE, ... ) ## S3 method for class 'Seurat' Add_Cell_Complexity( object, meta_col_name = "log10GenesPerUMI", assay = "RNA", overwrite = FALSE, ... )
object |
Seurat or LIGER object |
... |
Arguments passed to other methods |
meta_col_name |
name to use for new meta data column. Default is "log10GenesPerUMI". |
overwrite |
Logical. Whether to overwrite existing an meta.data column. Default is FALSE meaning that
function will abort if column with name provided to |
assay |
assay to use in calculation. Default is "RNA". Note This should only be changed if storing corrected and uncorrected assays in same object (e.g. outputs of both Cell Ranger and Cell Bender). |
An object of the same class as object
with columns added to object meta data.
## Not run: # Liger liger_object <- Add_Cell_Complexity(object = liger_object) ## End(Not run) # Seurat library(Seurat) pbmc_small <- Add_Cell_Complexity(object = pbmc_small)
## Not run: # Liger liger_object <- Add_Cell_Complexity(object = liger_object) ## End(Not run) # Seurat library(Seurat) pbmc_small <- Add_Cell_Complexity(object = pbmc_small)
Add Mito/Ribo %, Cell Complexity (log10GenesPerUMI), Top Gene Percent with single function call
Add_Cell_QC_Metrics( seurat_object, add_mito_ribo = TRUE, add_complexity = TRUE, add_top_pct = TRUE, add_MSigDB = TRUE, add_IEG = TRUE, add_cell_cycle = TRUE, species, mito_name = "percent_mito", ribo_name = "percent_ribo", mito_ribo_name = "percent_mito_ribo", complexity_name = "log10GenesPerUMI", top_pct_name = NULL, oxphos_name = "percent_oxphos", apop_name = "percent_apop", dna_repair_name = "percent_dna_repair", ieg_name = "percent_ieg", mito_pattern = NULL, ribo_pattern = NULL, mito_features = NULL, ribo_features = NULL, ensembl_ids = FALSE, num_top_genes = 50, assay = NULL, overwrite = FALSE )
Add_Cell_QC_Metrics( seurat_object, add_mito_ribo = TRUE, add_complexity = TRUE, add_top_pct = TRUE, add_MSigDB = TRUE, add_IEG = TRUE, add_cell_cycle = TRUE, species, mito_name = "percent_mito", ribo_name = "percent_ribo", mito_ribo_name = "percent_mito_ribo", complexity_name = "log10GenesPerUMI", top_pct_name = NULL, oxphos_name = "percent_oxphos", apop_name = "percent_apop", dna_repair_name = "percent_dna_repair", ieg_name = "percent_ieg", mito_pattern = NULL, ribo_pattern = NULL, mito_features = NULL, ribo_features = NULL, ensembl_ids = FALSE, num_top_genes = 50, assay = NULL, overwrite = FALSE )
seurat_object |
object name. |
add_mito_ribo |
logical, whether to add percentage of counts belonging to mitochondrial/ribosomal genes to object (Default is TRUE). |
add_complexity |
logical, whether to add Cell Complexity to object (Default is TRUE). |
add_top_pct |
logical, whether to add Top Gene Percentages to object (Default is TRUE). |
add_MSigDB |
logical, whether to add percentages of counts belonging to genes from of mSigDB hallmark gene lists: "HALLMARK_OXIDATIVE_PHOSPHORYLATION", "HALLMARK_APOPTOSIS", and "HALLMARK_DNA_REPAIR" to object (Default is TRUE). |
add_IEG |
logical, whether to add percentage of counts belonging to IEG genes to object (Default is TRUE). |
add_cell_cycle |
logical, whether to addcell cycle scores and phase based on
|
species |
Species of origin for given Seurat Object. If mouse, human, marmoset, zebrafish, rat, drosophila, or rhesus macaque (name or abbreviation) are provided the function will automatically generate mito_pattern and ribo_pattern values. |
mito_name |
name to use for the new meta.data column containing percent mitochondrial counts. Default is "percent_mito". |
ribo_name |
name to use for the new meta.data column containing percent ribosomal counts. Default is "percent_ribo". |
mito_ribo_name |
name to use for the new meta.data column containing percent mitochondrial+ribosomal counts. Default is "percent_mito_ribo". |
complexity_name |
name to use for new meta data column for |
top_pct_name |
name to use for new meta data column for |
oxphos_name |
name to use for new meta data column for percentage of MSigDB oxidative phosphorylation counts. Default is "percent_oxphos". |
apop_name |
name to use for new meta data column for percentage of MSigDB apoptosis counts. Default is "percent_apop". |
dna_repair_name |
name to use for new meta data column for percentage of MSigDB DNA repair counts. Default is "percent_dna_repair".. |
ieg_name |
name to use for new meta data column for percentage of IEG counts. Default is "percent_ieg". |
mito_pattern |
A regex pattern to match features against for mitochondrial genes (will set automatically if species is mouse or human; marmoset features list saved separately). |
ribo_pattern |
A regex pattern to match features against for ribosomal genes (will set automatically if species is mouse, human, or marmoset). |
mito_features |
A list of mitochondrial gene names to be used instead of using regex pattern. Will override regex pattern if both are present (including default saved regex patterns). |
ribo_features |
A list of ribosomal gene names to be used instead of using regex pattern. Will override regex pattern if both are present (including default saved regex patterns). |
ensembl_ids |
logical, whether feature names in the object are gene names or ensembl IDs (default is FALSE; set TRUE if feature names are ensembl IDs). |
num_top_genes |
An integer vector specifying the size(s) of the top set of high-abundance genes. Used to compute the percentage of library size occupied by the most highly expressed genes in each cell. |
assay |
assay to use in calculation. Default is "RNA". Note This should only be changed if storing corrected and uncorrected assays in same object (e.g. outputs of both Cell Ranger and Cell Bender). |
overwrite |
Logical. Whether to overwrite existing an meta.data column. Default is FALSE meaning that
function will abort if column with name provided to |
A Seurat Object
## Not run: obj <- Add_Cell_QC_Metrics(seurat_object = obj, species = "Human") ## End(Not run)
## Not run: obj <- Add_Cell_QC_Metrics(seurat_object = obj, species = "Human") ## End(Not run)
Calculate the difference in features and UMIs per cell when both cell bender and raw assays are present.
Add_CellBender_Diff(seurat_object, raw_assay_name, cell_bender_assay_name)
Add_CellBender_Diff(seurat_object, raw_assay_name, cell_bender_assay_name)
seurat_object |
object name. |
raw_assay_name |
name of the assay containing the raw data. |
cell_bender_assay_name |
name of the assay containing the Cell Bender'ed data. |
Seurat object with 2 new columns in the meta.data slot.
## Not run: object <- Add_CellBender_Diff(seurat_object = obj, raw_assay_name = "RAW", cell_bender_assay_name = "RNA") ## End(Not run)
## Not run: object <- Add_CellBender_Diff(seurat_object = obj, raw_assay_name = "RAW", cell_bender_assay_name = "RNA") ## End(Not run)
Add Mito, Ribo, & Mito+Ribo percentages to meta.data slot of Seurat Object or cell.data slot of Liger object
Add_Mito_Ribo(object, ...) ## S3 method for class 'liger' Add_Mito_Ribo( object, species, mito_name = "percent_mito", ribo_name = "percent_ribo", mito_ribo_name = "percent_mito_ribo", mito_pattern = NULL, ribo_pattern = NULL, mito_features = NULL, ribo_features = NULL, ensembl_ids = FALSE, overwrite = FALSE, list_species_names = FALSE, ... ) ## S3 method for class 'Seurat' Add_Mito_Ribo( object, species, mito_name = "percent_mito", ribo_name = "percent_ribo", mito_ribo_name = "percent_mito_ribo", mito_pattern = NULL, ribo_pattern = NULL, mito_features = NULL, ribo_features = NULL, ensembl_ids = FALSE, assay = NULL, overwrite = FALSE, list_species_names = FALSE, ... )
Add_Mito_Ribo(object, ...) ## S3 method for class 'liger' Add_Mito_Ribo( object, species, mito_name = "percent_mito", ribo_name = "percent_ribo", mito_ribo_name = "percent_mito_ribo", mito_pattern = NULL, ribo_pattern = NULL, mito_features = NULL, ribo_features = NULL, ensembl_ids = FALSE, overwrite = FALSE, list_species_names = FALSE, ... ) ## S3 method for class 'Seurat' Add_Mito_Ribo( object, species, mito_name = "percent_mito", ribo_name = "percent_ribo", mito_ribo_name = "percent_mito_ribo", mito_pattern = NULL, ribo_pattern = NULL, mito_features = NULL, ribo_features = NULL, ensembl_ids = FALSE, assay = NULL, overwrite = FALSE, list_species_names = FALSE, ... )
object |
Seurat or LIGER object |
... |
Arguments passed to other methods |
species |
Species of origin for given Seurat Object. If mouse, human, marmoset, zebrafish, rat, drosophila, or rhesus macaque (name or abbreviation) are provided the function will automatically generate mito_pattern and ribo_pattern values. |
mito_name |
name to use for the new meta.data column containing percent mitochondrial counts. Default is "percent_mito". |
ribo_name |
name to use for the new meta.data column containing percent ribosomal counts. Default is "percent_ribo". |
mito_ribo_name |
name to use for the new meta.data column containing percent mitochondrial+ribosomal counts. Default is "percent_mito_ribo". |
mito_pattern |
A regex pattern to match features against for mitochondrial genes (will set automatically if species is mouse or human; marmoset features list saved separately). |
ribo_pattern |
A regex pattern to match features against for ribosomal genes (will set automatically if species is mouse, human, or marmoset). |
mito_features |
A list of mitochondrial gene names to be used instead of using regex pattern. Will override regex pattern if both are present (including default saved regex patterns). |
ribo_features |
A list of ribosomal gene names to be used instead of using regex pattern. Will override regex pattern if both are present (including default saved regex patterns). |
ensembl_ids |
logical, whether feature names in the object are gene names or ensembl IDs (default is FALSE; set TRUE if feature names are ensembl IDs). |
overwrite |
Logical. Whether to overwrite existing meta.data columns. Default is FALSE meaning that
function will abort if columns with any one of the names provided to |
list_species_names |
returns list of all accepted values to use for default species names which contain internal regex/feature lists (human, mouse, marmoset, zebrafish, rat, drosophila, and rhesus macaque). Default is FALSE. |
assay |
Assay to use (default is the current object default assay). |
An object of the same class as object
with columns added to object meta data.
## Not run: # Liger liger_object <- Add_Mito_Ribo(object = liger_object, species = "human") ## End(Not run) ## Not run: # Seurat seurat_object <- Add_Mito_Ribo(object = seurat_object, species = "human") ## End(Not run)
## Not run: # Liger liger_object <- Add_Mito_Ribo(object = liger_object, species = "human") ## End(Not run) ## Not run: # Seurat seurat_object <- Add_Mito_Ribo(object = seurat_object, species = "human") ## End(Not run)
Adds new column labeled "pct_diff" to the data.frame output of FindMarkers
, FindAllMarkers
, or other DE test data.frames.
Add_Pct_Diff( marker_dataframe, pct.1_name = "pct.1", pct.2_name = "pct.2", overwrite = FALSE )
Add_Pct_Diff( marker_dataframe, pct.1_name = "pct.1", pct.2_name = "pct.2", overwrite = FALSE )
marker_dataframe |
data.frame containing the results of |
pct.1_name |
the name of data.frame column corresponding to percent expressed in group 1. Default is Seurat default "pct.1". |
pct.2_name |
the name of data.frame column corresponding to percent expressed in group 2. Default is Seurat default "pct.2". |
overwrite |
logical. If the |
Returns input marker_dataframe
with additional "pct_diff" column.
## Not run: marker_df <- FindAllMarkers(object = obj_name) marker_df <- Add_Pct_Diff(marker_dataframe = marker_df) # or piped with function marker_df <- FindAllMarkers(object = obj_name) %>% Add_Pct_Diff() ## End(Not run)
## Not run: marker_df <- FindAllMarkers(object = obj_name) marker_df <- Add_Pct_Diff(marker_dataframe = marker_df) # or piped with function marker_df <- FindAllMarkers(object = obj_name) %>% Add_Pct_Diff() ## End(Not run)
Add meta data from ample level data.frame/tibble to cell level seurat @meta.data
slot
Add_Sample_Meta( seurat_object, meta_data, join_by_seurat, join_by_meta, na_ok = FALSE, overwrite = FALSE )
Add_Sample_Meta( seurat_object, meta_data, join_by_seurat, join_by_meta, na_ok = FALSE, overwrite = FALSE )
seurat_object |
object name. |
meta_data |
data.frame/tibble containing meta data or path to file to read. Must be formatted as either data.frame or tibble. |
join_by_seurat |
name of the column in |
join_by_meta |
name of the column in |
na_ok |
logical, is it ok to add NA values to |
overwrite |
logical, if there are shared columns between |
Seurat object with new @meta.data
columns
## Not run: # meta_data present in environment sample_level_meta <- data.frame(...) obj <- Add_Sample_Meta(seurat_object = obj, meta_data = sample_level_meta, join_by_seurat = "orig.ident", join_by_meta = "sample_ID") # from meta data file obj <- Add_Sample_Meta(seurat_object = obj, meta_data = "meta_data/sample_level_meta.csv", join_by_seurat = "orig.ident", join_by_meta = "sample_ID") ## End(Not run)
## Not run: # meta_data present in environment sample_level_meta <- data.frame(...) obj <- Add_Sample_Meta(seurat_object = obj, meta_data = sample_level_meta, join_by_seurat = "orig.ident", join_by_meta = "sample_ID") # from meta data file obj <- Add_Sample_Meta(seurat_object = obj, meta_data = "meta_data/sample_level_meta.csv", join_by_seurat = "orig.ident", join_by_meta = "sample_ID") ## End(Not run)
Add the percentage of counts occupied by the top XX most highly expressed genes in each cell.
Add_Top_Gene_Pct_Seurat( seurat_object, num_top_genes = 50, meta_col_name = NULL, assay = "RNA", overwrite = FALSE, verbose = TRUE )
Add_Top_Gene_Pct_Seurat( seurat_object, num_top_genes = 50, meta_col_name = NULL, assay = "RNA", overwrite = FALSE, verbose = TRUE )
seurat_object |
object name. |
num_top_genes |
An integer vector specifying the size(s) of the top set of high-abundance genes. Used to compute the percentage of library size occupied by the most highly expressed genes in each cell. |
meta_col_name |
name to use for new meta data column. Default is "percent_topXX", where XX is
equal to the value provided to |
assay |
assay to use in calculation. Default is "RNA". Note This should only be changed if storing corrected and uncorrected assays in same object (e.g. outputs of both Cell Ranger and Cell Bender). |
overwrite |
Logical. Whether to overwrite existing an meta.data column. Default is FALSE meaning that
function will abort if column with name provided to |
verbose |
logical, whether to print messages with status updates, default is TRUE. |
A Seurat Object
This function uses scuttle package (license: GPL-3) to calculate the percent of expression
coming from top XX genes in each cell. Parameter description for num_top_genes
also from scuttle.
If using this function in analysis, in addition to citing scCustomize, please cite scuttle:
McCarthy DJ, Campbell KR, Lun ATL, Willis QF (2017). “Scater: pre-processing, quality control,
normalisation and visualisation of single-cell RNA-seq data in R.” Bioinformatics, 33, 1179-1186.
doi:10.1093/bioinformatics/btw777.
https://bioconductor.org/packages/release/bioc/html/scuttle.html
## Not run: library(Seurat) pbmc_small <- Add_Top_Gene_Pct_Seurat(seurat_object = pbmc_small, num_top_genes = 50) ## End(Not run)
## Not run: library(Seurat) pbmc_small <- Add_Top_Gene_Pct_Seurat(seurat_object = pbmc_small, num_top_genes = 50) ## End(Not run)
Convert objects (Seurat & LIGER) to anndata objects
as.anndata(x, ...) ## S3 method for class 'Seurat' as.anndata( x, file_path, file_name, assay = "RNA", main_layer = "data", other_layers = "counts", transer_dimreduc = TRUE, verbose = TRUE, ... ) ## S3 method for class 'liger' as.anndata( x, file_path, file_name, transfer_norm.data = FALSE, reduction_label = NULL, add_barcode_names = FALSE, barcode_prefix = TRUE, barcode_cell_id_delimiter = "_", verbose = TRUE, ... )
as.anndata(x, ...) ## S3 method for class 'Seurat' as.anndata( x, file_path, file_name, assay = "RNA", main_layer = "data", other_layers = "counts", transer_dimreduc = TRUE, verbose = TRUE, ... ) ## S3 method for class 'liger' as.anndata( x, file_path, file_name, transfer_norm.data = FALSE, reduction_label = NULL, add_barcode_names = FALSE, barcode_prefix = TRUE, barcode_cell_id_delimiter = "_", verbose = TRUE, ... )
x |
Seurat or LIGER object |
... |
Arguments passed to other methods |
file_path |
directory file path and/or file name prefix. Defaults to current wd. |
file_name |
file name. |
assay |
Assay containing data to use, (default is "RNA"). |
main_layer |
the layer of data to become default layer in anndata object (default is "data"). |
other_layers |
other data layers to transfer to anndata object (default is "counts"). |
transer_dimreduc |
logical, whether to transfer dimensionality reduction coordinates from Seurat to anndata object (default is TRUE). |
verbose |
logical, whether to print status messages during object conversion (default is TRUE). |
transfer_norm.data |
logical, whether to transfer the norm.data in addition to raw.data, default is FALSE. |
reduction_label |
What to label the visualization dimensionality reduction. LIGER does not store name of technique and therefore needs to be set manually. |
add_barcode_names |
logical, whether to add dataset names to the cell barcodes when merging object data, default is FALSE. |
barcode_prefix |
logical, if |
barcode_cell_id_delimiter |
The delimiter to use when adding dataset id to barcode prefix/suffix. Default is "_". |
an anndata object generated from x
, saved at path provided.
Seurat version modified and enhanced version of sceasy::seurat2anndata
(sceasy package: https://github.com/cellgeni/sceasy; License: GPL-3. Function has additional checks and supports Seurat V3 and V5 object structure.
LIGER version inspired by sceasy::seurat2anndata
modified and updated to apply to LIGER objects (sceasy package: https://github.com/cellgeni/sceasy; License: GPL-3.
## Not run: as.anndata(x = seurat_object, file_path = "/folder_name", file_name = "anndata_converted.h5ad") ## End(Not run) ## Not run: as.anndata(x = liger_object, file_path = "/folder_name", file_name = "anndata_converted.h5ad") ## End(Not run)
## Not run: as.anndata(x = seurat_object, file_path = "/folder_name", file_name = "anndata_converted.h5ad") ## End(Not run) ## Not run: as.anndata(x = liger_object, file_path = "/folder_name", file_name = "anndata_converted.h5ad") ## End(Not run)
Convert objects (Seurat & lists of Seurat Objects) to anndata objects
as.LIGER(x, ...) ## S3 method for class 'Seurat' as.LIGER( x, group.by = "orig.ident", layers_name = NULL, assay = "RNA", remove_missing = FALSE, renormalize = TRUE, use_seurat_var_genes = FALSE, use_seurat_dimreduc = FALSE, reduction = NULL, keep_meta = TRUE, verbose = TRUE, ... ) ## S3 method for class 'list' as.LIGER( x, group.by = "orig.ident", dataset_names = NULL, assay = "RNA", remove_missing = FALSE, renormalize = TRUE, use_seurat_var_genes = FALSE, var_genes_method = "intersect", keep_meta = TRUE, verbose = TRUE, ... )
as.LIGER(x, ...) ## S3 method for class 'Seurat' as.LIGER( x, group.by = "orig.ident", layers_name = NULL, assay = "RNA", remove_missing = FALSE, renormalize = TRUE, use_seurat_var_genes = FALSE, use_seurat_dimreduc = FALSE, reduction = NULL, keep_meta = TRUE, verbose = TRUE, ... ) ## S3 method for class 'list' as.LIGER( x, group.by = "orig.ident", dataset_names = NULL, assay = "RNA", remove_missing = FALSE, renormalize = TRUE, use_seurat_var_genes = FALSE, var_genes_method = "intersect", keep_meta = TRUE, verbose = TRUE, ... )
x |
An object to convert to class |
... |
Arguments passed to other methods |
group.by |
Variable in meta data which contains variable to split data by, (default is "orig.ident"). |
layers_name |
name of meta.data column used to split layers if setting |
assay |
Assay containing raw data to use, (default is "RNA"). |
remove_missing |
logical, whether to remove missing genes with no counts when converting to LIGER object (default is FALSE). |
renormalize |
logical, whether to perform normalization after LIGER object creation (default is TRUE). |
use_seurat_var_genes |
logical, whether to transfer variable features from Seurat object to new LIGER object (default is FALSE). |
use_seurat_dimreduc |
logical, whether to transfer dimensionality reduction coordinates from Seurat to new LIGER object (default is FALSE). |
reduction |
Name of Seurat reduction to transfer if |
keep_meta |
logical, whether to transfer columns in Seurat meta.data slot to LIGER cell.data slot (default is TRUE). |
verbose |
logical, whether to print status messages during object conversion (default is TRUE). |
dataset_names |
optional, vector of names to use for naming datasets. |
var_genes_method |
how variable genes should be selected from Seurat objects if |
a liger object generated from x
modified and enhanced version of rliger::seuratToLiger
.
## Not run: liger_object <- as.LIGER(x = seurat_object) ## End(Not run) ## Not run: liger_object <- as.LIGER(x = seurat_object_list) ## End(Not run)
## Not run: liger_object <- as.LIGER(x = seurat_object) ## End(Not run) ## Not run: liger_object <- as.LIGER(x = seurat_object_list) ## End(Not run)
Seurat
objectsMerges raw.data and scale.data of object, and creates Seurat object with these values along with slots containing dimensionality reduction coordinates, iNMF factorization, and cluster assignments. Supports Seurat V3/4 and V4.
## S3 method for class 'liger' as.Seurat( x, nms = names(x@H), renormalize = TRUE, use.liger.genes = TRUE, by.dataset = FALSE, keep_meta = TRUE, reduction_label = "UMAP", seurat_assay = "RNA", assay_type = NULL, add_barcode_names = FALSE, barcode_prefix = TRUE, barcode_cell_id_delimiter = "_", ... )
## S3 method for class 'liger' as.Seurat( x, nms = names(x@H), renormalize = TRUE, use.liger.genes = TRUE, by.dataset = FALSE, keep_meta = TRUE, reduction_label = "UMAP", seurat_assay = "RNA", assay_type = NULL, add_barcode_names = FALSE, barcode_prefix = TRUE, barcode_cell_id_delimiter = "_", ... )
x |
|
nms |
By default, labels cell names with dataset of origin (this is to account for cells in different datasets which may have same name). Other names can be passed here as vector, must have same length as the number of datasets. (default names(H)). |
renormalize |
Whether to log-normalize raw data using Seurat defaults (default TRUE). |
use.liger.genes |
Whether to carry over variable genes (default TRUE). |
by.dataset |
Include dataset of origin in cluster identity in Seurat object (default FALSE). |
keep_meta |
logical. Whether to transfer additional metadata (nGene/nUMI/dataset already transferred) to new Seurat Object. Default is TRUE. |
reduction_label |
Name of dimensionality reduction technique used. Enables accurate transfer or name to Seurat object instead of defaulting to "tSNE". |
seurat_assay |
Name to set for assay in Seurat Object. Default is "RNA". |
assay_type |
what type of Seurat assay to create in new object (Assay vs Assay5).
Default is NULL which will default to the current user settings.
See |
add_barcode_names |
logical, whether to add dataset names to the cell barcodes when creating Seurat object, default is FALSE. |
barcode_prefix |
logical, if |
barcode_cell_id_delimiter |
The delimiter to use when adding dataset id to barcode prefix/suffix. Default is "_". |
... |
unused. |
Stores original dataset identity by default in new object metadata if dataset names are passed in nms. iNMF factorization is stored in dim.reduction object with key "iNMF".
Seurat object with raw.data, scale.data, reduction_label, iNMF, and ident slots set.
Seurat object.
Original function is part of LIGER package https://github.com/welch-lab/liger (Licence: GPL-3). Function was modified for use in scCustomize with additional parameters/functionality.
## Not run: seurat_object <- as.Seurat(x = liger_object) ## End(Not run)
## Not run: seurat_object <- as.Seurat(x = liger_object) ## End(Not run)
Plot UMI vs. Barcode Rank with inflection and knee. Requires input from DropletUtils package.
Barcode_Plot( br_out, pt.size = 6, plot_title = "Barcode Ranks", raster_dpi = c(1024, 1024), plateau = NULL )
Barcode_Plot( br_out, pt.size = 6, plot_title = "Barcode Ranks", raster_dpi = c(1024, 1024), plateau = NULL )
br_out |
DFrame output from |
pt.size |
point size for plotting, default is 6. |
plot_title |
Title for plot, default is "Barcode Ranks". |
raster_dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(1024, 1024). |
plateau |
numerical value at which to add vertical line designating estimated empty droplet plateau (default is NULL). |
A ggplot object
## Not run: mat <- Read10X_h5(filename = "raw_feature_bc_matrix.h5") br_results <- DropletUtils::barcodeRanks(mat) Barcode_Plot(br_out = br_results) ## End(Not run)
## Not run: mat <- Read10X_h5(filename = "raw_feature_bc_matrix.h5") br_results <- DropletUtils::barcodeRanks(mat) Barcode_Plot(br_out = br_results) ## End(Not run)
Shortcut for thematic modification to remove all axis labels and grid lines
Blank_Theme(...)
Blank_Theme(...)
... |
extra arguments passed to |
Returns a list-like object of class theme.
# Generate a plot and customize theme library(ggplot2) df <- data.frame(x = rnorm(n = 100, mean = 20, sd = 2), y = rbinom(n = 100, size = 100, prob = 0.2)) p <- ggplot(data = df, mapping = aes(x = x, y = y)) + geom_point(mapping = aes(color = 'red')) p + Blank_Theme()
# Generate a plot and customize theme library(ggplot2) df <- data.frame(x = rnorm(n = 100, mean = 20, sd = 2), y = rbinom(n = 100, size = 100, prob = 0.2)) p <- ggplot(data = df, mapping = aes(x = x, y = y)) + geom_point(mapping = aes(color = 'red')) p + Blank_Theme()
Check for alternate case features Checks Seurat object for the presence of features with the same spelling but alternate case.
Case_Check( seurat_object, gene_list, case_check_msg = TRUE, return_features = TRUE, assay = NULL )
Case_Check( seurat_object, gene_list, case_check_msg = TRUE, return_features = TRUE, assay = NULL )
seurat_object |
Seurat object name. |
gene_list |
vector of genes to check. |
case_check_msg |
logical. Whether to print message to console if alternate case features are found in addition to inclusion in returned list. Default is TRUE. |
return_features |
logical. Whether to return vector of alternate case features. Default is TRUE. |
assay |
Name of assay to pull feature names from. If NULL will use the result of |
If features found returns vector of found alternate case features and prints message depending on parameters specified.
## Not run: alt_features <- Case_Check(seurat_object = obj_name, gene_list = DEG_list) ## End(Not run)
## Not run: alt_features <- Case_Check(seurat_object = obj_name, gene_list = DEG_list) ## End(Not run)
Create Plot with meta data variable of interest highlighted
Cell_Highlight_Plot( seurat_object, cells_highlight, highlight_color = NULL, background_color = "lightgray", pt.size = NULL, aspect_ratio = NULL, figure_plot = FALSE, raster = NULL, raster.dpi = c(512, 512), label = FALSE, split.by = NULL, split_seurat = FALSE, ggplot_default_colors = FALSE, ... )
Cell_Highlight_Plot( seurat_object, cells_highlight, highlight_color = NULL, background_color = "lightgray", pt.size = NULL, aspect_ratio = NULL, figure_plot = FALSE, raster = NULL, raster.dpi = c(512, 512), label = FALSE, split.by = NULL, split_seurat = FALSE, ggplot_default_colors = FALSE, ... )
seurat_object |
Seurat object name. |
cells_highlight |
Cell names to highlight in named list. |
highlight_color |
Color to highlight cells. |
background_color |
non-highlighted cell colors (default is "lightgray").. |
pt.size |
point size for both highlighted cluster and background. |
aspect_ratio |
Control the aspect ratio (y:x axes ratio length). Must be numeric value; Default is NULL. |
figure_plot |
logical. Whether to remove the axes and plot with legend on left of plot denoting
axes labels. (Default is FALSE). Requires |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
label |
Whether to label the highlighted meta data variable(s). Default is FALSE. |
split.by |
Variable in |
split_seurat |
logical. Whether or not to display split plots like Seurat (shared y axis) or as individual plots in layout. Default is FALSE. |
ggplot_default_colors |
logical. If |
... |
Extra parameters passed to |
A ggplot object
library(Seurat) # Creating example non-overlapping vectors of cells MS4A1 <- WhichCells(object = pbmc_small, expression = MS4A1 > 4) GZMB <- WhichCells(object = pbmc_small, expression = GZMB > 4) # Format as named list cells <- list("MS4A1" = MS4A1, "GZMB" = GZMB) Cell_Highlight_Plot(seurat_object = pbmc_small, cells_highlight = cells)
library(Seurat) # Creating example non-overlapping vectors of cells MS4A1 <- WhichCells(object = pbmc_small, expression = MS4A1 > 4) GZMB <- WhichCells(object = pbmc_small, expression = GZMB > 4) # Format as named list cells <- list("MS4A1" = MS4A1, "GZMB" = GZMB) Cell_Highlight_Plot(seurat_object = pbmc_small, cells_highlight = cells)
Plot of total cell or nuclei number per sample grouped by another meta data variable.
CellBender_Diff_Plot( feature_diff_df, pct_diff_threshold = 25, num_features = NULL, label = TRUE, num_labels = 20, min_count_label = 1, repel = TRUE, custom_labels = NULL, plot_line = TRUE, plot_title = "Raw Counts vs. Cell Bender Counts", x_axis_label = "Raw Data Counts", y_axis_label = "Cell Bender Counts", xnudge = 0, ynudge = 0, max.overlaps = 100, label_color = "dodgerblue", fontface = "bold", label_size = 3.88, bg.color = "white", bg.r = 0.15, ... )
CellBender_Diff_Plot( feature_diff_df, pct_diff_threshold = 25, num_features = NULL, label = TRUE, num_labels = 20, min_count_label = 1, repel = TRUE, custom_labels = NULL, plot_line = TRUE, plot_title = "Raw Counts vs. Cell Bender Counts", x_axis_label = "Raw Data Counts", y_axis_label = "Cell Bender Counts", xnudge = 0, ynudge = 0, max.overlaps = 100, label_color = "dodgerblue", fontface = "bold", label_size = 3.88, bg.color = "white", bg.r = 0.15, ... )
feature_diff_df |
name of data.frame created using |
pct_diff_threshold |
threshold to use for feature plotting. Resulting plot will only contain features which exhibit percent change >= value. Default is 25. |
num_features |
Number of features to plot. Will ignore |
label |
logical, whether or not to label the features that have largest percent difference between raw and CellBender counts (Default is TRUE). |
num_labels |
Number of features to label if |
min_count_label |
Minimum number of raw counts per feature necessary to be included in plot labels (default is 1) |
repel |
logical, whether to use geom_text_repel to create a nicely-repelled labels; this is slow when a lot of points are being plotted. If using repel, set xnudge and ynudge to 0, (Default is TRUE). |
custom_labels |
A custom set of features to label instead of the features most different between raw and CellBender counts. |
plot_line |
logical, whether to plot diagonal line with slope = 1 (Default is TRUE). |
plot_title |
Plot title. |
x_axis_label |
Label for x axis. |
y_axis_label |
Label for y axis. |
xnudge |
Amount to nudge X and Y coordinates of labels by. |
ynudge |
Amount to nudge X and Y coordinates of labels by. |
max.overlaps |
passed to |
label_color |
Color to use for text labels. |
fontface |
font face to use for text labels (“plain”, “bold”, “italic”, “bold.italic”) (Default is "bold"). |
label_size |
text size for feature labels (passed to |
bg.color |
color to use for shadow/outline of text labels (passed to |
bg.r |
radius to use for shadow/outline of text labels (passed to |
... |
Extra parameters passed to |
A ggplot object
## Not run: # get cell bender differences data.frame cb_stats <- CellBender_Feature_Diff(seurat_object - obj, raw_assay = "RAW", cell_bender_assay = "RNA") # plot CellBender_Diff_Plot(feature_diff_df = cb_stats, pct_diff_threshold = 25) ## End(Not run)
## Not run: # get cell bender differences data.frame cb_stats <- CellBender_Feature_Diff(seurat_object - obj, raw_assay = "RAW", cell_bender_assay = "RNA") # plot CellBender_Diff_Plot(feature_diff_df = cb_stats, pct_diff_threshold = 25) ## End(Not run)
Get quick values for raw counts, CellBender counts, count differences, and percent count differences per feature.
CellBender_Feature_Diff( seurat_object = NULL, raw_assay = NULL, cell_bender_assay = NULL, raw_mat = NULL, cell_bender_mat = NULL )
CellBender_Feature_Diff( seurat_object = NULL, raw_assay = NULL, cell_bender_assay = NULL, raw_mat = NULL, cell_bender_mat = NULL )
seurat_object |
Seurat object name. |
raw_assay |
Name of the assay containing the raw count data. |
cell_bender_assay |
Name of the assay containing the CellBender count data. |
raw_mat |
Name of raw count matrix in environment if not using Seurat object. |
cell_bender_mat |
Name of CellBender count matrix in environment if not using Seurat object. |
A data.frame containing summed raw counts, CellBender counts, count difference, and percent difference in counts.
## Not run: cb_stats <- CellBender_Feature_Diff(seurat_object - obj, raw_assay = "RAW", cell_bender_assay = "RNA") ## End(Not run)
## Not run: cb_stats <- CellBender_Feature_Diff(seurat_object - obj, raw_assay = "RAW", cell_bender_assay = "RNA") ## End(Not run)
Change all instances of delimiter in cell names from list of data.frames/matrices or single data.frame/matrix
Change_Delim_All(data, current_delim, new_delim)
Change_Delim_All(data, current_delim, new_delim)
data |
Either matrix/data.frame or list of matrices/data.frames with the cell barcodes in the column names. |
current_delim |
a single value of current delimiter. |
new_delim |
a single value of new delimiter desired. |
matrix or data.frame with new column names.
## Not run: dge_matrix <- Change_Delim_All(data = dge_matrix, current_delim = ".", new_delim = "-") ## End(Not run)
## Not run: dge_matrix <- Change_Delim_All(data = dge_matrix, current_delim = ".", new_delim = "-") ## End(Not run)
Change barcode prefix delimiter from list of data.frames/matrices or single data.frame/matrix
Change_Delim_Prefix(data, current_delim, new_delim)
Change_Delim_Prefix(data, current_delim, new_delim)
data |
Either matrix/data.frame or list of matrices/data.frames with the cell barcodes in the column names. |
current_delim |
a single value of current delimiter. |
new_delim |
a single value of new delimiter desired. |
matrix or data.frame with new column names.
## Not run: dge_matrix <- Change_Delim_Prefix(data = dge_matrix, current_delim = ".", new_delim = "-") ## End(Not run)
## Not run: dge_matrix <- Change_Delim_Prefix(data = dge_matrix, current_delim = ".", new_delim = "-") ## End(Not run)
Change barcode suffix delimiter from list of data.frames/matrices or single data.frame/matrix
Change_Delim_Suffix(data, current_delim, new_delim)
Change_Delim_Suffix(data, current_delim, new_delim)
data |
Either matrix/data.frame or list of matrices/data.frames with the cell barcodes in the column names. |
current_delim |
a single value of current delimiter. |
new_delim |
a single value of new delimiter desired. |
matrix or data.frame with new column names.
## Not run: dge_matrix <- Change_Delim_Suffix(data = dge_matrix, current_delim = ".", new_delim = "-") ## End(Not run)
## Not run: dge_matrix <- Change_Delim_Suffix(data = dge_matrix, current_delim = ".", new_delim = "-") ## End(Not run)
Native implementation of SeuratObjects CheckMatrix but with modified warning messages.
CheckMatrix_scCustom( object, checks = c("infinite", "logical", "integer", "na") )
CheckMatrix_scCustom( object, checks = c("infinite", "logical", "integer", "na") )
object |
A matrix |
checks |
Type of checks to perform, choose one or more from:
|
Emits warnings for each test and invisibly returns NULL
Re-implementing CheckMatrix
only for sparse matrices with modified warning messages. Original function from SeuratObject https://github.com/satijalab/seurat-object/blob/9c0eda946e162d8595696e5280a6ecda6284db39/R/utils.R#L625-L650 (License: MIT).
## Not run: mat <- Read10X(...) CheckMatrix_scCustom(object = mat) ## End(Not run)
## Not run: mat <- Read10X(...) CheckMatrix_scCustom(object = mat) ## End(Not run)
Create Plot with cluster of interest highlighted
Cluster_Highlight_Plot( seurat_object, cluster_name, highlight_color = NULL, background_color = "lightgray", pt.size = NULL, aspect_ratio = NULL, figure_plot = FALSE, raster = NULL, raster.dpi = c(512, 512), label = FALSE, split.by = NULL, split_seurat = FALSE, ggplot_default_colors = FALSE, ... )
Cluster_Highlight_Plot( seurat_object, cluster_name, highlight_color = NULL, background_color = "lightgray", pt.size = NULL, aspect_ratio = NULL, figure_plot = FALSE, raster = NULL, raster.dpi = c(512, 512), label = FALSE, split.by = NULL, split_seurat = FALSE, ggplot_default_colors = FALSE, ... )
seurat_object |
Seurat object name. |
cluster_name |
Name(s) (or number(s)) identity of cluster to be highlighted. |
highlight_color |
Color(s) to highlight cells. The default is NULL and plot will use
|
background_color |
non-highlighted cell colors. |
pt.size |
point size for both highlighted cluster and background. |
aspect_ratio |
Control the aspect ratio (y:x axes ratio length). Must be numeric value; Default is NULL. |
figure_plot |
logical. Whether to remove the axes and plot with legend on left of plot denoting
axes labels. (Default is FALSE). Requires |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
label |
Whether to label the highlighted cluster(s). Default is FALSE. |
split.by |
Feature to split plots by (i.e. "orig.ident"). |
split_seurat |
logical. Whether or not to display split plots like Seurat (shared y axis) or as individual plots in layout. Default is FALSE. |
ggplot_default_colors |
logical. If |
... |
Extra parameters passed to |
A ggplot object
Cluster_Highlight_Plot(seurat_object = pbmc_small, cluster_name = "1", highlight_color = "gold", background_color = "lightgray", pt.size = 2)
Cluster_Highlight_Plot(seurat_object = pbmc_small, cluster_name = "1", highlight_color = "gold", background_color = "lightgray", pt.size = 2)
Calculates both overall and per sample cell number and percentages per cluster based on orig.ident
Cluster_Stats_All_Samples(seurat_object, group_by_var = "orig.ident")
Cluster_Stats_All_Samples(seurat_object, group_by_var = "orig.ident")
seurat_object |
Seurat object name. |
group_by_var |
meta data column to classify samples (default = "orig.ident"). |
A data.frame
## Not run: stats <- Cluster_Stats_All_Samples(seurat_object = object, group_by_var = "orig.ident") ## End(Not run)
## Not run: stats <- Cluster_Stats_All_Samples(seurat_object = object, group_by_var = "orig.ident") ## End(Not run)
Clustered DotPlots using ComplexHeatmap
Clustered_DotPlot( seurat_object, features, split.by = NULL, colors_use_exp = viridis_plasma_dark_high, exp_color_min = -2, exp_color_middle = NULL, exp_color_max = 2, exp_value_type = "scaled", print_exp_quantiles = FALSE, colors_use_idents = NULL, x_lab_rotate = TRUE, plot_padding = NULL, flip = FALSE, k = 1, feature_km_repeats = 1000, ident_km_repeats = 1000, row_label_size = 8, row_label_fontface = "plain", grid_color = NULL, cluster_feature = TRUE, cluster_ident = TRUE, column_label_size = 8, legend_label_size = 10, legend_title_size = 10, raster = FALSE, plot_km_elbow = TRUE, elbow_kmax = NULL, assay = NULL, group.by = NULL, idents = NULL, show_parent_dend_line = TRUE, ggplot_default_colors = FALSE, color_seed = 123, seed = 123 )
Clustered_DotPlot( seurat_object, features, split.by = NULL, colors_use_exp = viridis_plasma_dark_high, exp_color_min = -2, exp_color_middle = NULL, exp_color_max = 2, exp_value_type = "scaled", print_exp_quantiles = FALSE, colors_use_idents = NULL, x_lab_rotate = TRUE, plot_padding = NULL, flip = FALSE, k = 1, feature_km_repeats = 1000, ident_km_repeats = 1000, row_label_size = 8, row_label_fontface = "plain", grid_color = NULL, cluster_feature = TRUE, cluster_ident = TRUE, column_label_size = 8, legend_label_size = 10, legend_title_size = 10, raster = FALSE, plot_km_elbow = TRUE, elbow_kmax = NULL, assay = NULL, group.by = NULL, idents = NULL, show_parent_dend_line = TRUE, ggplot_default_colors = FALSE, color_seed = 123, seed = 123 )
seurat_object |
Seurat object name. |
features |
Features to plot. |
split.by |
Variable in |
colors_use_exp |
Color palette to use for plotting expression scale. Default is |
exp_color_min |
Minimum scaled average expression threshold (everything smaller will be set to this). Default is -2. |
exp_color_middle |
What scaled expression value to use for the middle of the provided |
exp_color_max |
Minimum scaled average expression threshold (everything smaller will be set to this). Default is 2. |
exp_value_type |
Whether to plot average normalized expression or
scaled average normalized expression. Only valid when |
print_exp_quantiles |
Whether to print the quantiles of expression data in addition to plots.
Default is FALSE. NOTE: These values will be altered by choices of |
colors_use_idents |
specify color palette to used for identity labels. By default if
number of levels plotted is less than or equal to 36 it will use "polychrome" and if greater than 36
will use "varibow" with shuffle = TRUE both from |
x_lab_rotate |
How to rotate column labels. By default set to |
plot_padding |
if plot needs extra white space padding so no plot or labels are cutoff. The parameter accepts TRUE or numeric vector of length 4. If TRUE padding will be set to c(2, 10, 0 0) (bottom, left, top, right). Can also be customized further with numeric vector of length 4 specifying the amount of padding in millimeters. Default is NULL, no padding. |
flip |
logical, whether to flip the axes of final plot. Default is FALSE; rows = features and columns = idents. |
k |
Value to use for k-means clustering on features Sets (km) parameter in |
feature_km_repeats |
Number of k-means runs to get a consensus k-means clustering for features.
Note if |
ident_km_repeats |
Number of k-means runs to get a consensus k-means clustering. Similar to
|
row_label_size |
Size of the feature labels. Provided to |
row_label_fontface |
Fontface to use for row labels. Provided to |
grid_color |
color to use for heatmap grid. Default is NULL which "removes" grid by using NA color. |
cluster_feature |
logical, whether to cluster and reorder feature axis. Default is TRUE. |
cluster_ident |
logical, whether to cluster and reorder identity axis. Default is TRUE. |
column_label_size |
Size of the feature labels. Provided to |
legend_label_size |
Size of the legend text labels. Provided to |
legend_title_size |
Sise of the legend title text labels. Provided to |
raster |
Logical, whether to render in raster format (faster plotting, smaller files). Default is FALSE. |
plot_km_elbow |
Logical, whether or not to return the Sum Squared Error Elbow Plot for k-means clustering.
Estimating elbow of this plot is one way to determine "optimal" value for |
elbow_kmax |
The maximum value of k to use for |
assay |
Name of assay to use, defaults to the active assay. |
group.by |
Group (color) cells in different ways (for example, orig.ident). |
idents |
Which classes to include in the plot (default is all). |
show_parent_dend_line |
Logical, Sets parameter of same name in |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
seed |
Sets seed for reproducible plotting (ComplexHeatmap plot). |
A ComplexHeatmap or if plot_km_elbow = TRUE a list containing ggplot2 object and ComplexHeatmap.
Ming Tang (Original Code), Sam Marsh (Wrap single function, added/modified functionality)
https://divingintogeneticsandgenomics.rbind.io/post/clustered-dotplot-for-single-cell-rnaseq/
https://twitter.com/tangming2005
library(Seurat) Clustered_DotPlot(seurat_object = pbmc_small, features = c("CD3E", "CD8", "GZMB", "MS4A1"))
library(Seurat) Clustered_DotPlot(seurat_object = pbmc_small, features = c("CD3E", "CD8", "GZMB", "MS4A1"))
Shortcut ta a modified 8 color palette based on Color Universal Design (CUD) colorblindness friendly palette.
ColorBlind_Pal()
ColorBlind_Pal()
modified/reordered color palette (8 colors) based on ditto-seq
palette is slightly modified version of the Color Universal Design (CUD) colorblindness friendly palette https://jfly.uni-koeln.de/color/.
cols <- ColorBlind_Pal() PalettePlot(pal = cols)
cols <- ColorBlind_Pal() PalettePlot(pal = cols)
Will convert assays within a Seurat object between "Assay" and "Assay5" types.
Convert_Assay(seurat_object, assay = NULL, convert_to)
Convert_Assay(seurat_object, assay = NULL, convert_to)
seurat_object |
Seurat object name. |
assay |
name(s) of assays to convert. Default is NULL and will check with users which assays they want to convert. |
convert_to |
value of what assay type to convert current assays to. #'
|
## Not run: # Convert to V3/4 assay obj <- Convert_Assay(seurat_object = obj, convert_to = "V3") # Convert to 5 assay obj <- Convert_Assay(seurat_object = obj, convert_to = "V5") ## End(Not run)
## Not run: # Convert to V3/4 assay obj <- Convert_Assay(seurat_object = obj, convert_to = "V3") # Convert to 5 assay obj <- Convert_Assay(seurat_object = obj, convert_to = "V5") ## End(Not run)
Run command from R console without moving to terminal to copy folder from GCP bucket to local storage
Copy_From_GCP(folder_file_path, gcp_bucket_path)
Copy_From_GCP(folder_file_path, gcp_bucket_path)
folder_file_path |
folder to be copied to GCP bucket. |
gcp_bucket_path |
GCP bucket path to copy to files. |
No return value. Performs system copy from GCP bucket.
## Not run: Copy_From_GCP(folder_file_path = "plots/", gcp_bucket_path = "gs://bucket_name_and_folder_path") ## End(Not run)
## Not run: Copy_From_GCP(folder_file_path = "plots/", gcp_bucket_path = "gs://bucket_name_and_folder_path") ## End(Not run)
Run command from R console without moving to terminal to copy folder to GCP bucket
Copy_To_GCP(folder_file_path, gcp_bucket_path)
Copy_To_GCP(folder_file_path, gcp_bucket_path)
folder_file_path |
folder to be copied to GCP bucket. |
gcp_bucket_path |
GCP bucket path to copy to files. |
No return value. Performs system copy to GCP bucket.
## Not run: Copy_To_GCP(folder_file_path = "plots/", gcp_bucket_path = "gs://bucket_name_and_folder_path") ## End(Not run)
## Not run: Copy_To_GCP(folder_file_path = "plots/", gcp_bucket_path = "gs://bucket_name_and_folder_path") ## End(Not run)
Creates HDF5 formatted output analogous to the outputs created by Cell Ranger and can be read into Seurat, LIGER, or SCE class object. Requires DropletUtils package from Bioconductor.
Create_10X_H5( raw_data_file_path, source_type = "10X", save_file_path, save_name )
Create_10X_H5( raw_data_file_path, source_type = "10X", save_file_path, save_name )
raw_data_file_path |
file path to raw data file(s). |
source_type |
type of source data (Default is "10X"). Alternatively can provide "Matrix" or "data.frame". |
save_file_path |
file path to directory to save file. |
save_name |
name prefix for output H5 file. |
A HDF5 format file that will be recognized as 10X Cell Ranger formatted file by Seurat or LIGER.
## Not run: Create_10X_H5(raw_data_file_path = "file_path", save_file_path = "file_path2", save_name = "NAME") ## End(Not run)
## Not run: Create_10X_H5(raw_data_file_path = "file_path", save_file_path = "file_path2", save_name = "NAME") ## End(Not run)
Enables easy creation of Seurat object which contains both cell bender data and raw count data as separate assays within the object.
Create_CellBender_Merged_Seurat( raw_cell_bender_matrix = NULL, raw_counts_matrix = NULL, raw_assay_name = "RAW", min_cells = 5, min_features = 200, ... )
Create_CellBender_Merged_Seurat( raw_cell_bender_matrix = NULL, raw_counts_matrix = NULL, raw_assay_name = "RAW", min_cells = 5, min_features = 200, ... )
raw_cell_bender_matrix |
matrix file containing the cell bender correct counts. |
raw_counts_matrix |
matrix file contain the uncorrected Cell Ranger (or other) counts. |
raw_assay_name |
a key value to use specifying the name of assay. Default is "RAW". |
min_cells |
value to supply to min.cells parameter of |
min_features |
value to supply to min.features parameter of |
... |
Extra parameters passed to |
A Seurat Object contain both the Cell Bender corrected counts ("RNA" assay) and uncorrected
counts ("RAW" assay; or other name specified to raw_assay_name
).
## Not run: seurat_obj <- Create_CellBender_Merged_Seurat(raw_cell_bender_matrix = cb_matrix, raw_counts_matrix = cr_matrix) ## End(Not run)
## Not run: seurat_obj <- Create_CellBender_Merged_Seurat(raw_cell_bender_matrix = cb_matrix, raw_counts_matrix = cr_matrix) ## End(Not run)
create annotation file
Create_Cluster_Annotation_File( file_path = NULL, file_name = "cluster_annotation" )
Create_Cluster_Annotation_File( file_path = NULL, file_name = "cluster_annotation" )
file_path |
path to directory to save file. Default is current working directory. |
file_name |
name to use for annotation file. Function automatically adds file type ".csv" suffix. Default is "cluster_annotation". |
No value returned. Creates .csv file.
## Not run: Create_Cluster_Annotation_File(file_path = "cluster_annotation_folder_name") ## End(Not run)
## Not run: Create_Cluster_Annotation_File(file_path = "cluster_annotation_folder_name") ## End(Not run)
Shortcut to Dark2 color palette from RColorBrewer (8 Colors)
Dark2_Pal()
Dark2_Pal()
"Dark2" color palette (8 colors)
Dark2 palette from RColorBrewer being called through paletteer. See RColorBrewer for more info on palettes https://CRAN.R-project.org/package=RColorBrewer
cols <- Dark2_Pal() PalettePlot(pal= cols)
cols <- Dark2_Pal() PalettePlot(pal= cols)
Creates DimPlot layout containing all samples within Seurat Object from orig.ident column
DimPlot_All_Samples( seurat_object, meta_data_column = "orig.ident", colors_use = "black", pt.size = NULL, aspect_ratio = NULL, title_size = 15, num_columns = NULL, reduction = NULL, dims = c(1, 2), raster = NULL, raster.dpi = c(512, 512), ... )
DimPlot_All_Samples( seurat_object, meta_data_column = "orig.ident", colors_use = "black", pt.size = NULL, aspect_ratio = NULL, title_size = 15, num_columns = NULL, reduction = NULL, dims = c(1, 2), raster = NULL, raster.dpi = c(512, 512), ... )
seurat_object |
Seurat object name. |
meta_data_column |
Meta data column to split plots by. |
colors_use |
single color to use for all plots or a vector of colors equal to the number of plots. |
pt.size |
Adjust point size for plotting. |
aspect_ratio |
Control the aspect ratio (y:x axes ratio length). Must be numeric value; Default is NULL. |
title_size |
size for plot title labels. |
num_columns |
number of columns in final layout plot. |
reduction |
Dimensionality Reduction to use (if NULL then defaults to Object default). |
dims |
Which dimensions to plot. Defaults to c(1,2) if not specified. |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
... |
Extra parameters passed to |
A ggplot object
library(Seurat) pbmc_small$sample_id <- sample(c("sample1", "sample2"), size = ncol(pbmc_small), replace = TRUE) DimPlot_All_Samples(seurat_object = pbmc_small, meta_data_column = "sample_id", color = "black", num_columns = 2)
library(Seurat) pbmc_small$sample_id <- sample(c("sample1", "sample2"), size = ncol(pbmc_small), replace = TRUE) DimPlot_All_Samples(seurat_object = pbmc_small, meta_data_column = "sample_id", color = "black", num_columns = 2)
Standard and modified version of LIGER's plotByDatasetAndCluster
DimPlot_LIGER( liger_object, group_by = NULL, split_by = NULL, colors_use_cluster = NULL, colors_use_meta = NULL, pt_size = NULL, shuffle = TRUE, shuffle_seed = 1, reduction_label = "UMAP", aspect_ratio = NULL, label = TRUE, label_size = NA, label_repel = FALSE, label_box = FALSE, label_color = "black", combination = FALSE, raster = NULL, raster.dpi = c(512, 512), num_columns = NULL, ggplot_default_colors = FALSE, color_seed = 123 )
DimPlot_LIGER( liger_object, group_by = NULL, split_by = NULL, colors_use_cluster = NULL, colors_use_meta = NULL, pt_size = NULL, shuffle = TRUE, shuffle_seed = 1, reduction_label = "UMAP", aspect_ratio = NULL, label = TRUE, label_size = NA, label_repel = FALSE, label_box = FALSE, label_color = "black", combination = FALSE, raster = NULL, raster.dpi = c(512, 512), num_columns = NULL, ggplot_default_colors = FALSE, color_seed = 123 )
liger_object |
|
group_by |
Variable to be plotted. If |
split_by |
Variable to split plots by. |
colors_use_cluster |
colors to use for plotting by clusters. By default if number of levels plotted is
less than or equal to 36 will use "polychrome" and if greater than 36 will use "varibow" with shuffle = TRUE
both from |
colors_use_meta |
colors to use for plotting by meta data (cell.data) variable. By default if number of levels plotted is less than or equal to 36 it will use "polychrome" and if greater than 36 will use "varibow" with shuffle = TRUE both from DiscretePalette_scCustomize. |
pt_size |
Adjust point size for plotting. |
shuffle |
logical. Whether to randomly shuffle the order of points. This can be useful for crowded plots if points of interest are being buried. (Default is TRUE). |
shuffle_seed |
Sets the seed if randomly shuffling the order of points. |
reduction_label |
What to label the x and y axes of resulting plots. LIGER does not store name of technique and therefore needs to be set manually. Default is "UMAP". |
aspect_ratio |
Control the aspect ratio (y:x axes ratio length). Must be numeric value; Default is NULL. |
label |
logical. Whether or not to label the clusters. ONLY applies to plotting by cluster. Default is TRUE. |
label_size |
size of cluster labels. |
label_repel |
logical. Whether to repel cluster labels from each other if plotting by
cluster (if |
label_box |
logical. Whether to put a box around the label text (uses |
label_color |
Color to use for cluster labels. Default is "black". |
combination |
logical, whether to return patchwork displaying both plots side by side. (Default is FALSE). |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
num_columns |
Number of columns in plot layout. Only valid if |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
A ggplot/patchwork object
## Not run: DimPlot_LIGER(liger_object = obj_name, reduction_label = "UMAP") ## End(Not run)
## Not run: DimPlot_LIGER(liger_object = obj_name, reduction_label = "UMAP") ## End(Not run)
Creates DimPlot with some of the settings modified from their Seurat defaults (colors_use, shuffle, label).
DimPlot_scCustom( seurat_object, colors_use = NULL, pt.size = NULL, reduction = NULL, group.by = NULL, split.by = NULL, split_seurat = FALSE, figure_plot = FALSE, aspect_ratio = NULL, shuffle = TRUE, seed = 1, label = NULL, label.size = 4, label.color = "black", label.box = FALSE, dims = c(1, 2), repel = FALSE, raster = NULL, raster.dpi = c(512, 512), num_columns = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
DimPlot_scCustom( seurat_object, colors_use = NULL, pt.size = NULL, reduction = NULL, group.by = NULL, split.by = NULL, split_seurat = FALSE, figure_plot = FALSE, aspect_ratio = NULL, shuffle = TRUE, seed = 1, label = NULL, label.size = 4, label.color = "black", label.box = FALSE, dims = c(1, 2), repel = FALSE, raster = NULL, raster.dpi = c(512, 512), num_columns = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
seurat_object |
Seurat object name. |
colors_use |
color palette to use for plotting. By default if number of levels plotted is less than
or equal to 36 it will use "polychrome" and if greater than 36 will use "varibow" with shuffle = TRUE
both from |
pt.size |
Adjust point size for plotting. |
reduction |
Dimensionality Reduction to use (if NULL then defaults to Object default). |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident); default is the current active.ident of the object. |
split.by |
Feature to split plots by (i.e. "orig.ident"). |
split_seurat |
logical. Whether or not to display split plots like Seurat (shared y axis) or as individual plots in layout. Default is FALSE. |
figure_plot |
logical. Whether to remove the axes and plot with legend on left of plot denoting
axes labels. (Default is FALSE). Requires |
aspect_ratio |
Control the aspect ratio (y:x axes ratio length). Must be numeric value; Default is NULL. |
shuffle |
logical. Whether to randomly shuffle the order of points. This can be useful for crowded plots if points of interest are being buried. (Default is TRUE). |
seed |
Sets the seed if randomly shuffling the order of points. |
label |
Whether to label the clusters. By default if |
label.size |
Sets size of labels. |
label.color |
Sets the color of the label text. |
label.box |
Whether to put a box around the label text (geom_text vs geom_label). |
dims |
Which dimensions to plot. Defaults to c(1,2) if not specified. |
repel |
Repel labels. |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
num_columns |
Number of columns in plot layout. Only valid if |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
... |
Extra parameters passed to |
A ggplot object
Many of the param names and descriptions are from Seurat to facilitate ease of use as
this is simply a wrapper to alter some of the default parameters https://github.com/satijalab/seurat/blob/master/R/visualization.R (License: GPL-3).
figure_plot
parameter/code modified from code by Tim Stuart via twitter: https://twitter.com/timoast/status/1526237116035891200?s=20&t=foJOF81aPSjr1t7pk1cUPg.
library(Seurat) DimPlot_scCustom(seurat_object = pbmc_small)
library(Seurat) DimPlot_scCustom(seurat_object = pbmc_small)
Helper function to return a number of discrete color palettes.
DiscretePalette_scCustomize( num_colors, palette = NULL, shuffle_pal = FALSE, seed = 123 )
DiscretePalette_scCustomize( num_colors, palette = NULL, shuffle_pal = FALSE, seed = 123 )
num_colors |
Number of colors to be generated. |
palette |
Options are "alphabet", "alphabet2", "glasbey", "polychrome", "stepped", "ditto_seq", "varibow". |
shuffle_pal |
randomly shuffle the outputted palette. Most useful for |
seed |
random seed for the palette shuffle. Default = 123. |
A vector of colors
This function uses the paletteer package https://github.com/EmilHvitfeldt/paletteer to provide simplified access to color palettes from many different R package sources while minimizing scCustomize current and future dependencies.
The following packages & palettes are called by this function (see individual packages for palette references/citations):
pals (via paletteer) https://CRAN.R-project.org/package=pals
alphabet, alphabet2, glasbey, polychrome, and stepped.
dittoSeq https://bioconductor.org/packages/release/bioc/html/dittoSeq.html
dittoColors.
colorway https://github.com/hypercompetent/colorway
varibow
Function name and implementation modified from Seurat (License: GPL-3). https://github.com/satijalab/seurat
pal <- DiscretePalette_scCustomize(num_colors = 36, palette = "varibow") PalettePlot(pal= pal)
pal <- DiscretePalette_scCustomize(num_colors = 36, palette = "varibow") PalettePlot(pal= pal)
Code for creating customized DotPlot
DotPlot_scCustom( seurat_object, features, group.by = NULL, colors_use = viridis_plasma_dark_high, remove_axis_titles = TRUE, x_lab_rotate = FALSE, y_lab_rotate = FALSE, facet_label_rotate = FALSE, flip_axes = FALSE, ... )
DotPlot_scCustom( seurat_object, features, group.by = NULL, colors_use = viridis_plasma_dark_high, remove_axis_titles = TRUE, x_lab_rotate = FALSE, y_lab_rotate = FALSE, facet_label_rotate = FALSE, flip_axes = FALSE, ... )
seurat_object |
Seurat object name. |
features |
Features to plot. |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident); default is the current active.ident of the object. |
colors_use |
specify color palette to used. Default is viridis_plasma_dark_high. |
remove_axis_titles |
logical. Whether to remove the x and y axis titles. Default = TRUE. |
x_lab_rotate |
Rotate x-axis labels 45 degrees (Default is FALSE). |
y_lab_rotate |
Rotate x-axis labels 45 degrees (Default is FALSE). |
facet_label_rotate |
Rotate facet labels on grouped |
flip_axes |
whether or not to flip and X and Y axes (Default is FALSE). |
... |
Extra parameters passed to |
A ggplot object
library(Seurat) DotPlot_scCustom(seurat_object = pbmc_small, features = c("CD3E", "CD8", "GZMB", "MS4A1"))
library(Seurat) DotPlot_scCustom(seurat_object = pbmc_small, features = c("CD3E", "CD8", "GZMB", "MS4A1"))
A list of ensembl ids for mitochondrial genes (Ensembl version 105)
ensembl_mito_id
ensembl_mito_id
A list of six vectors
Ensembl IDs for mouse mitochondrial genes
Ensembl IDs for human mitochondrial genes
Ensembl IDs for zebrafish mitochondrial genes
Ensembl IDs for rat mitochondrial genes
Ensembl IDs for fly mitochondrial genes
Ensembl IDs for macaque mitochondrial genes
A list of ensembl ids for ribosomal genes (Ensembl version 105)
ensembl_ribo_id
ensembl_ribo_id
A list of seven vectors
Ensembl IDs for mouse ribosomal genes
Ensembl IDs for human ribosomal genes
Ensembl IDs for marmoset ribosomal genes
Ensembl IDs for zebrafish ribosomal genes
Ensembl IDs for rat ribosomal genes
Ensembl IDs for fly ribosomal genes
Ensembl IDs for macaque ribosomal genes
Reorganize multi-modal data after import with Read10X()
or scCustomize read functions.
Organizes sub-lists by data modality instead of by sample.
Extract_Modality(matrix_list)
Extract_Modality(matrix_list)
matrix_list |
list of matrices to split by modality |
list of lists, with one sublist per data modality. Sub-list contain 1 matrix entry per sample
## Not run: multi_mat <- Read10X(...) new_multi_mat <- Extract_Modality(matrix_list = multi_mat) ## End(Not run)
## Not run: multi_mat <- Read10X(...) new_multi_mat <- Extract_Modality(matrix_list = multi_mat) ## End(Not run)
Returns a by identity meta.data data.frame with one row per sample. Useful for downstream quick view of sample breakdown, meta data table creation, and/or use in pseudobulk analysis
Extract_Sample_Meta( object, sample_name = "orig.ident", variables_include = NULL, variables_exclude = NULL, include_all = FALSE )
Extract_Sample_Meta( object, sample_name = "orig.ident", variables_include = NULL, variables_exclude = NULL, include_all = FALSE )
object |
Seurat object |
sample_name |
meta.data column to use as sample. Output data.frame will contain one row per level or unique value in this variable. |
variables_include |
|
variables_exclude |
columns to discard in final data.frame. Many cell level columns are irrelevant at the sample level (e.g., nFeature_RNA, percent_mito).
|
include_all |
logical, whether or not to include all object meta data columns in output data.frame. Default is FALSE. |
Returns a data.frame with one row per sample_name
.
library(Seurat) pbmc_small[["batch"]] <- sample(c("batch1", "batch2"), size = ncol(pbmc_small), replace = TRUE) sample_meta <- Extract_Sample_Meta(object = pbmc_small, sample_name = "orig.ident") # Only return specific columns from meta data (orig.ident and batch) sample_meta2 <- Extract_Sample_Meta(object = pbmc_small, sample_name = "orig.ident", variables_include = "batch") # Return all columns from meta data sample_meta3 <- Extract_Sample_Meta(object = pbmc_small, sample_name = "orig.ident", include_all = TRUE)
library(Seurat) pbmc_small[["batch"]] <- sample(c("batch1", "batch2"), size = ncol(pbmc_small), replace = TRUE) sample_meta <- Extract_Sample_Meta(object = pbmc_small, sample_name = "orig.ident") # Only return specific columns from meta data (orig.ident and batch) sample_meta2 <- Extract_Sample_Meta(object = pbmc_small, sample_name = "orig.ident", variables_include = "batch") # Return all columns from meta data sample_meta3 <- Extract_Sample_Meta(object = pbmc_small, sample_name = "orig.ident", include_all = TRUE)
Extract vector gene list (or named gene vector) from data.frame results of FindAllMarkers
or similar analysis.
Extract_Top_Markers( marker_dataframe, num_genes = 10, group_by = "cluster", rank_by = "avg_log2FC", gene_column = "gene", gene_rownames_to_column = FALSE, data_frame = FALSE, named_vector = TRUE, make_unique = FALSE )
Extract_Top_Markers( marker_dataframe, num_genes = 10, group_by = "cluster", rank_by = "avg_log2FC", gene_column = "gene", gene_rownames_to_column = FALSE, data_frame = FALSE, named_vector = TRUE, make_unique = FALSE )
marker_dataframe |
data.frame output from |
num_genes |
number of genes per group (e.g., cluster) to include in output list. |
group_by |
column name of |
rank_by |
column name of |
gene_column |
column name of |
gene_rownames_to_column |
logical. Whether gene IDs are stored in rownames and should be moved to column. Default is FALSE. |
data_frame |
Logical, whether or not to return filtered data.frame of the original |
named_vector |
Logical, whether or not to name the vector of gene names that is returned by the function.
If |
make_unique |
Logical, whether an unnamed vector should return only unique values. Default is FALSE.
Not applicable when |
filtered data.frame, vector, or named vector containing gene IDs.
## Not run: top10_genes <- Extract_Top_Markers(marker_dataframe = markers_results, num_genes = 10, group_by = "cluster", rank_by = "avg_log2FC") ## End(Not run)
## Not run: top10_genes <- Extract_Top_Markers(marker_dataframe = markers_results, num_genes = 10, group_by = "cluster", rank_by = "avg_log2FC") ## End(Not run)
Check if genes are present in object and return vector of found genes. Return warning messages for genes not found.
Feature_Present( data, features, case_check = TRUE, case_check_msg = TRUE, print_msg = TRUE, omit_warn = TRUE, return_none = FALSE, seurat_assay = NULL )
Feature_Present( data, features, case_check = TRUE, case_check_msg = TRUE, print_msg = TRUE, omit_warn = TRUE, return_none = FALSE, seurat_assay = NULL )
data |
Name of input data. Currently only data of classes: Seurat, liger, data.frame, dgCMatrix, dgTMatrix, tibble are accepted. Gene_IDs must be present in rownames of the data. |
features |
vector of features to check. |
case_check |
logical. Whether or not to check if features are found if the case is changed from the input list (Sentence case to Upper and vice versa). Default is TRUE. |
case_check_msg |
logical. Whether to print message to console if alternate case features are found in addition to inclusion in returned list. Default is TRUE. |
print_msg |
logical. Whether message should be printed if all features are found. Default is TRUE. |
omit_warn |
logical. Whether to print message about features that are not found in current object. Default is TRUE. |
return_none |
logical. Whether list of found vs. bad features should still be returned if no features are found. Default is FALSE. |
seurat_assay |
Name of assay to pull feature names from if |
A list of length 3 containing 1) found features, 2) not found features, 3) features found if case was modified.
## Not run: features <- Feature_Present(data = obj_name, features = DEG_list, print_msg = TRUE, case_check = TRUE) found_features <- features[[1]] ## End(Not run)
## Not run: features <- Feature_Present(data = obj_name, features = DEG_list, print_msg = TRUE, case_check = TRUE) found_features <- features[[1]] ## End(Not run)
Create Custom FeaturePlots and preserve scale (no binning) from same features in two assays simultaneously. Intended for plotting same modality present in two assays.
FeaturePlot_DualAssay( seurat_object, features, assay1 = "RAW", assay2 = "RNA", colors_use = viridis_plasma_dark_high, na_color = "lightgray", order = TRUE, pt.size = NULL, aspect_ratio = NULL, reduction = NULL, na_cutoff = 1e-09, raster = NULL, raster.dpi = c(512, 512), slot = deprecated(), layer = "data", num_columns = NULL, alpha_exp = NULL, alpha_na_exp = NULL, ... )
FeaturePlot_DualAssay( seurat_object, features, assay1 = "RAW", assay2 = "RNA", colors_use = viridis_plasma_dark_high, na_color = "lightgray", order = TRUE, pt.size = NULL, aspect_ratio = NULL, reduction = NULL, na_cutoff = 1e-09, raster = NULL, raster.dpi = c(512, 512), slot = deprecated(), layer = "data", num_columns = NULL, alpha_exp = NULL, alpha_na_exp = NULL, ... )
seurat_object |
Seurat object name. |
features |
Feature(s) to plot. |
assay1 |
name of assay one. Default is "RAW" as featured in |
assay2 |
name of assay two Default is "RNA" as featured in |
colors_use |
list of colors or color palette to use. |
na_color |
color to use for points below lower limit. |
order |
whether to move positive cells to the top (default = TRUE). |
pt.size |
Adjust point size for plotting. |
aspect_ratio |
Control the aspect ratio (y:x axes ratio length). Must be numeric value; Default is NULL. |
reduction |
Dimensionality Reduction to use (if NULL then defaults to Object default). |
na_cutoff |
Value to use as minimum expression cutoff. To set no cutoff set to |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
slot |
|
layer |
Which layer to pull expression data from? Default is "data". |
num_columns |
Number of columns in plot layout. If number of features > 1 then |
alpha_exp |
new alpha level to apply to expressing cell color palette ( |
alpha_na_exp |
new alpha level to apply to non-expressing cell color palette ( |
... |
Extra parameters passed to |
A ggplot object
## Not run: FeaturePlot_DualAssay(seurat_object = object, features = "Cx3cr1", assay1 = "RAW", assay2 = "RNA", colors_use = viridis_plasma_dark_high, na_color = "lightgray") ## End(Not run)
## Not run: FeaturePlot_DualAssay(seurat_object = object, features = "Cx3cr1", assay1 = "RAW", assay2 = "RNA", colors_use = viridis_plasma_dark_high, na_color = "lightgray") ## End(Not run)
Create Custom FeaturePlots and preserve scale (no binning)
FeaturePlot_scCustom( seurat_object, features, colors_use = viridis_plasma_dark_high, na_color = "lightgray", order = TRUE, pt.size = NULL, reduction = NULL, na_cutoff = 1e-09, raster = NULL, raster.dpi = c(512, 512), split.by = NULL, split_collect = NULL, aspect_ratio = NULL, figure_plot = FALSE, num_columns = NULL, slot = deprecated(), layer = "data", alpha_exp = NULL, alpha_na_exp = NULL, label = FALSE, label_feature_yaxis = FALSE, combine = TRUE, ... )
FeaturePlot_scCustom( seurat_object, features, colors_use = viridis_plasma_dark_high, na_color = "lightgray", order = TRUE, pt.size = NULL, reduction = NULL, na_cutoff = 1e-09, raster = NULL, raster.dpi = c(512, 512), split.by = NULL, split_collect = NULL, aspect_ratio = NULL, figure_plot = FALSE, num_columns = NULL, slot = deprecated(), layer = "data", alpha_exp = NULL, alpha_na_exp = NULL, label = FALSE, label_feature_yaxis = FALSE, combine = TRUE, ... )
seurat_object |
Seurat object name. |
features |
Feature(s) to plot. |
colors_use |
list of colors or color palette to use. |
na_color |
color to use for points below lower limit. |
order |
whether to move positive cells to the top (default = TRUE). |
pt.size |
Adjust point size for plotting. |
reduction |
Dimensionality Reduction to use (if NULL then defaults to Object default). |
na_cutoff |
Value to use as minimum expression cutoff. This will be lowest value plotted use
palette provided to |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
split.by |
Variable in |
split_collect |
logical, whether to collect the legends/guides when plotting with |
aspect_ratio |
Control the aspect ratio (y:x axes ratio length). Must be numeric value; Default is NULL. |
figure_plot |
logical. Whether to remove the axes and plot with legend on left of plot denoting
axes labels. (Default is FALSE). Requires |
num_columns |
Number of columns in plot layout. |
slot |
|
layer |
Which layer to pull expression data from? Default is "data". |
alpha_exp |
new alpha level to apply to expressing cell color palette ( |
alpha_na_exp |
new alpha level to apply to non-expressing cell color palette ( |
label |
logical, whether to label the clusters. Default is FALSE. |
label_feature_yaxis |
logical, whether to place feature labels on secondary y-axis as opposed to
above legend key. Default is FALSE. When setting |
combine |
Combine plots into a single |
... |
Extra parameters passed to |
A ggplot object
library(Seurat) FeaturePlot_scCustom(seurat_object = pbmc_small, features = "CD3E", colors_use = viridis_plasma_dark_high, na_color = "lightgray")
library(Seurat) FeaturePlot_scCustom(seurat_object = pbmc_small, features = "CD3E", colors_use = viridis_plasma_dark_high, na_color = "lightgray")
Create customized FeatureScatter plots with scCustomize defaults.
FeatureScatter_scCustom( seurat_object, feature1 = NULL, feature2 = NULL, colors_use = NULL, pt.size = NULL, group.by = NULL, split.by = NULL, split_seurat = FALSE, shuffle = TRUE, aspect_ratio = NULL, title_size = 15, plot.cor = TRUE, num_columns = NULL, raster = NULL, raster.dpi = c(512, 512), ggplot_default_colors = FALSE, color_seed = 123, ... )
FeatureScatter_scCustom( seurat_object, feature1 = NULL, feature2 = NULL, colors_use = NULL, pt.size = NULL, group.by = NULL, split.by = NULL, split_seurat = FALSE, shuffle = TRUE, aspect_ratio = NULL, title_size = 15, plot.cor = TRUE, num_columns = NULL, raster = NULL, raster.dpi = c(512, 512), ggplot_default_colors = FALSE, color_seed = 123, ... )
seurat_object |
Seurat object name. |
feature1 |
First feature to plot. |
feature2 |
Second feature to plot. |
colors_use |
color for the points on plot. |
pt.size |
Adjust point size for plotting. |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident). Default is active ident. |
split.by |
Feature to split plots by (i.e. "orig.ident"). |
split_seurat |
logical. Whether or not to display split plots like Seurat (shared y axis) or as individual plots in layout. Default is FALSE. |
shuffle |
logical, whether to randomly shuffle the order of points. This can be useful for crowded plots if points of interest are being buried. Default is TRUE. |
aspect_ratio |
Control the aspect ratio (y:x axes ratio length). Must be numeric value; Default is NULL. |
title_size |
size for plot title labels. Does NOT apply if |
plot.cor |
Display correlation in plot subtitle (or title if |
num_columns |
number of columns in final layout plot. |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
... |
Extra parameters passed to |
A ggplot object
library(Seurat) pbmc_small$sample_id <- sample(c("sample1", "sample2"), size = ncol(pbmc_small), replace = TRUE) FeatureScatter_scCustom(seurat_object = pbmc_small, feature1 = "nCount_RNA", feature2 = "nFeature_RNA", split.by = "sample_id")
library(Seurat) pbmc_small$sample_id <- sample(c("sample1", "sample2"), size = ncol(pbmc_small), replace = TRUE) FeatureScatter_scCustom(seurat_object = pbmc_small, feature1 = "nCount_RNA", feature2 = "nFeature_RNA", split.by = "sample_id")
Quick function to properly pull meta.data from objects.
Fetch_Meta(object) ## S3 method for class 'Seurat' Fetch_Meta(object) ## S3 method for class 'liger' Fetch_Meta(object)
Fetch_Meta(object) ## S3 method for class 'Seurat' Fetch_Meta(object) ## S3 method for class 'liger' Fetch_Meta(object)
object |
Object of class Seurat or liger. |
A data.frame containing cell-level meta data
library(Seurat) meta_data <- Fetch_Meta(object = pbmc_small) head(meta_data, 5)
library(Seurat) meta_data <- Fetch_Meta(object = pbmc_small) head(meta_data, 5)
Check if genes are present in object and return vector of found genes. Return warning messages for genes not found.
Gene_Present( data, gene_list, case_check = TRUE, case_check_msg = TRUE, print_msg = TRUE, omit_warn = TRUE, return_none = FALSE, seurat_assay = NULL )
Gene_Present( data, gene_list, case_check = TRUE, case_check_msg = TRUE, print_msg = TRUE, omit_warn = TRUE, return_none = FALSE, seurat_assay = NULL )
data |
Name of input data. Currently only data of classes: Seurat, liger, data.frame, dgCMatrix, dgTMatrix, tibble are accepted. Gene_IDs must be present in rownames of the data. |
gene_list |
vector of genes to check. |
case_check |
logical. Whether or not to check if features are found if the case is changed from the input list (Sentence case to Upper and vice versa). Default is TRUE. |
case_check_msg |
logical. Whether to print message to console if alternate case features are found in addition to inclusion in returned list. Default is TRUE. |
print_msg |
logical. Whether message should be printed if all features are found. Default is TRUE. |
omit_warn |
logical. Whether to print message about features that are not found in current object. Default is TRUE. |
return_none |
logical. Whether list of found vs. bad features should still be returned if no features are found. Default is FALSE. |
seurat_assay |
Name of assay to pull feature names from if |
A list of length 3 containing 1) found features, 2) not found features, 3) features found if case was modified.
## Not run: features <- Gene_Present(data = obj_name, gene_list = DEG_list, print_msg = TRUE, case_check = TRUE) found_features <- features[[1]] ## End(Not run)
## Not run: features <- Gene_Present(data = obj_name, gene_list = DEG_list, print_msg = TRUE, case_check = TRUE) found_features <- features[[1]] ## End(Not run)
Shortcut to hue_pal to return to ggplot2 defaults if user desires, from scales package.
Hue_Pal(num_colors)
Hue_Pal(num_colors)
num_colors |
number of colors to return in palette. |
hue color palette (as many colors as desired)
cols <- Hue_Pal(num_colors = 8) PalettePlot(pal= cols)
cols <- Hue_Pal(num_colors = 8) PalettePlot(pal= cols)
Gene symbols for immediate early genes
ieg_gene_list
ieg_gene_list
A list of seven vectors
Gene symbols for IEGs from source publication (see below)
Human gene symbols for homologous genes from mouse gene list
Mouse gene list is from: SI Table 4 from doi:10.1016/j.neuron.2017.09.026. Human gene list was compiled by first creating homologous gene list using biomaRt and then adding some manually curated homologs according to HGNC.
Read data, calculate DropletUtils::barcodeRanks
, create barcode rank plots, and outout single PDF output.
Iterate_Barcode_Rank_Plot( dir_path_h5, multi_directory = TRUE, h5_filename = "raw_feature_bc_matrix.h5", cellranger_multi = FALSE, parallel = FALSE, num_cores = NULL, file_path = NULL, file_name = NULL, pt.size = 6, raster_dpi = c(1024, 1024), plateau = NULL, ... )
Iterate_Barcode_Rank_Plot( dir_path_h5, multi_directory = TRUE, h5_filename = "raw_feature_bc_matrix.h5", cellranger_multi = FALSE, parallel = FALSE, num_cores = NULL, file_path = NULL, file_name = NULL, pt.size = 6, raster_dpi = c(1024, 1024), plateau = NULL, ... )
dir_path_h5 |
path to parent directory (if |
multi_directory |
logical, whether or not all h5 files are in their own subdirectories or in a single directory (default is TRUE; each in own subdirectory (e.g. output from Cell Ranger)). |
h5_filename |
Either the file name of h5 file (if |
cellranger_multi |
logical, whether the outputs to be read are from Cell Ranger |
parallel |
logical, should files be read in parallel (default is FALSE). |
num_cores |
Number of cores to use in parallel if |
file_path |
file path to use for saving PDF output. |
file_name |
Name of PDF output file. |
pt.size |
point size for plotting, default is 6. |
raster_dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(1024, 1024). |
plateau |
numerical values at which to add vertical line designating estimated empty droplet plateau (default is NULL). Must be vector equal in length to number of samples. |
... |
Additional parameters passed to |
pdf document
## Not run: Iterate_Barcode_Rank_Plot(dir_path_h5 = "H5_PATH/", multi_directory = TRUE, h5_filename = "raw_feature_bc_matrix", parallel = TRUE, num_cores = 12, file_path = "OUTPUT_PATH", file_name = "Barcode_Rank_Plots") ## End(Not run)
## Not run: Iterate_Barcode_Rank_Plot(dir_path_h5 = "H5_PATH/", multi_directory = TRUE, h5_filename = "raw_feature_bc_matrix", parallel = TRUE, num_cores = 12, file_path = "OUTPUT_PATH", file_name = "Barcode_Rank_Plots") ## End(Not run)
Iterate the create plots with cluster of interest highlighted across all cluster (active.idents) in given Seurat Object
Iterate_Cluster_Highlight_Plot( seurat_object, highlight_color = "dodgerblue", background_color = "lightgray", pt.size = NULL, reduction = NULL, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, dpi = 600, raster = NULL, ... )
Iterate_Cluster_Highlight_Plot( seurat_object, highlight_color = "dodgerblue", background_color = "lightgray", pt.size = NULL, reduction = NULL, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, dpi = 600, raster = NULL, ... )
seurat_object |
Seurat object name. |
highlight_color |
Color to highlight cells (default "navy"). Can provide either single color to use for all clusters/plots or a vector of colors equal to the number of clusters to use (in order) for the clusters/plots. |
background_color |
non-highlighted cell colors. |
pt.size |
point size for both highlighted cluster and background. |
reduction |
Dimensionality Reduction to use (if NULL then defaults to Object default). |
file_path |
directory file path and/or file name prefix. Defaults to current wd. |
file_name |
name suffix to append after sample name. |
file_type |
File type to save output as. Must be one of following: ".pdf", ".png", ".tiff", ".jpeg", or ".svg". |
single_pdf |
saves all plots to single PDF file (default = FALSE). 'file_type“ must be .pdf |
dpi |
dpi for image saving. |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
... |
Extra parameters passed to |
Saved plots
## Not run: Iterate_Cluster_Highlight_Plot(seurat_object = object, highlight_color = "navy", background_color = "lightgray", file_path = "path/", file_name = "name", file_type = "pdf", single_pdf = TRUE) ## End(Not run)
## Not run: Iterate_Cluster_Highlight_Plot(seurat_object = object, highlight_color = "navy", background_color = "lightgray", file_path = "path/", file_name = "name", file_type = "pdf", single_pdf = TRUE) ## End(Not run)
Iterate DimPlot by orig.ident column from Seurat object metadata
Iterate_DimPlot_bySample( seurat_object, sample_column = "orig.ident", file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, dpi = 600, color = "black", no_legend = TRUE, title_prefix = NULL, reduction = NULL, dims = c(1, 2), pt.size = NULL, raster = NULL, ... )
Iterate_DimPlot_bySample( seurat_object, sample_column = "orig.ident", file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, dpi = 600, color = "black", no_legend = TRUE, title_prefix = NULL, reduction = NULL, dims = c(1, 2), pt.size = NULL, raster = NULL, ... )
seurat_object |
Seurat object name. |
sample_column |
name of meta.data column containing sample names/ids (default is "orig.ident"). |
file_path |
directory file path and/or file name prefix. Defaults to current wd. |
file_name |
name suffix to append after sample name. |
file_type |
File type to save output as. Must be one of following: ".pdf", ".png", ".tiff", ".jpeg", or ".svg". |
single_pdf |
saves all plots to single PDF file (default = FALSE). 'file_type“ must be .pdf |
dpi |
dpi for image saving. |
color |
color scheme to use. |
no_legend |
logical, whether or not to include plot legend, default is TRUE. |
title_prefix |
Value that should be used for plot title prefix if |
reduction |
Dimensionality Reduction to use (default is object default). |
dims |
Dimensions to plot. |
pt.size |
Adjust point size for plotting. |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
... |
Extra parameters passed to |
A ggplot object
## Not run: Iterate_DimPlot_bySample(seurat_object = object, file_path = "plots/", file_name = "tsne", file_type = ".jpg", dpi = 600, color = "black") ## End(Not run)
## Not run: Iterate_DimPlot_bySample(seurat_object = object, file_path = "plots/", file_name = "tsne", file_type = ".jpg", dpi = 600, color = "black") ## End(Not run)
Create and Save plots for Gene list with Single Command
Iterate_FeaturePlot_scCustom( seurat_object, features, gene_list = deprecated(), colors_use = viridis_plasma_dark_high, na_color = "lightgray", na_cutoff = 1e-09, split.by = NULL, order = TRUE, return_plots = FALSE, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, features_per_page = 1, num_columns = NULL, landscape = TRUE, dpi = 600, pt.size = NULL, reduction = NULL, raster = NULL, alpha_exp = NULL, alpha_na_exp = NULL, ... )
Iterate_FeaturePlot_scCustom( seurat_object, features, gene_list = deprecated(), colors_use = viridis_plasma_dark_high, na_color = "lightgray", na_cutoff = 1e-09, split.by = NULL, order = TRUE, return_plots = FALSE, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, features_per_page = 1, num_columns = NULL, landscape = TRUE, dpi = 600, pt.size = NULL, reduction = NULL, raster = NULL, alpha_exp = NULL, alpha_na_exp = NULL, ... )
seurat_object |
Seurat object name. |
features |
vector of features to plot. If a named vector is provided then the names for each gene
will be incorporated into plot title if |
gene_list |
|
colors_use |
color scheme to use. |
na_color |
color for non-expressed cells. |
na_cutoff |
Value to use as minimum expression cutoff. To set no cutoff set to |
split.by |
Variable in |
order |
whether to move positive cells to the top (default = TRUE). |
return_plots |
logical. Whether to return plots to list instead of saving them to file(s). Default is FALSE. |
file_path |
directory file path and/or file name prefix. Defaults to current wd. |
file_name |
name suffix and file extension. |
file_type |
File type to save output as. Must be one of following: ".pdf", ".png", ".tiff", ".jpeg", or ".svg". |
single_pdf |
saves all plots to single PDF file (default = FALSE). |
features_per_page |
numeric, number of features to plot on single page if |
num_columns |
Number of columns in plot layout (only applicable if |
landscape |
logical, when plotting multiple features per page in single PDF whether to use landscape or portrait page dimensions (default is TRUE). |
dpi |
dpi for image saving. |
pt.size |
Adjust point size for plotting. |
reduction |
Dimensionality Reduction to use (if NULL then defaults to Object default). |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
alpha_exp |
new alpha level to apply to expressing cell color palette ( |
alpha_na_exp |
new alpha level to apply to non-expressing cell color palette ( |
... |
Extra parameters passed to |
Saved plots
## Not run: Iterate_FeaturePlot_scCustom(seurat_object = object, gene_list = DEG_list, colors_use = viridis_plasma_dark_high, na_color = "lightgray", file_path = "plots/", file_name = "tsne", file_type = ".jpg", dpi = 600) ## End(Not run)
## Not run: Iterate_FeaturePlot_scCustom(seurat_object = object, gene_list = DEG_list, colors_use = viridis_plasma_dark_high, na_color = "lightgray", file_path = "plots/", file_name = "tsne", file_type = ".jpg", dpi = 600) ## End(Not run)
Iterate the create plots with meta data variable of interest highlighted.
Iterate_Meta_Highlight_Plot( seurat_object, meta_data_column, new_meta_order = NULL, meta_data_sort = TRUE, highlight_color = "navy", background_color = "lightgray", pt.size = NULL, no_legend = FALSE, title_prefix = NULL, reduction = NULL, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, dpi = 600, raster = NULL, ... )
Iterate_Meta_Highlight_Plot( seurat_object, meta_data_column, new_meta_order = NULL, meta_data_sort = TRUE, highlight_color = "navy", background_color = "lightgray", pt.size = NULL, no_legend = FALSE, title_prefix = NULL, reduction = NULL, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, dpi = 600, raster = NULL, ... )
seurat_object |
Seurat object name. |
meta_data_column |
Name of the column in |
new_meta_order |
The order in which to plot each level within |
meta_data_sort |
logical. Whether or not to sort and relevel the levels in |
highlight_color |
Color to highlight cells (default "navy"). Can provide either single color to use for all clusters/plots or a vector of colors equal to the number of clusters to use (in order) for the clusters/plots. |
background_color |
non-highlighted cell colors. |
pt.size |
point size for both highlighted cluster and background. |
no_legend |
logical, whether or not to remove plot legend and move to plot title. Default is FALSE. |
title_prefix |
Value that should be used for plot title prefix if |
reduction |
Dimensionality Reduction to use (if NULL then defaults to Object default). |
file_path |
directory file path and/or file name prefix. Defaults to current wd. |
file_name |
name suffix to append after sample name. |
file_type |
File type to save output as. Must be one of following: ".pdf", ".png", ".tiff", ".jpeg", or ".svg". |
single_pdf |
saves all plots to single PDF file (default = FALSE). 'file_type“ must be .pdf |
dpi |
dpi for image saving. |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
... |
Extra parameters passed to |
Saved plots
## Not run: Iterate_Meta_Highlight_Plot(seurat_object = object, meta_data_column = "sample_id", highlight_color = "navy", background_color = "lightgray", file_path = "path/", file_name = "name", file_type = "pdf", single_pdf = TRUE) ## End(Not run)
## Not run: Iterate_Meta_Highlight_Plot(seurat_object = object, meta_data_column = "sample_id", highlight_color = "navy", background_color = "lightgray", file_path = "path/", file_name = "name", file_type = "pdf", single_pdf = TRUE) ## End(Not run)
Plot PC Heatmaps and Dim Loadings for exploratory analysis
Iterate_PC_Loading_Plots( seurat_object, dims_plot = NULL, file_path = NULL, name_prefix = NULL, file_name = "PC_Loading_Plots", return_plots = FALSE )
Iterate_PC_Loading_Plots( seurat_object, dims_plot = NULL, file_path = NULL, name_prefix = NULL, file_name = "PC_Loading_Plots", return_plots = FALSE )
seurat_object |
Seurat object name. |
dims_plot |
number of PCs to plot (integer). Default is all dims present in PCA. |
file_path |
directory file path to save file. |
name_prefix |
prefix for file name (optional). |
file_name |
suffix for file name. Default is "PC_Loading_Plots". |
return_plots |
Whether to return the plot list (Default is FALSE). Must assign to environment to save plot list. |
A list of plots outputted as pdf
## Not run: Iterate_PC_Loading_Plots(seurat_object = seurat, dims_plot = 25, file_path = "plots/") ## End(Not run)
## Not run: Iterate_PC_Loading_Plots(seurat_object = seurat, dims_plot = 25, file_path = "plots/") ## End(Not run)
Create and save plots for gene list with single command. Requires Nebulosa package from Bioconductor.
Iterate_Plot_Density_Custom( seurat_object, gene_list, viridis_palette = "magma", custom_palette = NULL, pt.size = 1, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, dpi = 600, reduction = NULL, combine = TRUE, joint = FALSE, ... )
Iterate_Plot_Density_Custom( seurat_object, gene_list, viridis_palette = "magma", custom_palette = NULL, pt.size = 1, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, dpi = 600, reduction = NULL, combine = TRUE, joint = FALSE, ... )
seurat_object |
Seurat object name. |
gene_list |
vector of genes to plot. If a named vector is provided then the names for each gene
will be incorporated into plot title if |
viridis_palette |
color scheme to use. |
custom_palette |
color for non-expressed cells. |
pt.size |
Adjust point size for plotting. |
file_path |
directory file path and/or file name prefix. Defaults to current wd. |
file_name |
name suffix and file extension. |
file_type |
File type to save output as. Must be one of following: ".pdf", ".png", ".tiff", ".jpeg", or ".svg". |
single_pdf |
saves all plots to single PDF file (default = FALSE). 'file_type“ must be .pdf. |
dpi |
dpi for image saving. |
reduction |
Dimensionality Reduction to use (if NULL then defaults to Object default) |
combine |
Create a single plot? If FALSE, a list with ggplot objects is returned. |
joint |
NULL. This function only supports |
... |
Extra parameters passed to |
Saved plots
## Not run: Iterate_Plot_Density_Custom(seurat_object = object, gene_list = DEG_list, viridis_palette = "magma", file_path = "plots/", file_name = "_density_plots", file_type = ".jpg", dpi = 600) ## End(Not run)
## Not run: Iterate_Plot_Density_Custom(seurat_object = object, gene_list = DEG_list, viridis_palette = "magma", file_path = "plots/", file_name = "_density_plots", file_type = ".jpg", dpi = 600) ## End(Not run)
Create and save plots for gene list with single command. Requires Nebulosa package from Bioconductor.
Iterate_Plot_Density_Joint( seurat_object, gene_list, viridis_palette = "magma", custom_palette = NULL, pt.size = 1, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, dpi = 600, reduction = NULL, combine = TRUE, joint = NULL, ... )
Iterate_Plot_Density_Joint( seurat_object, gene_list, viridis_palette = "magma", custom_palette = NULL, pt.size = 1, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, dpi = 600, reduction = NULL, combine = TRUE, joint = NULL, ... )
seurat_object |
Seurat object name. |
gene_list |
a list of vectors of genes to plot jointly. Each entry in the list will be plotted
for the joint density. All entries in list must be greater than 2 features. If a named list is provided
then the names for each list entry will be incorporated into plot title if |
viridis_palette |
color scheme to use. |
custom_palette |
color for non-expressed cells. |
pt.size |
Adjust point size for plotting. |
file_path |
directory file path and/or file name prefix. Defaults to current wd. |
file_name |
name suffix and file extension. |
file_type |
File type to save output as. Must be one of following: ".pdf", ".png", ".tiff", ".jpeg", or ".svg". |
single_pdf |
saves all plots to single PDF file (default = FALSE). 'file_type“ must be .pdf. |
dpi |
dpi for image saving. |
reduction |
Dimensionality Reduction to use (if NULL then defaults to Object default) |
combine |
Create a single plot? If FALSE, a list with ggplot objects is returned. |
joint |
NULL. This function only supports |
... |
Extra parameters passed to |
Saved plots
## Not run: Iterate_Plot_Density_Joint(seurat_object = object, gene_list = DEG_list, viridis_palette = "magma", file_path = "plots/", file_name = "joint_plots", file_type = ".jpg", dpi = 600) ## End(Not run)
## Not run: Iterate_Plot_Density_Joint(seurat_object = object, gene_list = DEG_list, viridis_palette = "magma", file_path = "plots/", file_name = "joint_plots", file_type = ".jpg", dpi = 600) ## End(Not run)
Create and Save plots for Gene list with Single Command
Iterate_VlnPlot_scCustom( seurat_object, features, gene_list = deprecated(), colors_use = NULL, pt.size = NULL, group.by = NULL, split.by = NULL, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, raster = NULL, dpi = 600, ggplot_default_colors = FALSE, color_seed = 123, ... )
Iterate_VlnPlot_scCustom( seurat_object, features, gene_list = deprecated(), colors_use = NULL, pt.size = NULL, group.by = NULL, split.by = NULL, file_path = NULL, file_name = NULL, file_type = NULL, single_pdf = FALSE, raster = NULL, dpi = 600, ggplot_default_colors = FALSE, color_seed = 123, ... )
seurat_object |
Seurat object name. |
features |
vector of features to plot. |
gene_list |
|
colors_use |
color palette to use for plotting. By default if number of levels plotted is less than
or equal to 36 it will use "polychrome" and if greater than 36 will use "varibow" with shuffle = TRUE
both from |
pt.size |
point size for plotting. |
group.by |
Name of one or more metadata columns to group (color) plot by (for example, orig.ident); default is the current active.ident of the object. |
split.by |
Feature to split plots by (i.e. "orig.ident"). |
file_path |
directory file path and/or file name prefix. Defaults to current wd. |
file_name |
name suffix and file extension. |
file_type |
File type to save output as. Must be one of following: ".pdf", ".png", ".tiff", ".jpeg", or ".svg". |
single_pdf |
saves all plots to single PDF file (default = FALSE). 'file_type“ must be .pdf. |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 total points plotted (# Cells x # of features). |
dpi |
dpi for image saving. |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
... |
Extra parameters passed to |
Saved plots
## Not run: Iterate_VlnPlot_scCustom(seurat_object = object, gene_list = DEG_list, colors = color_list, file_path = "plots/", file_name = "_vln", file_type = ".jpg", dpi = 600) ## End(Not run)
## Not run: Iterate_VlnPlot_scCustom(seurat_object = object, gene_list = DEG_list, colors = color_list, file_path = "plots/", file_name = "_vln", file_type = ".jpg", dpi = 600) ## End(Not run)
Shortcut to a specific JCO 4 color palette from ggsci package.
JCO_Four()
JCO_Four()
4 color palette from the JCO ggsci palette
Selection of colors from the JCO palette from ggsci being called through paletteer. See ggsci for more info on palettes https://CRAN.R-project.org/package=ggsci
cols <- JCO_Four() PalettePlot(pal= cols)
cols <- JCO_Four() PalettePlot(pal= cols)
Extract all unique features from LIGER object
LIGER_Features(liger_object, by_dataset = FALSE)
LIGER_Features(liger_object, by_dataset = FALSE)
liger_object |
LIGER object name. |
by_dataset |
logical, whether to return list with vector of features for each dataset in LIGER object or to return single vector of unique features across all datasets in object (default is FALSE; return vector of unique features) |
vector or list depending on by_dataset
parameter
## Not run: # return single vector of all unique features all_features <- LIGER_Features(liger_object = object, by_dataset = FALSE) # return list of vectors containing features from each individual dataset in object dataset_features <- LIGER_Features(liger_object = object, by_dataset = TRUE) ## End(Not run)
## Not run: # return single vector of all unique features all_features <- LIGER_Features(liger_object = object, by_dataset = FALSE) # return list of vectors containing features from each individual dataset in object dataset_features <- LIGER_Features(liger_object = object, by_dataset = TRUE) ## End(Not run)
Merges raw.data and scale.data of object, and creates Seurat object with these values along with tsne.coords, iNMF factorization, and cluster assignments. Supports Seurat V2 and V3.
Liger_to_Seurat( liger_object, nms = names(liger_object@H), renormalize = TRUE, use.liger.genes = TRUE, by.dataset = FALSE, keep_meta = TRUE, reduction_label = "UMAP", seurat_assay = "RNA", assay_type = NULL, add_barcode_names = FALSE, barcode_prefix = TRUE, barcode_cell_id_delimiter = "_" )
Liger_to_Seurat( liger_object, nms = names(liger_object@H), renormalize = TRUE, use.liger.genes = TRUE, by.dataset = FALSE, keep_meta = TRUE, reduction_label = "UMAP", seurat_assay = "RNA", assay_type = NULL, add_barcode_names = FALSE, barcode_prefix = TRUE, barcode_cell_id_delimiter = "_" )
liger_object |
|
nms |
By default, labels cell names with dataset of origin (this is to account for cells in different datasets which may have same name). Other names can be passed here as vector, must have same length as the number of datasets. (default names(H)). |
renormalize |
Whether to log-normalize raw data using Seurat defaults (default TRUE). |
use.liger.genes |
Whether to carry over variable genes (default TRUE). |
by.dataset |
Include dataset of origin in cluster identity in Seurat object (default FALSE). |
keep_meta |
logical. Whether to transfer additional metadata (nGene/nUMI/dataset already transferred) to new Seurat Object. Default is TRUE. |
reduction_label |
Name of dimensionality reduction technique used. Enables accurate transfer or name to Seurat object instead of defaulting to "tSNE". |
seurat_assay |
Name to set for assay in Seurat Object. Default is "RNA". |
assay_type |
what type of Seurat assay to create in new object (Assay vs Assay5).
Default is NULL which will default to the current user settings.
See |
add_barcode_names |
logical, whether to add dataset names to the cell barcodes when creating Seurat object, default is FALSE. |
barcode_prefix |
logical, if |
barcode_cell_id_delimiter |
The delimiter to use when adding dataset id to barcode prefix/suffix. Default is "_". |
Stores original dataset identity by default in new object metadata if dataset names are passed in nms. iNMF factorization is stored in dim.reduction object with key "iNMF".
Seurat object with raw.data, scale.data, reduction_label, iNMF, and ident slots set.
Original function is part of LIGER package https://github.com/welch-lab/liger (Licence: GPL-3). Function was slightly modified for use in scCustomize with keep.meta parameter. Also posted as PR to liger GitHub.
## Not run: seurat_object <- Liger_to_Seurat(liger_object = LIGER_OBJ, reduction_label = "UMAP") ## End(Not run)
## Not run: seurat_object <- Liger_to_Seurat(liger_object = LIGER_OBJ, reduction_label = "UMAP") ## End(Not run)
Get quick values for X x median absolute deviation for Genes, UMIs, %mito per cell grouped by meta.data variable.
MAD_Stats( seurat_object, group_by_var = "orig.ident", default_var = TRUE, mad_var = NULL, mad_num = 2 )
MAD_Stats( seurat_object, group_by_var = "orig.ident", default_var = TRUE, mad_var = NULL, mad_num = 2 )
seurat_object |
Seurat object name. |
group_by_var |
Column in meta.data slot to group results by (default = "orig.ident"). |
default_var |
logical. Whether to include the default meta.data variables of: "nCount_RNA",
"nFeature_RNA", "percent_mito", "percent_ribo", "percent_mito_ribo", and "log10GenesPerUMI"
in addition to variables supplied to |
mad_var |
Column(s) in |
mad_num |
integer value to multiply the MAD in returned data.frame (default is 2). Often helpful when calculating a outlier range to base of of median + (X*MAD). |
A data.frame.
## Not run: mad_stats <- MAD_Stats(seurat_object = obj, group_by_var = "orig.ident") ## End(Not run)
## Not run: mad_stats <- MAD_Stats(seurat_object = obj, group_by_var = "orig.ident") ## End(Not run)
Get quick values for median Genes, UMIs, %mito per cell grouped by meta.data variable.
Median_Stats( seurat_object, group_by_var = "orig.ident", default_var = TRUE, median_var = NULL )
Median_Stats( seurat_object, group_by_var = "orig.ident", default_var = TRUE, median_var = NULL )
seurat_object |
Seurat object name. |
group_by_var |
Column in meta.data slot to group results by (default = "orig.ident"). |
default_var |
logical. Whether to include the default meta.data variables of: "nCount_RNA",
"nFeature_RNA", "percent_mito", "percent_ribo", "percent_mito_ribo", and "log10GenesPerUMI"
in addition to variables supplied to |
median_var |
Column(s) in |
A data.frame.
## Not run: med_stats <- Median_Stats(seurat_object - obj, group_by_var = "orig.ident") ## End(Not run)
## Not run: med_stats <- Median_Stats(seurat_object - obj, group_by_var = "orig.ident") ## End(Not run)
Enables easy merge of a list of Seurat Objects. See See merge
for more information,
Merge_Seurat_List( list_seurat, add.cell.ids = NULL, merge.data = TRUE, project = "SeuratProject" )
Merge_Seurat_List( list_seurat, add.cell.ids = NULL, merge.data = TRUE, project = "SeuratProject" )
list_seurat |
list composed of multiple Seurat Objects. |
add.cell.ids |
A character vector of equal length to the number of objects in |
merge.data |
Merge the data slots instead of just merging the counts (which requires renormalization).
This is recommended if the same normalization approach was applied to all objects.
See |
project |
Project name for the Seurat object. See |
A Seurat Object
## Not run: object_list <- list(obj1, obj2, obj3, ...) merged_object <- Merge_Seurat_List(list_seurat = object_list) ## End(Not run)
## Not run: object_list <- list(obj1, obj2, obj3, ...) merged_object <- Merge_Seurat_List(list_seurat = object_list) ## End(Not run)
Enables easy merge of a list of sparse matrices
Merge_Sparse_Data_All( matrix_list, add_cell_ids = NULL, prefix = TRUE, cell_id_delimiter = "_" )
Merge_Sparse_Data_All( matrix_list, add_cell_ids = NULL, prefix = TRUE, cell_id_delimiter = "_" )
matrix_list |
list of matrices to merge. |
add_cell_ids |
a vector of sample ids to add as prefix to cell barcode during merge. |
prefix |
logical. Whether |
cell_id_delimiter |
The delimiter to use when adding cell id prefix/suffix. Default is "_". |
A sparse Matrix
Original function is part of LIGER package as non-exported function https://github.com/welch-lab/liger/blob/master/R/utilities.R (License: GPL-3). Function was modified for use in scCustomize (add progress bar, prefix vs. suffix, and delimiter options).
## Not run: data_list <- Read10X_GEO(...) merged <- Merge_Sparse_Data_All(matrix_list = data_list, add_cell_ids = names(data_list), prefix = TRUE, cell_id_delimiter = "_") ## End(Not run)
## Not run: data_list <- Read10X_GEO(...) merged <- Merge_Sparse_Data_All(matrix_list = data_list, add_cell_ids = names(data_list), prefix = TRUE, cell_id_delimiter = "_") ## End(Not run)
Enables easy merge of a list of sparse matrices for multi-modal data.
Merge_Sparse_Multimodal_All( matrix_list, add_cell_ids = NULL, prefix = TRUE, cell_id_delimiter = "_" )
Merge_Sparse_Multimodal_All( matrix_list, add_cell_ids = NULL, prefix = TRUE, cell_id_delimiter = "_" )
matrix_list |
list of matrices to merge. |
add_cell_ids |
a vector of sample ids to add as prefix to cell barcode during merge. |
prefix |
logical. Whether |
cell_id_delimiter |
The delimiter to use when adding cell id prefix/suffix. Default is "_". |
A list containing one sparse matrix for each modality
## Not run: data_list <- Read10X_GEO(...) merged_list <- Merge_Sparse_Multimodal_All(matrix_list = data_list, add_cell_ids = names(data_list), prefix = TRUE, cell_id_delimiter = "_") ## End(Not run)
## Not run: data_list <- Read10X_GEO(...) merged_list <- Merge_Sparse_Multimodal_All(matrix_list = data_list, add_cell_ids = names(data_list), prefix = TRUE, cell_id_delimiter = "_") ## End(Not run)
Create Plot with meta data variable of interest highlighted
Meta_Highlight_Plot( seurat_object, meta_data_column, meta_data_highlight, highlight_color = NULL, background_color = "lightgray", pt.size = NULL, aspect_ratio = NULL, figure_plot = FALSE, raster = NULL, raster.dpi = c(512, 512), label = FALSE, split.by = NULL, split_seurat = FALSE, ggplot_default_colors = FALSE, ... )
Meta_Highlight_Plot( seurat_object, meta_data_column, meta_data_highlight, highlight_color = NULL, background_color = "lightgray", pt.size = NULL, aspect_ratio = NULL, figure_plot = FALSE, raster = NULL, raster.dpi = c(512, 512), label = FALSE, split.by = NULL, split_seurat = FALSE, ggplot_default_colors = FALSE, ... )
seurat_object |
Seurat object name. |
meta_data_column |
Name of the column in |
meta_data_highlight |
Name of variable(s) within |
highlight_color |
Color to highlight cells (default "navy"). |
background_color |
non-highlighted cell colors. |
pt.size |
point size for both highlighted cluster and background. |
aspect_ratio |
Control the aspect ratio (y:x axes ratio length). Must be numeric value; Default is NULL. |
figure_plot |
logical. Whether to remove the axes and plot with legend on left of plot denoting
axes labels. (Default is FALSE). Requires |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
label |
Whether to label the highlighted meta data variable(s). Default is FALSE. |
split.by |
Variable in |
split_seurat |
logical. Whether or not to display split plots like Seurat (shared y axis) or as individual plots in layout. Default is FALSE. |
ggplot_default_colors |
logical. If |
... |
Extra parameters passed to |
A ggplot object
library(Seurat) pbmc_small$sample_id <- sample(c("sample1", "sample2"), size = ncol(pbmc_small), replace = TRUE) Meta_Highlight_Plot(seurat_object = pbmc_small, meta_data_column = "sample_id", meta_data_highlight = "sample1", highlight_color = "gold", background_color = "lightgray", pt.size = 2)
library(Seurat) pbmc_small$sample_id <- sample(c("sample1", "sample2"), size = ncol(pbmc_small), replace = TRUE) Meta_Highlight_Plot(seurat_object = pbmc_small, meta_data_column = "sample_id", meta_data_highlight = "sample1", highlight_color = "gold", background_color = "lightgray", pt.size = 2)
Check if any present meta data columns are numeric and returns vector of valid numeric columns. Issues warning message if any columns not in numeric form.
Meta_Numeric(data)
Meta_Numeric(data)
data |
a data.frame contain meta.data. |
vector of meta data columns that are numeric.
## Not run: numeric_meta_columns <- Meta_Numeric(data = meta_data) ## End(Not run)
## Not run: numeric_meta_columns <- Meta_Numeric(data = meta_data) ## End(Not run)
Check if meta data columns are present in object and return vector of found columns Return warning messages for meta data columns not found.
Meta_Present( object, seurat_object = deprecated(), meta_col_names, print_msg = TRUE, omit_warn = TRUE, return_none = FALSE )
Meta_Present( object, seurat_object = deprecated(), meta_col_names, print_msg = TRUE, omit_warn = TRUE, return_none = FALSE )
object |
Seurat or Liger object name. |
seurat_object |
|
meta_col_names |
vector of column names to check. |
print_msg |
logical. Whether message should be printed if all features are found. Default is TRUE. |
omit_warn |
logical. Whether to print message about features that are not found in current object. Default is TRUE. |
return_none |
logical. Whether list of found vs. bad features should still be returned if no
|
vector of meta data columns that are present
## Not run: meta_variables <- Meta_Present(object = obj_name, meta_col_names = "percent_mito", print_msg = TRUE) ## End(Not run)
## Not run: meta_variables <- Meta_Present(object = obj_name, meta_col_names = "percent_mito", print_msg = TRUE) ## End(Not run)
Remove any columns from new meta_data data.frame in preparation for adding back to Seurat Object
Meta_Remove_Seurat( meta_data, seurat_object, barcodes_to_rownames = FALSE, barcodes_colname = "barcodes" )
Meta_Remove_Seurat( meta_data, seurat_object, barcodes_to_rownames = FALSE, barcodes_colname = "barcodes" )
meta_data |
data.frame containing meta data. |
seurat_object |
object name. |
barcodes_to_rownames |
logical, are barcodes present as column and should they be moved to
rownames (to be compatible with |
barcodes_colname |
name of barcodes column in meta_data. Required if |
data.frame with only new columns.
## Not run: new_meta <- Meta_Remove_Seurat(meta_data = meta_data_df, seurat_object = object) object <- AddMetaData(object = object, metadata = new_meta) ## End(Not run)
## Not run: new_meta <- Meta_Remove_Seurat(meta_data = meta_data_df, seurat_object = object) object <- AddMetaData(object = object, metadata = new_meta) ## End(Not run)
Shortcut for thematic modification to move legend position.
Move_Legend(position = "right", ...)
Move_Legend(position = "right", ...)
position |
valid position to move legend. Default is "right". |
... |
extra arguments passed to |
Returns a list-like object of class theme.
# Generate a plot and customize theme library(ggplot2) df <- data.frame(x = rnorm(n = 100, mean = 20, sd = 2), y = rbinom(n = 100, size = 100, prob = 0.2)) p <- ggplot(data = df, mapping = aes(x = x, y = y)) + geom_point(mapping = aes(color = 'red')) p + Move_Legend("left")
# Generate a plot and customize theme library(ggplot2) df <- data.frame(x = rnorm(n = 100, mean = 20, sd = 2), y = rbinom(n = 100, size = 100, prob = 0.2)) p <- ggplot(data = df, mapping = aes(x = x, y = y)) + geom_point(mapping = aes(color = 'red')) p + Move_Legend("left")
Gene symbols for qc percentages from MSigDB database. The gene sets are from 3 MSigDB lists: "HALLMARK_OXIDATIVE_PHOSPHORYLATION", "HALLMARK_APOPTOSIS", and "HALLMARK_DNA_REPAIR".
msigdb_qc_gene_list
msigdb_qc_gene_list
A list of 18 vectors
Genes in msigdb "HALLMARK_OXIDATIVE_PHOSPHORYLATION" list for human
Genes in msigdb "HALLMARK_APOPTOSIS" list for human
Genes in msigdb "HALLMARK_DNA_REPAIR" list for human
Genes in msigdb "HALLMARK_OXIDATIVE_PHOSPHORYLATION" list for mouse
Genes in msigdb "HALLMARK_APOPTOSIS" list for mouse
Genes in msigdb "HALLMARK_DNA_REPAIR" list for mouse
Genes in msigdb "HALLMARK_OXIDATIVE_PHOSPHORYLATION" list for rat
Genes in msigdb "HALLMARK_APOPTOSIS" list for rat
Genes in msigdb "HALLMARK_DNA_REPAIR" list for rat
Genes in msigdb "HALLMARK_OXIDATIVE_PHOSPHORYLATION" list for fly
Genes in msigdb "HALLMARK_APOPTOSIS" list for fly
Genes in msigdb "HALLMARK_DNA_REPAIR" list for fly
Genes in msigdb "HALLMARK_OXIDATIVE_PHOSPHORYLATION" list for zebrafish
Genes in msigdb "HALLMARK_APOPTOSIS" list for zebrafish
Genes in msigdb "HALLMARK_DNA_REPAIR" list for zebrafish
Genes in msigdb "HALLMARK_OXIDATIVE_PHOSPHORYLATION" list for macaque
Genes in msigdb "HALLMARK_APOPTOSIS" list for macaque
Genes in msigdb "HALLMARK_DNA_REPAIR" list for macaque
MSigDB gene sets via msigdbr package https://cran.r-project.org/package=msigdbr
Plots given color vector/palette in viewer to evaluate palette before plotting on data.
PalettePlot(pal = NULL, label_color_num = NULL)
PalettePlot(pal = NULL, label_color_num = NULL)
pal |
a vector of colors (either named colors of hex codes). |
label_color_num |
logical, whether or not to numerically label the colors in output plot.
Default is TRUE is number of colors in |
Plot of all colors in supplied palette/vector
Adapted from colorway package build_palette
internals (License: GPL-3).
https://github.com/hypercompetent/colorway.
pal <- DiscretePalette_scCustomize(num_colors = 36, palette = "varibow") PalettePlot(pal = pal)
pal <- DiscretePalette_scCustomize(num_colors = 36, palette = "varibow") PalettePlot(pal = pal)
Plot PC Heatmaps and Dim Loadings for exploratory analysis. Plots a single Heatmap and Gene Loading Plot. Used for PC_Loading_Plots function.
PC_Plotting(seurat_object, dim_number)
PC_Plotting(seurat_object, dim_number)
seurat_object |
Seurat Object. |
dim_number |
A single dim to plot (integer). |
A plot of PC heatmap and gene loadings for single
library(Seurat) PC_Plotting(seurat_object = pbmc_small, dim_number = 1)
library(Seurat) PC_Plotting(seurat_object = pbmc_small, dim_number = 1)
Calculates the percent of cells that express a given set of features by various grouping factors
Percent_Expressing( seurat_object, features, threshold = 0, group_by = NULL, split_by = NULL, entire_object = FALSE, slot = deprecated(), layer = "data", assay = NULL )
Percent_Expressing( seurat_object, features, threshold = 0, group_by = NULL, split_by = NULL, entire_object = FALSE, slot = deprecated(), layer = "data", assay = NULL )
seurat_object |
Seurat object name. |
features |
Feature(s) to plot. |
threshold |
Expression threshold to use for calculation of percent expressing (default is 0). |
group_by |
Factor to group the cells by. |
split_by |
Factor to split the groups by. |
entire_object |
logical (default = FALSE). Whether to calculate percent of expressing cells
across the entire object as opposed to by cluster or by |
slot |
|
layer |
Which layer to pull expression data from? Default is "data". |
assay |
Assay to pull feature data from. Default is active assay. |
A data.frame
Part of code is modified from Seurat package as used by DotPlot
to generate values to use for plotting. Source code can be found here:
https://github.com/satijalab/seurat/blob/4e868fcde49dc0a3df47f94f5fb54a421bfdf7bc/R/visualization.R#L3391 (License: GPL-3).
## Not run: percent_stats <- Percent_Expressing(seurat_object = object, features = "Cx3cr1", threshold = 0) ## End(Not run)
## Not run: percent_stats <- Percent_Expressing(seurat_object = object, features = "Cx3cr1", threshold = 0) ## End(Not run)
Plot of total cell or nuclei number per sample grouped by another meta data variable.
Plot_Cells_per_Sample( seurat_object, sample_col = "orig.ident", group_by = NULL, colors_use = NULL, dot_size = 1, plot_title = "Cells/Nuclei per Sample", y_axis_label = "Number of Cells", x_axis_label = NULL, legend_title = NULL, x_lab_rotate = TRUE, color_seed = 123 )
Plot_Cells_per_Sample( seurat_object, sample_col = "orig.ident", group_by = NULL, colors_use = NULL, dot_size = 1, plot_title = "Cells/Nuclei per Sample", y_axis_label = "Number of Cells", x_axis_label = NULL, legend_title = NULL, x_lab_rotate = TRUE, color_seed = 123 )
seurat_object |
Seurat object name. |
sample_col |
Specify which column in meta.data specifies sample ID (i.e. orig.ident). |
group_by |
Column in meta.data slot to group results by (i.e. "Treatment"). |
colors_use |
List of colors or color palette to use. |
dot_size |
size of the dots plotted if |
plot_title |
Plot title. |
y_axis_label |
Label for y axis. |
x_axis_label |
Label for x axis. |
legend_title |
Label for plot legend. |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
color_seed |
random seed for the "varibow" palette shuffle if |
A ggplot object
## Not run: Plot_Cells_per_Sample(seurat_object = obj, sample_col = "orig.ident", group_by = "Treatment") ## End(Not run)
## Not run: Plot_Cells_per_Sample(seurat_object = obj, sample_col = "orig.ident", group_by = "Treatment") ## End(Not run)
Allow for customization of Nebulosa plot_density. Requires Nebulosa package from Bioconductor.
Plot_Density_Custom( seurat_object, features, joint = FALSE, viridis_palette = "magma", custom_palette = NULL, pt.size = 1, aspect_ratio = NULL, reduction = NULL, combine = TRUE, ... )
Plot_Density_Custom( seurat_object, features, joint = FALSE, viridis_palette = "magma", custom_palette = NULL, pt.size = 1, aspect_ratio = NULL, reduction = NULL, combine = TRUE, ... )
seurat_object |
Seurat object name. |
features |
Features to plot. |
joint |
logical. Whether to return joint density plot. Default is FALSE. |
viridis_palette |
default viridis palette to use (must be one of: "viridis", "magma", "cividis", "inferno", "plasma"). Default is "magma". |
custom_palette |
non-default color palette to be used in place of default viridis options. |
pt.size |
Adjust point size for plotting. |
aspect_ratio |
Control the aspect ratio (y:x axes ratio length). Must be numeric value; Default is NULL. |
reduction |
Dimensionality Reduction to use (if NULL then defaults to Object default). |
combine |
Create a single plot? If FALSE, a list with ggplot objects is returned. |
... |
Extra parameters passed to |
A ggplot object
## Not run: library(Seurat) Plot_Density_Custom(seurat_object = pbmc_small, features = "CD3E") ## End(Not run)
## Not run: library(Seurat) Plot_Density_Custom(seurat_object = pbmc_small, features = "CD3E") ## End(Not run)
Return only the joint density plot from Nebulosa plot_density function. Requires Nebulosa package from Bioconductor.
Plot_Density_Joint_Only( seurat_object, features, viridis_palette = "magma", custom_palette = NULL, pt.size = 1, aspect_ratio = NULL, reduction = NULL, ... )
Plot_Density_Joint_Only( seurat_object, features, viridis_palette = "magma", custom_palette = NULL, pt.size = 1, aspect_ratio = NULL, reduction = NULL, ... )
seurat_object |
Seurat object name. |
features |
Features to plot. |
viridis_palette |
default viridis palette to use (must be one of: "viridis", "magma", "cividis", "inferno", "plasma"). Default is "magma". |
custom_palette |
non-default color palette to be used in place of default viridis options. |
pt.size |
Adjust point size for plotting. |
aspect_ratio |
Control the aspect ratio (y:x axes ratio length). Must be numeric value; Default is NULL. |
reduction |
Dimensionality Reduction to use (if NULL then defaults to Object default). |
... |
Extra parameters passed to |
A ggplot object
## Not run: library(Seurat) Plot_Density_Joint_Only(seurat_object = pbmc_small, features = c("CD8A", "CD3E")) ## End(Not run)
## Not run: library(Seurat) Plot_Density_Joint_Only(seurat_object = pbmc_small, features = c("CD8A", "CD3E")) ## End(Not run)
Plot of median genes per cell per sample grouped by desired meta data variable.
Plot_Median_Genes( seurat_object, sample_col = "orig.ident", group_by = NULL, colors_use = NULL, dot_size = 1, plot_title = "Median Genes/Cell per Sample", y_axis_label = "Median Genes", x_axis_label = NULL, legend_title = NULL, x_lab_rotate = TRUE, color_seed = 123 )
Plot_Median_Genes( seurat_object, sample_col = "orig.ident", group_by = NULL, colors_use = NULL, dot_size = 1, plot_title = "Median Genes/Cell per Sample", y_axis_label = "Median Genes", x_axis_label = NULL, legend_title = NULL, x_lab_rotate = TRUE, color_seed = 123 )
seurat_object |
Seurat object name. |
sample_col |
Specify which column in meta.data specifies sample ID (i.e. orig.ident). |
group_by |
Column in meta.data slot to group results by (i.e. "Treatment"). |
colors_use |
List of colors or color palette to use. Only applicable if |
dot_size |
size of the dots plotted if |
plot_title |
Plot title. |
y_axis_label |
Label for y axis. |
x_axis_label |
Label for x axis. |
legend_title |
Label for plot legend. |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
color_seed |
random seed for the "varibow" palette shuffle if |
A ggplot object
library(Seurat) # Create example groups pbmc_small$sample_id <- sample(c("sample1", "sample2"), size = ncol(pbmc_small), replace = TRUE) # Plot Plot_Median_Genes(seurat_object = pbmc_small, sample_col = "orig.ident", group_by = "sample_id")
library(Seurat) # Create example groups pbmc_small$sample_id <- sample(c("sample1", "sample2"), size = ncol(pbmc_small), replace = TRUE) # Plot Plot_Median_Genes(seurat_object = pbmc_small, sample_col = "orig.ident", group_by = "sample_id")
Plot of median percent mito per cell per sample grouped by desired meta data variable.
Plot_Median_Mito( seurat_object, sample_col = "orig.ident", group_by = NULL, colors_use = NULL, dot_size = 1, plot_title = "Median % Mito per Sample", y_axis_label = "Percent Mitochondrial Reads", x_axis_label = NULL, legend_title = NULL, x_lab_rotate = TRUE, color_seed = 123 )
Plot_Median_Mito( seurat_object, sample_col = "orig.ident", group_by = NULL, colors_use = NULL, dot_size = 1, plot_title = "Median % Mito per Sample", y_axis_label = "Percent Mitochondrial Reads", x_axis_label = NULL, legend_title = NULL, x_lab_rotate = TRUE, color_seed = 123 )
seurat_object |
Seurat object name. |
sample_col |
Specify which column in meta.data specifies sample ID (i.e. orig.ident). |
group_by |
Column in meta.data slot to group results by (i.e. "Treatment"). |
colors_use |
List of colors or color palette to use. Only applicable if |
dot_size |
size of the dots plotted if |
plot_title |
Plot title. |
y_axis_label |
Label for y axis. |
x_axis_label |
Label for x axis. |
legend_title |
Label for plot legend. |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
color_seed |
random seed for the "varibow" palette shuffle if |
A ggplot object
## Not run: # Add mito obj <- Add_Mito_Ribo_Seurat(seurat_object = obj, species = "human") # Plot Plot_Median_Mito(seurat_object = obj, sample_col = "orig.ident", group_by = "sample_id") ## End(Not run)
## Not run: # Add mito obj <- Add_Mito_Ribo_Seurat(seurat_object = obj, species = "human") # Plot Plot_Median_Mito(seurat_object = obj, sample_col = "orig.ident", group_by = "sample_id") ## End(Not run)
Plot of median other variable per cell per sample grouped by desired meta data variable.
Plot_Median_Other( seurat_object, median_var, sample_col = "orig.ident", group_by = NULL, colors_use = NULL, dot_size = 1, plot_title = NULL, y_axis_label = NULL, x_axis_label = NULL, legend_title = NULL, x_lab_rotate = TRUE, color_seed = 123 )
Plot_Median_Other( seurat_object, median_var, sample_col = "orig.ident", group_by = NULL, colors_use = NULL, dot_size = 1, plot_title = NULL, y_axis_label = NULL, x_axis_label = NULL, legend_title = NULL, x_lab_rotate = TRUE, color_seed = 123 )
seurat_object |
Seurat object name. |
median_var |
Variable in meta.data slot to calculate and plot median values for. |
sample_col |
Specify which column in meta.data specifies sample ID (i.e. orig.ident). |
group_by |
Column in meta.data slot to group results by (i.e. "Treatment"). |
colors_use |
List of colors or color palette to use. Only applicable if |
dot_size |
size of the dots plotted if |
plot_title |
Plot title. |
y_axis_label |
Label for y axis. |
x_axis_label |
Label for x axis. |
legend_title |
Label for plot legend. |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
color_seed |
random seed for the "varibow" palette shuffle if |
A ggplot object
## Not run: library(Seurat) cd_features <- list(c('CD79B', 'CD79A', 'CD19', 'CD180', 'CD200', 'CD3D', 'CD2','CD3E', 'CD7','CD8A', 'CD14', 'CD1C', 'CD68', 'CD9', 'CD247')) pbmc_small <- AddModuleScore(object = pbmc_small, features = cd_features, ctrl = 5, name = 'CD_Features') Plot_Median_Other(seurat_object = pbmc_small, median_var = "CD_Features1", sample_col = "orig.ident", group_by = "Treatment") ## End(Not run)
## Not run: library(Seurat) cd_features <- list(c('CD79B', 'CD79A', 'CD19', 'CD180', 'CD200', 'CD3D', 'CD2','CD3E', 'CD7','CD8A', 'CD14', 'CD1C', 'CD68', 'CD9', 'CD247')) pbmc_small <- AddModuleScore(object = pbmc_small, features = cd_features, ctrl = 5, name = 'CD_Features') Plot_Median_Other(seurat_object = pbmc_small, median_var = "CD_Features1", sample_col = "orig.ident", group_by = "Treatment") ## End(Not run)
Plot of median UMIs per cell per sample grouped by desired meta data variable.
Plot_Median_UMIs( seurat_object, sample_col = "orig.ident", group_by = NULL, colors_use = NULL, dot_size = 1, plot_title = "Median UMIs/Cell per Sample", y_axis_label = "Median UMIs", x_axis_label = NULL, legend_title = NULL, x_lab_rotate = TRUE, color_seed = 123 )
Plot_Median_UMIs( seurat_object, sample_col = "orig.ident", group_by = NULL, colors_use = NULL, dot_size = 1, plot_title = "Median UMIs/Cell per Sample", y_axis_label = "Median UMIs", x_axis_label = NULL, legend_title = NULL, x_lab_rotate = TRUE, color_seed = 123 )
seurat_object |
Seurat object name. |
sample_col |
Specify which column in meta.data specifies sample ID (i.e. orig.ident). |
group_by |
Column in meta.data slot to group results by (i.e. "Treatment"). |
colors_use |
List of colors or color palette to use. Only applicable if |
dot_size |
size of the dots plotted if |
plot_title |
Plot title. |
y_axis_label |
Label for y axis. |
x_axis_label |
Label for x axis. |
legend_title |
Label for plot legend. |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
color_seed |
random seed for the "varibow" palette shuffle if |
A ggplot object
library(Seurat) # Create example groups pbmc_small$sample_id <- sample(c("sample1", "sample2"), size = ncol(pbmc_small), replace = TRUE) # Plot Plot_Median_UMIs(seurat_object = pbmc_small, sample_col = "orig.ident", group_by = "sample_id")
library(Seurat) # Create example groups pbmc_small$sample_id <- sample(c("sample1", "sample2"), size = ncol(pbmc_small), replace = TRUE) # Plot Plot_Median_UMIs(seurat_object = pbmc_small, sample_col = "orig.ident", group_by = "sample_id")
Modified and optimized version of plotFactors
function from LIGER package.
plotFactors_scCustom( liger_object, num_genes = 8, colors_use_factors = NULL, colors_use_dimreduc = c("lemonchiffon", "red"), pt.size_factors = 1, pt.size_dimreduc = 1, reduction_label = "UMAP", plot_legend = TRUE, raster = TRUE, raster.dpi = c(512, 512), order = FALSE, plot_dimreduc = TRUE, save_plots = TRUE, file_path = NULL, file_name = NULL, return_plots = FALSE, cells.highlight = NULL, reorder_datasets = NULL, ggplot_default_colors = FALSE, color_seed = 123 )
plotFactors_scCustom( liger_object, num_genes = 8, colors_use_factors = NULL, colors_use_dimreduc = c("lemonchiffon", "red"), pt.size_factors = 1, pt.size_dimreduc = 1, reduction_label = "UMAP", plot_legend = TRUE, raster = TRUE, raster.dpi = c(512, 512), order = FALSE, plot_dimreduc = TRUE, save_plots = TRUE, file_path = NULL, file_name = NULL, return_plots = FALSE, cells.highlight = NULL, reorder_datasets = NULL, ggplot_default_colors = FALSE, color_seed = 123 )
liger_object |
|
num_genes |
Number of genes to display for each factor (Default 8). |
colors_use_factors |
colors to use for plotting factor loadings By default datasets will be
plotted using "varibow" with shuffle = TRUE from both from |
colors_use_dimreduc |
colors to use for plotting factor loadings on dimensionality reduction coordinates (tSNE/UMAP). Default is c('lemonchiffon', 'red'), |
pt.size_factors |
Adjust point size for plotting in the factor plots. |
pt.size_dimreduc |
Adjust point size for plotting in dimensionality reduction plots. |
reduction_label |
What to label the x and y axes of resulting plots. LIGER does not store name of technique and therefore needs to be set manually. Default is "UMAP". |
plot_legend |
logical, whether to plot the legend on factor loading plots, default is TRUE. Helpful if number of datasets is large to avoid crowding the plot with legend. |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 200,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
order |
logical. Whether to plot higher loading cells on top of cells with lower loading values in the dimensionality reduction plots (Default = FALSE). |
plot_dimreduc |
logical. Whether to plot factor loadings on dimensionality reduction coordinates. Default is TRUE. |
save_plots |
logical. Whether to save plots. Default is TRUE |
file_path |
directory file path and/or file name prefix. Defaults to current wd. |
file_name |
name suffix to append after sample name. |
return_plots |
logical. Whether or not to return plots to the environment. (Default is FALSE) |
cells.highlight |
Names of specific cells to highlight in plot (black) (default NULL). |
reorder_datasets |
New order to plot datasets in for the factor plots if different from current factor level order in cell.data slot. |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the palette shuffle if |
A list of ggplot/patchwork objects and/or PDF file.
Velina Kozareva (Original code for modified function), Sam Marsh (Added/modified functionality)
Based on plotFactors
functionality from original LIGER package.
## Not run: plotFactors_scCustom(liger_object = liger_obj, return_plots = FALSE, plot_dimreduc = TRUE, raster = FALSE, save_plots = TRUE) ## End(Not run)
## Not run: plotFactors_scCustom(liger_object = liger_obj, return_plots = FALSE, plot_dimreduc = TRUE, raster = FALSE, save_plots = TRUE) ## End(Not run)
shortcut filter and pull function compatible with annotation files created by Create_Cluster_Annotation_File
by default but also any other csv file.
Pull_Cluster_Annotation( annotation = NULL, cluster_name_col = "cluster", cell_type_col = "cell_type" )
Pull_Cluster_Annotation( annotation = NULL, cluster_name_col = "cluster", cell_type_col = "cell_type" )
annotation |
name of the data.frame/tibble or path to CSV file containing cluster annotation. |
cluster_name_col |
name of column containing cluster names/numbers (default is "cluster"). |
cell_type_col |
name of column contain the cell type annotation (default is "cell_type"). |
a list of named vectors for every cell type in the cell_type_col
column of the annotation table and
vectors new cluster names (for use with Rename_Clusters
function or manual identity renaming).
## Not run: # If pulling from a data.frame/tibble cluster_annotation <- Pull_Cluster_Annotation(annotation = annotation_df, cluster_name_col = "cluster", cell_type_col = "cell_type") # If pulling from csv file cluster_annotation <- Pull_Cluster_Annotation(annotation = "file_path/file_name.csv", cluster_name_col = "cluster", cell_type_col = "cell_type") ## End(Not run)
## Not run: # If pulling from a data.frame/tibble cluster_annotation <- Pull_Cluster_Annotation(annotation = annotation_df, cluster_name_col = "cluster", cell_type_col = "cell_type") # If pulling from csv file cluster_annotation <- Pull_Cluster_Annotation(annotation = "file_path/file_name.csv", cluster_name_col = "cluster", cell_type_col = "cell_type") ## End(Not run)
Enables easy listing of all sub-directories for use as input library lists in Read10X multi functions.
Pull_Directory_List(base_path)
Pull_Directory_List(base_path)
base_path |
path to the parent directory which contains all of the subdirectories of interest. |
A vector of sub-directories within base_path
.
## Not run: data_dir <- 'path/to/data/directory' library_list <- Pull_Directory_List(base_path = data_dir) ## End(Not run)
## Not run: data_dir <- 'path/to/data/directory' library_list <- Pull_Directory_List(base_path = data_dir) ## End(Not run)
Custom histogram for initial QC checks including lines for thresholding
QC_Histogram( seurat_object, features, low_cutoff = NULL, high_cutoff = NULL, split.by = NULL, bins = 250, colors_use = "dodgerblue", num_columns = NULL, plot_title = NULL, assay = NULL, print_defaults = FALSE )
QC_Histogram( seurat_object, features, low_cutoff = NULL, high_cutoff = NULL, split.by = NULL, bins = 250, colors_use = "dodgerblue", num_columns = NULL, plot_title = NULL, assay = NULL, print_defaults = FALSE )
seurat_object |
Seurat object name. |
features |
Feature from meta.data, assay features, or feature name shortcut to plot. |
low_cutoff |
Plot line a potential low threshold for filtering. |
high_cutoff |
Plot line a potential high threshold for filtering. |
split.by |
Feature to split plots by (i.e. "orig.ident"). |
bins |
number of bins to plot default is 250. |
colors_use |
color to fill histogram bars, default is "dodgerblue". |
num_columns |
Number of columns in plot layout. |
plot_title |
optional, vector to use for plot title. Default is the name of the variable being plotted. |
assay |
assay to pull features from, default is active assay. |
print_defaults |
return list of accepted default shortcuts to provide to |
A patchwork object
## Not run: QC_Histogram(seurat_object = object, features = "nFeature_RNA") ## End(Not run)
## Not run: QC_Histogram(seurat_object = object, features = "nFeature_RNA") ## End(Not run)
Custom FeatureScatter for initial QC checks including lines for thresholding
QC_Plot_GenevsFeature( seurat_object, feature1, x_axis_label = NULL, y_axis_label = "Genes per Cell/Nucleus", low_cutoff_gene = NULL, high_cutoff_gene = NULL, low_cutoff_feature = NULL, high_cutoff_feature = NULL, colors_use = NULL, pt.size = 1, group.by = NULL, raster = NULL, raster.dpi = c(512, 512), ggplot_default_colors = FALSE, color_seed = 123, shuffle_seed = 1, ... )
QC_Plot_GenevsFeature( seurat_object, feature1, x_axis_label = NULL, y_axis_label = "Genes per Cell/Nucleus", low_cutoff_gene = NULL, high_cutoff_gene = NULL, low_cutoff_feature = NULL, high_cutoff_feature = NULL, colors_use = NULL, pt.size = 1, group.by = NULL, raster = NULL, raster.dpi = c(512, 512), ggplot_default_colors = FALSE, color_seed = 123, shuffle_seed = 1, ... )
seurat_object |
Seurat object name. |
feature1 |
First feature to plot. |
x_axis_label |
Label for x axis. |
y_axis_label |
Label for y axis. |
low_cutoff_gene |
Plot line a potential low threshold for filtering genes per cell. |
high_cutoff_gene |
Plot line a potential high threshold for filtering genes per cell. |
low_cutoff_feature |
Plot line a potential low threshold for filtering feature1 per cell. |
high_cutoff_feature |
Plot line a potential high threshold for filtering feature1 per cell. |
colors_use |
vector of colors to use for plotting by identity. |
pt.size |
Adjust point size for plotting. |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident).
Default is |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
shuffle_seed |
Sets the seed if randomly shuffling the order of points (Default is 1). |
... |
Extra parameters passed to |
A ggplot object
## Not run: QC_Plot_GenevsFeature(seurat_object = obj, y_axis_label = "Feature per Cell") ## End(Not run)
## Not run: QC_Plot_GenevsFeature(seurat_object = obj, y_axis_label = "Feature per Cell") ## End(Not run)
Custom FeatureScatter for initial QC checks including lines for thresholding
QC_Plot_UMIvsFeature( seurat_object, feature1, x_axis_label = NULL, y_axis_label = "UMIs per Cell/Nucleus", low_cutoff_UMI = NULL, high_cutoff_UMI = NULL, low_cutoff_feature = NULL, high_cutoff_feature = NULL, colors_use = NULL, pt.size = 1, group.by = NULL, raster = NULL, raster.dpi = c(512, 512), ggplot_default_colors = FALSE, color_seed = 123, shuffle_seed = 1, ... )
QC_Plot_UMIvsFeature( seurat_object, feature1, x_axis_label = NULL, y_axis_label = "UMIs per Cell/Nucleus", low_cutoff_UMI = NULL, high_cutoff_UMI = NULL, low_cutoff_feature = NULL, high_cutoff_feature = NULL, colors_use = NULL, pt.size = 1, group.by = NULL, raster = NULL, raster.dpi = c(512, 512), ggplot_default_colors = FALSE, color_seed = 123, shuffle_seed = 1, ... )
seurat_object |
Seurat object name. |
feature1 |
First feature to plot. |
x_axis_label |
Label for x axis. |
y_axis_label |
Label for y axis. |
low_cutoff_UMI |
Plot line a potential low threshold for filtering UMI per cell. |
high_cutoff_UMI |
Plot line a potential high threshold for filtering UMI per cell. |
low_cutoff_feature |
Plot line a potential low threshold for filtering feature1 per cell. |
high_cutoff_feature |
Plot line a potential high threshold for filtering feature1 per cell. |
colors_use |
vector of colors to use for plotting by identity. |
pt.size |
Adjust point size for plotting. |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident).
Default is |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
shuffle_seed |
Sets the seed if randomly shuffling the order of points (Default is 1). |
... |
Extra parameters passed to |
A ggplot object
## Not run: QC_Plot_UMIvsFeature(seurat_object = obj, y_axis_label = "Feature per Cell") ## End(Not run)
## Not run: QC_Plot_UMIvsFeature(seurat_object = obj, y_axis_label = "Feature per Cell") ## End(Not run)
Custom FeatureScatter for initial QC checks including lines for thresholding
QC_Plot_UMIvsGene( seurat_object, x_axis_label = "UMIs per Cell/Nucleus", y_axis_label = "Genes per Cell/Nucleus", low_cutoff_gene = -Inf, high_cutoff_gene = Inf, low_cutoff_UMI = -Inf, high_cutoff_UMI = Inf, colors_use = NULL, meta_gradient_name = NULL, meta_gradient_color = viridis_plasma_dark_high, meta_gradient_na_color = "lightgray", meta_gradient_low_cutoff = NULL, cells = NULL, combination = FALSE, ident_legend = TRUE, pt.size = 1, group.by = NULL, raster = NULL, raster.dpi = c(512, 512), ggplot_default_colors = FALSE, color_seed = 123, shuffle_seed = 1, ... )
QC_Plot_UMIvsGene( seurat_object, x_axis_label = "UMIs per Cell/Nucleus", y_axis_label = "Genes per Cell/Nucleus", low_cutoff_gene = -Inf, high_cutoff_gene = Inf, low_cutoff_UMI = -Inf, high_cutoff_UMI = Inf, colors_use = NULL, meta_gradient_name = NULL, meta_gradient_color = viridis_plasma_dark_high, meta_gradient_na_color = "lightgray", meta_gradient_low_cutoff = NULL, cells = NULL, combination = FALSE, ident_legend = TRUE, pt.size = 1, group.by = NULL, raster = NULL, raster.dpi = c(512, 512), ggplot_default_colors = FALSE, color_seed = 123, shuffle_seed = 1, ... )
seurat_object |
Seurat object name. |
x_axis_label |
Label for x axis. |
y_axis_label |
Label for y axis. |
low_cutoff_gene |
Plot line a potential low threshold for filtering genes per cell. |
high_cutoff_gene |
Plot line a potential high threshold for filtering genes per cell. |
low_cutoff_UMI |
Plot line a potential low threshold for filtering UMIs per cell. |
high_cutoff_UMI |
Plot line a potential high threshold for filtering UMIs per cell. |
colors_use |
vector of colors to use for plotting by identity. |
meta_gradient_name |
Name of continuous meta data variable to color points in plot by. (MUST be continuous variable i.e. "percent_mito"). |
meta_gradient_color |
The gradient color palette to use for plotting of meta variable (default is viridis "Plasma" palette with dark colors high). |
meta_gradient_na_color |
Color to use for plotting values when a |
meta_gradient_low_cutoff |
Value to use as threshold for plotting. |
cells |
Cells to include on the scatter plot (default is all cells). |
combination |
logical (default FALSE). Whether or not to return a plot layout with both the plot colored by identity and the meta data gradient plot. |
ident_legend |
logical, whether to plot the legend containing identities (left plot) when
|
pt.size |
Passes size of points to both |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident).
Default is |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 cells. |
raster.dpi |
Pixel resolution for rasterized plots, passed to geom_scattermore(). Default is c(512, 512). |
ggplot_default_colors |
logical. If |
color_seed |
Random seed for the "varibow" palette shuffle if |
shuffle_seed |
Sets the seed if randomly shuffling the order of points (Default is 1). |
... |
Extra parameters passed to |
A ggplot object
library(Seurat) QC_Plot_UMIvsGene(seurat_object = pbmc_small, x_axis_label = "UMIs per Cell/Nucleus", y_axis_label = "Genes per Cell/Nucleus")
library(Seurat) QC_Plot_UMIvsGene(seurat_object = pbmc_small, x_axis_label = "UMIs per Cell/Nucleus", y_axis_label = "Genes per Cell/Nucleus")
Custom VlnPlot for initial QC checks including lines for thresholding
QC_Plots_Combined_Vln( seurat_object, group.by = NULL, feature_cutoffs = NULL, UMI_cutoffs = NULL, mito_cutoffs = NULL, mito_name = "percent_mito", pt.size = NULL, plot_median = FALSE, median_size = 15, plot_boxplot = FALSE, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
QC_Plots_Combined_Vln( seurat_object, group.by = NULL, feature_cutoffs = NULL, UMI_cutoffs = NULL, mito_cutoffs = NULL, mito_name = "percent_mito", pt.size = NULL, plot_median = FALSE, median_size = 15, plot_boxplot = FALSE, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
seurat_object |
Seurat object name. |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident); default is the current active.ident of the object. |
feature_cutoffs |
Numeric vector of length 1 or 2 to plot lines for potential low/high threshold for filtering. |
UMI_cutoffs |
Numeric vector of length 1 or 2 to plot lines for potential low/high threshold for filtering. |
mito_cutoffs |
Numeric vector of length 1 or 2 to plot lines for potential low/high threshold for filtering. |
mito_name |
The column name containing percent mitochondrial counts information. Default value is
"percent_mito" which is default value created when using |
pt.size |
Point size for plotting |
plot_median |
logical, whether to plot median for each ident on the plot (Default is FALSE). |
median_size |
Shape size for the median is plotted. |
plot_boxplot |
logical, whether to plot boxplot inside of violin (Default is FALSE). |
colors_use |
vector of colors to use for plot. |
x_lab_rotate |
Rotate x-axis labels 45 degrees (Default is TRUE). |
y_axis_log |
logical. Whether to change y axis to log10 scale (Default is FALSE). |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 total points plotted (# Cells x # of features). |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
... |
Extra parameters passed to |
A ggplot object
## Not run: QC_Plots_Combined_Vln(seurat_object = object) ## End(Not run)
## Not run: QC_Plots_Combined_Vln(seurat_object = object) ## End(Not run)
Custom VlnPlot for initial QC checks including lines for thresholding
QC_Plots_Complexity( seurat_object, feature = "log10GenesPerUMI", group.by = NULL, x_axis_label = NULL, y_axis_label = "log10(Genes) / log10(UMIs)", plot_title = "Cell Complexity", low_cutoff = NULL, high_cutoff = NULL, pt.size = NULL, plot_median = FALSE, plot_boxplot = FALSE, median_size = 15, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
QC_Plots_Complexity( seurat_object, feature = "log10GenesPerUMI", group.by = NULL, x_axis_label = NULL, y_axis_label = "log10(Genes) / log10(UMIs)", plot_title = "Cell Complexity", low_cutoff = NULL, high_cutoff = NULL, pt.size = NULL, plot_median = FALSE, plot_boxplot = FALSE, median_size = 15, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
seurat_object |
Seurat object name. |
feature |
Feature from Meta Data to plot. |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident); default is the current active.ident of the object. |
x_axis_label |
Label for x axis. |
y_axis_label |
Label for y axis. |
plot_title |
Plot Title. |
low_cutoff |
Plot line a potential low threshold for filtering. |
high_cutoff |
Plot line a potential high threshold for filtering. |
pt.size |
Point size for plotting |
plot_median |
logical, whether to plot median for each ident on the plot (Default is FALSE). |
plot_boxplot |
logical, whether to plot boxplot inside of violin (Default is FALSE). |
median_size |
Shape size for the median is plotted. |
colors_use |
vector of colors to use for plot. |
x_lab_rotate |
Rotate x-axis labels 45 degrees (Default is TRUE). |
y_axis_log |
logical. Whether to change y axis to log10 scale (Default is FALSE). |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 total points plotted (# Cells x # of features). |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
... |
Extra parameters passed to |
A ggplot object
library(Seurat) pbmc_small <- Add_Cell_Complexity(pbmc_small) QC_Plots_Complexity(seurat_object = pbmc_small)
library(Seurat) pbmc_small <- Add_Cell_Complexity(pbmc_small) QC_Plots_Complexity(seurat_object = pbmc_small)
Custom VlnPlot for initial QC checks including lines for thresholding
QC_Plots_Feature( seurat_object, feature, group.by = NULL, x_axis_label = NULL, y_axis_label = NULL, plot_title = NULL, low_cutoff = NULL, high_cutoff = NULL, pt.size = NULL, plot_median = FALSE, median_size = 15, plot_boxplot = FALSE, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
QC_Plots_Feature( seurat_object, feature, group.by = NULL, x_axis_label = NULL, y_axis_label = NULL, plot_title = NULL, low_cutoff = NULL, high_cutoff = NULL, pt.size = NULL, plot_median = FALSE, median_size = 15, plot_boxplot = FALSE, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
seurat_object |
Seurat object name. |
feature |
Feature from Meta Data to plot. |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident); default is the current active.ident of the object. |
x_axis_label |
Label for x axis. |
y_axis_label |
Label for y axis. |
plot_title |
Plot Title. |
low_cutoff |
Plot line a potential low threshold for filtering. |
high_cutoff |
Plot line a potential high threshold for filtering. |
pt.size |
Point size for plotting. |
plot_median |
logical, whether to plot median for each ident on the plot (Default is FALSE). |
median_size |
Shape size for the median is plotted. |
plot_boxplot |
logical, whether to plot boxplot inside of violin (Default is FALSE). |
colors_use |
vector of colors to use for plot. |
x_lab_rotate |
Rotate x-axis labels 45 degrees (Default is TRUE). |
y_axis_log |
logical. Whether to change y axis to log10 scale (Default is FALSE). |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 total points plotted (# Cells x # of features). |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
... |
Extra parameters passed to |
A ggplot object
## Not run: QC_Plots_Feature(seurat_object = object, feature = "FEATURE_NAME", y_axis_label = "FEATURE per Cell", plot_title = "FEATURE per Cell", high_cutoff = 10, low_cutoff = 2) ## End(Not run)
## Not run: QC_Plots_Feature(seurat_object = object, feature = "FEATURE_NAME", y_axis_label = "FEATURE per Cell", plot_title = "FEATURE per Cell", high_cutoff = 10, low_cutoff = 2) ## End(Not run)
Custom VlnPlot for initial QC checks including lines for thresholding
QC_Plots_Genes( seurat_object, plot_title = "Genes Per Cell/Nucleus", group.by = NULL, x_axis_label = NULL, y_axis_label = "Features", low_cutoff = NULL, high_cutoff = NULL, pt.size = NULL, plot_median = FALSE, plot_boxplot = FALSE, median_size = 15, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
QC_Plots_Genes( seurat_object, plot_title = "Genes Per Cell/Nucleus", group.by = NULL, x_axis_label = NULL, y_axis_label = "Features", low_cutoff = NULL, high_cutoff = NULL, pt.size = NULL, plot_median = FALSE, plot_boxplot = FALSE, median_size = 15, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
seurat_object |
Seurat object name. |
plot_title |
Plot Title. |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident); default is the current active.ident of the object. |
x_axis_label |
Label for x axis. |
y_axis_label |
Label for y axis. |
low_cutoff |
Plot line a potential low threshold for filtering. |
high_cutoff |
Plot line a potential high threshold for filtering. |
pt.size |
Point size for plotting. |
plot_median |
logical, whether to plot median for each ident on the plot (Default is FALSE). |
plot_boxplot |
logical, whether to plot boxplot inside of violin (Default is FALSE). |
median_size |
Shape size for the median is plotted. |
colors_use |
vector of colors to use for plot. |
x_lab_rotate |
Rotate x-axis labels 45 degrees (Default is TRUE). |
y_axis_log |
logical. Whether to change y axis to log10 scale (Default is FALSE). |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 total points plotted (# Cells x # of features). |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
... |
Extra parameters passed to |
A ggplot object
library(Seurat) QC_Plots_Genes(seurat_object = pbmc_small, plot_title = "Genes per Cell", low_cutoff = 40, high_cutoff = 85)
library(Seurat) QC_Plots_Genes(seurat_object = pbmc_small, plot_title = "Genes per Cell", low_cutoff = 40, high_cutoff = 85)
#' Custom VlnPlot for initial QC checks including lines for thresholding
QC_Plots_Mito( seurat_object, mito_name = "percent_mito", plot_title = "Mito Gene % per Cell/Nucleus", group.by = NULL, x_axis_label = NULL, y_axis_label = "% Mitochondrial Gene Counts", low_cutoff = NULL, high_cutoff = NULL, pt.size = NULL, plot_median = FALSE, median_size = 15, plot_boxplot = FALSE, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
QC_Plots_Mito( seurat_object, mito_name = "percent_mito", plot_title = "Mito Gene % per Cell/Nucleus", group.by = NULL, x_axis_label = NULL, y_axis_label = "% Mitochondrial Gene Counts", low_cutoff = NULL, high_cutoff = NULL, pt.size = NULL, plot_median = FALSE, median_size = 15, plot_boxplot = FALSE, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
seurat_object |
Seurat object name. |
mito_name |
The column name containing percent mitochondrial counts information. Default value is
"percent_mito" which is default value created when using |
plot_title |
Plot Title. |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident); default is the current active.ident of the object. |
x_axis_label |
Label for x axis. |
y_axis_label |
Label for y axis. |
low_cutoff |
Plot line a potential low threshold for filtering. |
high_cutoff |
Plot line a potential high threshold for filtering. |
pt.size |
Point size for plotting. |
plot_median |
logical, whether to plot median for each ident on the plot (Default is FALSE). |
median_size |
Shape size for the median is plotted. |
plot_boxplot |
logical, whether to plot boxplot inside of violin (Default is FALSE). |
colors_use |
vector of colors to use for plot. |
x_lab_rotate |
Rotate x-axis labels 45 degrees (Default is TRUE). |
y_axis_log |
logical. Whether to change y axis to log10 scale (Default is FALSE). |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 total points plotted (# Cells x # of features). |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
... |
Extra parameters passed to |
A ggplot object
## Not run: QC_Plots_Mito(seurat_object = object, plot_title = "Percent Mito per Cell", high_cutoff = 10) ## End(Not run)
## Not run: QC_Plots_Mito(seurat_object = object, plot_title = "Percent Mito per Cell", high_cutoff = 10) ## End(Not run)
#' Custom VlnPlot for initial QC checks including lines for thresholding
QC_Plots_UMIs( seurat_object, plot_title = "UMIs per Cell/Nucleus", group.by = NULL, x_axis_label = NULL, y_axis_label = "UMIs", low_cutoff = NULL, high_cutoff = NULL, pt.size = NULL, plot_median = FALSE, median_size = 15, plot_boxplot = FALSE, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
QC_Plots_UMIs( seurat_object, plot_title = "UMIs per Cell/Nucleus", group.by = NULL, x_axis_label = NULL, y_axis_label = "UMIs", low_cutoff = NULL, high_cutoff = NULL, pt.size = NULL, plot_median = FALSE, median_size = 15, plot_boxplot = FALSE, colors_use = NULL, x_lab_rotate = TRUE, y_axis_log = FALSE, raster = NULL, ggplot_default_colors = FALSE, color_seed = 123, ... )
seurat_object |
Seurat object name. |
plot_title |
Plot Title. |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident); default is the current active.ident of the object. |
x_axis_label |
Label for x axis. |
y_axis_label |
Label for y axis. |
low_cutoff |
Plot line a potential low threshold for filtering. |
high_cutoff |
Plot line a potential high threshold for filtering. |
pt.size |
Point size for plotting. |
plot_median |
logical, whether to plot median for each ident on the plot (Default is FALSE). |
median_size |
Shape size for the median is plotted. |
plot_boxplot |
logical, whether to plot boxplot inside of violin (Default is FALSE). |
colors_use |
vector of colors to use for plot. |
x_lab_rotate |
Rotate x-axis labels 45 degrees (Default is TRUE). |
y_axis_log |
logical. Whether to change y axis to log10 scale (Default is FALSE). |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 total points plotted (# Cells x # of features). |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
... |
Extra parameters passed to |
A ggplot object
library(Seurat) QC_Plots_UMIs(seurat_object = pbmc_small, plot_title = "UMIs per Cell", low_cutoff = 75, high_cutoff = 600)
library(Seurat) QC_Plots_UMIs(seurat_object = pbmc_small, plot_title = "UMIs per Cell", low_cutoff = 75, high_cutoff = 600)
Extract sparse matrix with corrected counts from CellBender h5 output file.
Read_CellBender_h5_Mat( file_name, use.names = TRUE, unique.features = TRUE, h5_group_name = NULL, feature_slot_name = "features" )
Read_CellBender_h5_Mat( file_name, use.names = TRUE, unique.features = TRUE, h5_group_name = NULL, feature_slot_name = "features" )
file_name |
Path to h5 file. |
use.names |
Label row names with feature names rather than ID numbers (default TRUE). |
unique.features |
Make feature names unique (default TRUE). |
h5_group_name |
Name of the group within H5 file that contains count data. This is only
required if H5 file contains multiple subgroups and non-default names. Default is |
feature_slot_name |
Name of the slot contain feature names/ids. Must be one of: "features"(Cell Ranger v3+) or "genes" (Cell Ranger v1/v2 or STARsolo). Default is "features". |
sparse matrix
Code used in function has been modified from Seurat::Read10X_h5
function of
Seurat package https://github.com/satijalab/seurat (License: GPL-3).
## Not run: mat <- Read_CellBender_h5_Mat(file_name = "/SampleA_out_filtered.h5") ## End(Not run)
## Not run: mat <- Read_CellBender_h5_Mat(file_name = "/SampleA_out_filtered.h5") ## End(Not run)
Extract sparse matrix with corrected counts from CellBender h5 output file across multiple sample subdirectories.
Read_CellBender_h5_Multi_Directory( base_path, secondary_path = NULL, filtered_h5 = TRUE, custom_name = NULL, sample_list = NULL, sample_names = NULL, h5_group_name = NULL, feature_slot_name = "features", replace_suffix = FALSE, new_suffix_list = NULL, parallel = FALSE, num_cores = NULL, merge = FALSE, ... )
Read_CellBender_h5_Multi_Directory( base_path, secondary_path = NULL, filtered_h5 = TRUE, custom_name = NULL, sample_list = NULL, sample_names = NULL, h5_group_name = NULL, feature_slot_name = "features", replace_suffix = FALSE, new_suffix_list = NULL, parallel = FALSE, num_cores = NULL, merge = FALSE, ... )
base_path |
path to the parent directory which contains all of the subdirectories of interest. |
secondary_path |
path from the parent directory to count matrix files for each sample. |
filtered_h5 |
logical (default TRUE). Will set the shared file name suffix |
custom_name |
if file name was customized in CellBender then this parameter should contain the portion of file name that is shared across all samples. Must included the ".h5" extension as well. |
sample_list |
a vector of sample directory names if only specific samples are desired. If |
sample_names |
a set of sample names to use for each sample entry in returned list. If |
h5_group_name |
Name of the group within H5 file that contains count data. This is only
required if H5 file contains multiple subgroups and non-default names. Default is |
feature_slot_name |
Name of the slot contain feature names/ids. Must be one of: "features"(Cell Ranger v3+) or "genes" (Cell Ranger v1/v2 or STARsolo). Default is "features". |
replace_suffix |
logical (default FALSE). Whether or not to replace the barcode suffixes of matrices
using |
new_suffix_list |
a vector of new suffixes to replace existing suffixes if |
parallel |
logical (default FALSE) whether or not to use multi core processing to read in matrices. |
num_cores |
how many cores to use for parallel processing. |
merge |
logical (default FALSE) whether or not to merge samples into a single matrix or return
list of matrices. If TRUE each sample entry in list will have cell barcode prefix added. The prefix
will be taken from |
... |
Extra parameters passed to |
list of sparse matrices
## Not run: base_path <- 'path/to/data/directory' mat_list <- Read_CellBender_h5_Multi_Directory(base_path = base_path) ## End(Not run)
## Not run: base_path <- 'path/to/data/directory' mat_list <- Read_CellBender_h5_Multi_Directory(base_path = base_path) ## End(Not run)
Extract sparse matrix with corrected counts from CellBender h5 output file across multiple samples within the same directory.
Read_CellBender_h5_Multi_File( data_dir = NULL, filtered_h5 = TRUE, custom_name = NULL, sample_list = NULL, sample_names = NULL, h5_group_name = NULL, feature_slot_name = "features", parallel = FALSE, num_cores = NULL, merge = FALSE, ... )
Read_CellBender_h5_Multi_File( data_dir = NULL, filtered_h5 = TRUE, custom_name = NULL, sample_list = NULL, sample_names = NULL, h5_group_name = NULL, feature_slot_name = "features", parallel = FALSE, num_cores = NULL, merge = FALSE, ... )
data_dir |
Directory containing the .h5 files output by CellBender. |
filtered_h5 |
logical (default TRUE). Will set the shared file name suffix if |
custom_name |
if file name was customized in CellBender then this parameter should contain the portion of file name that is shared across all samples. Must included the ".h5" extension as well. |
sample_list |
a vector of sample names if only specific samples are desired. If |
sample_names |
a set of sample names to use for each sample entry in returned list. If |
h5_group_name |
Name of the group within H5 file that contains count data. This is only
required if H5 file contains multiple subgroups and non-default names. Default is |
feature_slot_name |
Name of the slot contain feature names/ids. Must be one of: "features"(Cell Ranger v3+) or "genes" (Cell Ranger v1/v2 or STARsolo). Default is "features". |
parallel |
logical (default FALSE) whether or not to use multi core processing to read in matrices |
num_cores |
how many cores to use for parallel processing. |
merge |
logical (default FALSE) whether or not to merge samples into a single matrix or return
list of matrices. If TRUE each sample entry in list will have cell barcode prefix added. The prefix
will be taken from |
... |
Extra parameters passed to |
list of sparse matrices
## Not run: base_path <- 'path/to/data/directory' mat_list <- Read_CellBender_h5_Multi_File(data_dir = base_path) ## End(Not run)
## Not run: base_path <- 'path/to/data/directory' mat_list <- Read_CellBender_h5_Multi_File(data_dir = base_path) ## End(Not run)
Can read delimited file types (i.e. csv, tsv, txt)
Read_GEO_Delim( data_dir, file_suffix, move_genes_rownames = TRUE, sample_list = NULL, full_names = FALSE, sample_names = NULL, barcode_suffix_period = FALSE, parallel = FALSE, num_cores = NULL, merge = FALSE )
Read_GEO_Delim( data_dir, file_suffix, move_genes_rownames = TRUE, sample_list = NULL, full_names = FALSE, sample_names = NULL, barcode_suffix_period = FALSE, parallel = FALSE, num_cores = NULL, merge = FALSE )
data_dir |
Directory containing the files. |
file_suffix |
The file suffix of the individual files. Must be the same across all files being imported. This is used to detect files to import and their GEO IDs. |
move_genes_rownames |
logical. Whether gene IDs are present in first column or in row names of delimited file. If TRUE will move the first column to row names before creating final matrix. Default is TRUE. |
sample_list |
a vector of samples within directory to read in (can be either with or
without |
full_names |
logical (default FALSE). Whether or not the |
sample_names |
a set of sample names to use for each sample entry in returned list.
If |
barcode_suffix_period |
Is the barcode suffix a period and should it be changed to "-". Default (FALSE; barcodes will be left identical to their format in input files.). If TRUE "." in barcode suffix will be changed to "-". |
parallel |
logical (default FALSE). Whether to use multiple cores when reading in data. Only possible on Linux based systems. |
num_cores |
if |
merge |
logical (default FALSE) whether or not to merge samples into a single matrix or return
list of matrices. If TRUE each sample entry in list will have cell barcode prefix added. The prefix
will be taken from |
List of gene x cell matrices in list format named by sample name.
## Not run: data_dir <- 'path/to/data/directory' expression_matrices <- Read_GEO_Delim(data_dir = data_dir) ## End(Not run)
## Not run: data_dir <- 'path/to/data/directory' expression_matrices <- Read_GEO_Delim(data_dir = data_dir) ## End(Not run)
Get data.frame with all metrics from the Cell Ranger count analysis (present in web_summary.html)
Read_Metrics_10X( base_path, secondary_path = NULL, default_10X = TRUE, cellranger_multi = FALSE, lib_list = NULL, lib_names = NULL )
Read_Metrics_10X( base_path, secondary_path = NULL, default_10X = TRUE, cellranger_multi = FALSE, lib_list = NULL, lib_names = NULL )
base_path |
path to the parent directory which contains all of the subdirectories of interest. |
secondary_path |
path from the parent directory to count "outs/" folder which contains the "metrics_summary.csv" file. |
default_10X |
logical (default TRUE) sets the secondary path variable to the default 10X directory structure. |
cellranger_multi |
logical, whether or not metrics come from Cell Ranger |
lib_list |
a list of sample names (matching directory names) to import. If |
lib_names |
a set of sample names to use for each sample. If |
A data frame with sample metrics from cell ranger.
## Not run: metrics <- Read_Metrics_10X(base_path = "/path/to/directories", default_10X = TRUE) ## End(Not run)
## Not run: metrics <- Read_Metrics_10X(base_path = "/path/to/directories", default_10X = TRUE) ## End(Not run)
Enables easy loading of sparse data matrices provided by 10X genomics. That have file prefixes added to them by NCBI GEO or other repos.
Read10X_GEO( data_dir = NULL, sample_list = NULL, sample_names = NULL, gene.column = 2, cell.column = 1, unique.features = TRUE, strip.suffix = FALSE, parallel = FALSE, num_cores = NULL, merge = FALSE )
Read10X_GEO( data_dir = NULL, sample_list = NULL, sample_names = NULL, gene.column = 2, cell.column = 1, unique.features = TRUE, strip.suffix = FALSE, parallel = FALSE, num_cores = NULL, merge = FALSE )
data_dir |
Directory containing the matrix.mtx, genes.tsv (or features.tsv), and barcodes.tsv files provided by 10X. |
sample_list |
A vector of file prefixes/names if specific samples are desired. Default is |
sample_names |
a set of sample names to use for each sample entry in returned list. If |
gene.column |
Specify which column of genes.tsv or features.tsv to use for gene names; default is 2. |
cell.column |
Specify which column of barcodes.tsv to use for cell names; default is 1. |
unique.features |
Make feature names unique (default TRUE). |
strip.suffix |
Remove trailing "-1" if present in all cell barcodes. |
parallel |
logical (default FALSE). Whether to use multiple cores when reading in data. Only possible on Linux based systems. |
num_cores |
if |
merge |
logical (default FALSE) whether or not to merge samples into a single matrix or return
list of matrices. If TRUE each sample entry in list will have cell barcode prefix added. The prefix
will be taken from |
If features.csv indicates the data has multiple data types, a list containing a sparse matrix of the data from each type will be returned. Otherwise a sparse matrix containing the expression data will be returned.
Code used in function has been slightly modified from Seurat::Read10X
function of
Seurat package https://github.com/satijalab/seurat (License: GPL-3). Function was modified to
support file prefixes and altered loop by Samuel Marsh for scCustomize (also previously posted as
potential PR to Seurat GitHub).
## Not run: data_dir <- 'path/to/data/directory' expression_matrices <- Read10X_GEO(data_dir = data_dir) # To create object from single file seurat_object = CreateSeuratObject(counts = expression_matrices[[1]]) ## End(Not run)
## Not run: data_dir <- 'path/to/data/directory' expression_matrices <- Read10X_GEO(data_dir = data_dir) # To create object from single file seurat_object = CreateSeuratObject(counts = expression_matrices[[1]]) ## End(Not run)
Enables easy loading of HDF5 data matrices provided by 10X genomics. That have file prefixes added to them by NCBI GEO or other repos or programs (i.e. Cell Bender)
Read10X_h5_GEO( data_dir = NULL, sample_list = NULL, sample_names = NULL, shared_suffix = NULL, parallel = FALSE, num_cores = NULL, merge = FALSE, ... )
Read10X_h5_GEO( data_dir = NULL, sample_list = NULL, sample_names = NULL, shared_suffix = NULL, parallel = FALSE, num_cores = NULL, merge = FALSE, ... )
data_dir |
Directory containing the .h5 files provided by 10X. |
sample_list |
A vector of file prefixes/names if specific samples are desired. Default is |
sample_names |
a set of sample names to use for each sample entry in returned list. If |
shared_suffix |
a suffix and file extension shared by all samples. |
parallel |
logical (default FALSE). Whether to use multiple cores when reading in data. Only possible on Linux based systems. |
num_cores |
if |
merge |
logical (default FALSE) whether or not to merge samples into a single matrix or return
list of matrices. If TRUE each sample entry in list will have cell barcode prefix added. The prefix
will be taken from |
... |
Additional arguments passed to |
If the data has multiple data types, a list containing a sparse matrix of the data from each type will be returned. Otherwise a sparse matrix containing the expression data will be returned.
## Not run: data_dir <- 'path/to/data/directory' expression_matrices <- Read10X_h5_GEO(data_dir = data_dir) # To create object from single file seurat_object = CreateSeuratObject(counts = expression_matrices[[1]]) ## End(Not run)
## Not run: data_dir <- 'path/to/data/directory' expression_matrices <- Read10X_h5_GEO(data_dir = data_dir) # To create object from single file seurat_object = CreateSeuratObject(counts = expression_matrices[[1]]) ## End(Not run)
Enables easy loading of sparse data matrices provided by 10X genomics that are present in multiple subdirectories. Can function with either default output directory structure of Cell Ranger or custom directory structure.
Read10X_h5_Multi_Directory( base_path, secondary_path = NULL, default_10X_path = TRUE, cellranger_multi = FALSE, h5_filename = "filtered_feature_bc_matrix.h5", cell_bender = deprecated(), sample_list = NULL, sample_names = NULL, replace_suffix = FALSE, new_suffix_list = NULL, parallel = FALSE, num_cores = NULL, merge = FALSE, ... )
Read10X_h5_Multi_Directory( base_path, secondary_path = NULL, default_10X_path = TRUE, cellranger_multi = FALSE, h5_filename = "filtered_feature_bc_matrix.h5", cell_bender = deprecated(), sample_list = NULL, sample_names = NULL, replace_suffix = FALSE, new_suffix_list = NULL, parallel = FALSE, num_cores = NULL, merge = FALSE, ... )
base_path |
path to the parent directory which contains all of the subdirectories of interest. |
secondary_path |
path from the parent directory to count matrix files for each sample. |
default_10X_path |
logical (default TRUE) sets the secondary path variable to the default 10X directory structure. |
cellranger_multi |
logical, whether samples were processed with Cell Ranger |
h5_filename |
name of h5 file (including .h5 suffix). If all h5 files have same name (i.e. Cell Ranger output) then use full file name. By default function uses Cell Ranger name: "filtered_feature_bc_matrix.h5". If h5 files have sample specific prefixes (i.e. from Cell Bender) then use only the shared part of file name (e.g., "_filtered_out.h5"). |
cell_bender |
CellBender read functions are now independent family of functions.
See |
sample_list |
a vector of sample directory names if only specific samples are desired. If |
sample_names |
a set of sample names to use for each sample entry in returned list. If |
replace_suffix |
logical (default FALSE). Whether or not to replace the barcode suffixes of matrices
using |
new_suffix_list |
a vector of new suffixes to replace existing suffixes if |
parallel |
logical (default FALSE) whether or not to use multi core processing to read in matrices. |
num_cores |
how many cores to use for parallel processing. |
merge |
logical (default FALSE) whether or not to merge samples into a single matrix or return
list of matrices. If TRUE each sample entry in list will have cell barcode prefix added. The prefix
will be taken from |
... |
Extra parameters passed to |
a list of sparse matrices (merge = FALSE) or a single sparse matrix (merge = TRUE).
## Not run: base_path <- 'path/to/data/directory' expression_matrices <- Read10X_h5_Multi_Directory(base_path = base_path) ## End(Not run)
## Not run: base_path <- 'path/to/data/directory' expression_matrices <- Read10X_h5_Multi_Directory(base_path = base_path) ## End(Not run)
Enables easy loading of sparse data matrices provided by 10X genomics that are present in multiple subdirectories. Can function with either default output directory structure of Cell Ranger or custom directory structure.
Read10X_Multi_Directory( base_path, secondary_path = NULL, default_10X_path = TRUE, cellranger_multi = FALSE, sample_list = NULL, sample_names = NULL, parallel = FALSE, num_cores = NULL, merge = FALSE, ... )
Read10X_Multi_Directory( base_path, secondary_path = NULL, default_10X_path = TRUE, cellranger_multi = FALSE, sample_list = NULL, sample_names = NULL, parallel = FALSE, num_cores = NULL, merge = FALSE, ... )
base_path |
path to the parent directory which contains all of the subdirectories of interest. |
secondary_path |
path from the parent directory to count matrix files for each sample. |
default_10X_path |
logical (default TRUE) sets the secondary path variable to the default 10X directory structure. |
cellranger_multi |
logical, whether samples were processed with Cell Ranger |
sample_list |
a vector of sample directory names if only specific samples are desired. If |
sample_names |
a set of sample names to use for each sample entry in returned list. If |
parallel |
logical (default FALSE) whether or not to use multi core processing to read in matrices. |
num_cores |
how many cores to use for parallel processing. |
merge |
logical (default FALSE) whether or not to merge samples into a single matrix or return
list of matrices. If TRUE each sample entry in list will have cell barcode prefix added. The prefix
will be taken from |
... |
Extra parameters passed to |
a list of sparse matrices (merge = FALSE) or a single sparse matrix (merge = TRUE).
## Not run: base_path <- 'path/to/data/directory' expression_matrices <- Read10X_Multi_Directory(base_path = base_path) ## End(Not run)
## Not run: base_path <- 'path/to/data/directory' expression_matrices <- Read10X_Multi_Directory(base_path = base_path) ## End(Not run)
Check if reduction loadings are present in object and return vector of found loading names. Return warning messages for genes not found.
Reduction_Loading_Present( seurat_object, reduction_names, print_msg = TRUE, omit_warn = TRUE, return_none = FALSE )
Reduction_Loading_Present( seurat_object, reduction_names, print_msg = TRUE, omit_warn = TRUE, return_none = FALSE )
seurat_object |
object name. |
reduction_names |
vector of genes to check. |
print_msg |
logical. Whether message should be printed if all features are found. Default is TRUE. |
omit_warn |
logical. Whether to print message about features that are not found in current object. Default is TRUE. |
return_none |
logical. Whether list of found vs. bad features should still be returned if no features are found. Default is FALSE. |
A list of length 3 containing 1) found features, 2) not found features.
## Not run: reductions <- Reduction_Loading_Present(seurat_object = obj_name, reduction_name = "PC_1") found_features <- features[[1]] ## End(Not run)
## Not run: reductions <- Reduction_Loading_Present(seurat_object = obj_name, reduction_name = "PC_1") found_features <- features[[1]] ## End(Not run)
Wrapper function to rename active identities in Seurat Object with new idents.
Rename_Clusters(seurat_object, new_idents, meta_col_name = NULL, ...)
Rename_Clusters(seurat_object, new_idents, meta_col_name = NULL, ...)
seurat_object |
object name. |
new_idents |
vector of new cluster names. Must be equal to the length of current active.ident in Seurat Object. Will accept named vector (with old idents as names) or will name the new_idents vector internally. |
meta_col_name |
(Optional). Whether or not to create new named column in |
... |
Extra parameters passed to |
Seurat Object with new identities placed in active.ident slot.
## Not run: obj <- Rename_Clusters(seurat_object = obj_name, new_idents = new_idents_vec, meta_col_name = "Round01_Res0.6_Idents") ## End(Not run)
## Not run: obj <- Rename_Clusters(seurat_object = obj_name, new_idents = new_idents_vec, meta_col_name = "Round01_Res0.6_Idents") ## End(Not run)
Replace barcode suffixes in matrix, data.frame, or list of matrices/data.frames
Replace_Suffix(data, current_suffix, new_suffix)
Replace_Suffix(data, current_suffix, new_suffix)
data |
Either matrix/data.frame or list of matrices/data.frames with the cell barcodes in the column names. |
current_suffix |
a single value or vector of values representing current barcode suffix. If suffix is the same for all matrices/data.frames in list only single value is required. |
new_suffix |
a single value or vector of values representing new barcode suffix to be added.
If desired suffix is the same for all matrices/data.frames in list only single value is required.
If no suffix is desired set |
matrix or data.frame with new column names.
## Not run: dge_matrix <- Replace_Suffix(data = dge_matrix, current_suffix = "-1", new_suffix = "-2") ## End(Not run)
## Not run: dge_matrix <- Replace_Suffix(data = dge_matrix, current_suffix = "-1", new_suffix = "-2") ## End(Not run)
Function to return package default discrete palettes depending on number of groups plotted.
scCustomize_Palette( num_groups, ggplot_default_colors = FALSE, color_seed = 123 )
scCustomize_Palette( num_groups, ggplot_default_colors = FALSE, color_seed = 123 )
num_groups |
number of groups to be plotted. If
|
ggplot_default_colors |
logical. Whether to use default ggplot hue palette or not. |
color_seed |
random seed to use for shuffling the "varibow" palette. |
vector of colors to use for plotting.
cols <- scCustomize_Palette(num_groups = 24, ggplot_default_colors = FALSE) PalettePlot(pal= cols)
cols <- scCustomize_Palette(num_groups = 24, ggplot_default_colors = FALSE) PalettePlot(pal= cols)
Plot a combined plot of the Alignment QC metrics from sequencing output.
Seq_QC_Plot_Alignment_Combined( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, patchwork_title = "Sequencing QC Plots: Read Alignment Metrics", significance = FALSE, ... )
Seq_QC_Plot_Alignment_Combined( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, patchwork_title = "Sequencing QC Plots: Read Alignment Metrics", significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
patchwork_title |
Title to use for the patchworked plot output. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Alignment_Combined(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Alignment_Combined(metrics_dataframe = metrics) ## End(Not run)
Plot the fraction of reads mapped Antisense to Gene
Seq_QC_Plot_Antisense( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Antisense( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Antisense(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Antisense(metrics_dataframe = metrics) ## End(Not run)
Plot a combined plot of the basic QC metrics from sequencing output.
Seq_QC_Plot_Basic_Combined( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, patchwork_title = "Sequencing QC Plots: Basic Cell Metrics", significance = FALSE, ... )
Seq_QC_Plot_Basic_Combined( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, patchwork_title = "Sequencing QC Plots: Basic Cell Metrics", significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
patchwork_title |
Title to use for the patchworked plot output. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Basic_Combined(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Basic_Combined(metrics_dataframe = metrics) ## End(Not run)
Plot the fraction of reads confidently mapped to Exonic regions
Seq_QC_Plot_Exonic( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Exonic( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Exonic(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Exonic(metrics_dataframe = metrics) ## End(Not run)
Plot the median genes per cell per sample
Seq_QC_Plot_Genes( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Genes( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Genes(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Genes(metrics_dataframe = metrics) ## End(Not run)
Plot the fraction of reads confidently mapped to genome
Seq_QC_Plot_Genome( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Genome( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Genome(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Genome(metrics_dataframe = metrics) ## End(Not run)
Plot the fraction of reads confidently mapped to intergenic regions
Seq_QC_Plot_Intergenic( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Intergenic( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Intergeneic(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Intergeneic(metrics_dataframe = metrics) ## End(Not run)
Plot the fraction of reads confidently mapped to intronic regions
Seq_QC_Plot_Intronic( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Intronic( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Intronic(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Intronic(metrics_dataframe = metrics) ## End(Not run)
Plot the number of cells per sample
Seq_QC_Plot_Number_Cells( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Number_Cells( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Number_Cells(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Number_Cells(metrics_dataframe = metrics) ## End(Not run)
Plot the fraction of reads in cells per sample
Seq_QC_Plot_Reads_in_Cells( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Reads_in_Cells( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Reads_in_Cells(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Reads_in_Cells(metrics_dataframe = metrics) ## End(Not run)
Plot the mean number of reads per cell
Seq_QC_Plot_Reads_per_Cell( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Reads_per_Cell( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Reads_per_Cell(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Reads_per_Cell(metrics_dataframe = metrics) ## End(Not run)
Plot the sequencing saturation percentage per sample
Seq_QC_Plot_Saturation( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Saturation( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Saturation(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Saturation(metrics_dataframe = metrics) ## End(Not run)
Plot the total genes detected per sample
Seq_QC_Plot_Total_Genes( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Total_Genes( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Total_Genes(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Total_Genes(metrics_dataframe = metrics) ## End(Not run)
Plot the fraction of reads confidently mapped to transcriptome
Seq_QC_Plot_Transcriptome( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_Transcriptome( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_Transcriptome(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_Transcriptome(metrics_dataframe = metrics) ## End(Not run)
Plot the median UMIs per cell per sample
Seq_QC_Plot_UMIs( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
Seq_QC_Plot_UMIs( metrics_dataframe, plot_by = "sample_id", colors_use = NULL, dot_size = 1, x_lab_rotate = FALSE, significance = FALSE, ... )
metrics_dataframe |
data.frame contain Cell Ranger QC Metrics (see |
plot_by |
Grouping factor for the plot. Default is to plot as single group with single point per sample. |
colors_use |
colors to use for plot if plotting by group. Defaults to RColorBrewer Dark2 palette if
less than 8 groups and |
dot_size |
size of the dots plotted if |
x_lab_rotate |
logical. Whether to rotate the axes labels on the x-axis. Default is FALSE. |
significance |
logical. Whether to calculate and plot p-value comparisons when plotting by grouping factor. Default is FALSE. |
... |
Other variables to pass to |
A ggplot object
## Not run: Seq_QC_Plot_UMIs(metrics_dataframe = metrics) ## End(Not run)
## Not run: Seq_QC_Plot_UMIs(metrics_dataframe = metrics) ## End(Not run)
Create reproducible project directory organization when initiating a new analysis.
Setup_scRNAseq_Project( custom_dir_file = NULL, cluster_annotation_path = NULL, cluster_annotation_file_name = "cluster_annotation.csv" )
Setup_scRNAseq_Project( custom_dir_file = NULL, cluster_annotation_path = NULL, cluster_annotation_file_name = "cluster_annotation.csv" )
custom_dir_file |
file to file containing desired directory structure. Default is NULL and will provide generic built-in directory structure. |
cluster_annotation_path |
path to place cluster annotation file using |
cluster_annotation_file_name |
name to use for annotation file if created (optional). |
no return value. Creates system folders.
## Not run: # If using built-in directory structure. Setup_scRNAseq_Project() ## End(Not run)
## Not run: # If using built-in directory structure. Setup_scRNAseq_Project() ## End(Not run)
Selects colors from modified versions of RColorBrewer single colors palettes
Single_Color_Palette(pal_color, num_colors = NULL, seed_use = 123)
Single_Color_Palette(pal_color, num_colors = NULL, seed_use = 123)
pal_color |
color palette to select (Options are: 'reds', 'blues', 'greens', 'purples', 'oranges', 'grays'). |
num_colors |
set number of colors (max = 7). |
seed_use |
set seed for reproducibility (default: 123). |
A vector of colors
See RColorBrewer for more info on palettes https://CRAN.R-project.org/package=RColorBrewer
pal <- Single_Color_Palette(pal_color = "reds", num_colors = 7) PalettePlot(pal= pal)
pal <- Single_Color_Palette(pal_color = "reds", num_colors = 7) PalettePlot(pal= pal)
Split Assay5 of Seurat object into layers by variable in meta.data
Split_Layers(seurat_object, assay = "RNA", split.by)
Split_Layers(seurat_object, assay = "RNA", split.by)
seurat_object |
Seurat object name. |
assay |
name(s) of assays to convert. Defaults to current active assay. |
split.by |
Variable in meta.data to use for splitting layers. |
## Not run: # Split object by "treatment" obj <- Split_Layers(object = obj, assay = "RNA", split.by = "treatment") ## End(Not run)
## Not run: # Split object by "treatment" obj <- Split_Layers(object = obj, assay = "RNA", split.by = "treatment") ## End(Not run)
Splits vector into chunks of x sizes
Split_Vector(x, chunk_size = 100, verbose = FALSE)
Split_Vector(x, chunk_size = 100, verbose = FALSE)
x |
vector to split |
chunk_size |
size of chunks for vector to be split into, default is 100. |
verbose |
logical, print details of vector and split, default is FALSE. |
list with vector of X length
Base code from stackoverflow post: https://stackoverflow.com/a/3321659/15568251
vector <- c("gene1", "gene2", "gene3", "gene4", "gene5", "gene6") vector_list <- Split_Vector(x = vector, chunk_size = 3)
vector <- c("gene1", "gene2", "gene3", "gene4", "gene5", "gene6") vector_list <- Split_Vector(x = vector, chunk_size = 3)
Code for creating stacked violin plot gene expression.
Stacked_VlnPlot( seurat_object, features, group.by = NULL, split.by = NULL, idents = NULL, x_lab_rotate = FALSE, plot_legend = FALSE, colors_use = NULL, color_seed = 123, ggplot_default_colors = FALSE, plot_spacing = 0.15, spacing_unit = "cm", vln_linewidth = NULL, pt.size = NULL, raster = NULL, add.noise = TRUE, ... )
Stacked_VlnPlot( seurat_object, features, group.by = NULL, split.by = NULL, idents = NULL, x_lab_rotate = FALSE, plot_legend = FALSE, colors_use = NULL, color_seed = 123, ggplot_default_colors = FALSE, plot_spacing = 0.15, spacing_unit = "cm", vln_linewidth = NULL, pt.size = NULL, raster = NULL, add.noise = TRUE, ... )
seurat_object |
Seurat object name. |
features |
Features to plot. |
group.by |
Group (color) cells in different ways (for example, orig.ident). |
split.by |
A variable to split the violin plots by, |
idents |
Which classes to include in the plot (default is all). |
x_lab_rotate |
logical or numeric. If logical whether to rotate x-axis labels 45 degrees (Default is FALSE). If numeric must be either 45 or 90. Setting 45 is equivalent to setting TRUE. |
plot_legend |
logical. Adds plot legend containing |
colors_use |
specify color palette to used in |
color_seed |
random seed for the "varibow" palette shuffle if |
ggplot_default_colors |
logical. If |
plot_spacing |
Numerical value specifying the vertical spacing between each plot in the stack.
Default is 0.15 ("cm"). Spacing dependent on unit provided to |
spacing_unit |
Unit to use in specifying vertical spacing between plots. Default is "cm". |
vln_linewidth |
Adjust the linewidth of violin outline. Must be numeric. |
pt.size |
Adjust point size for plotting. Default for |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 total points plotted (# Cells x # of features). |
add.noise |
logical, determine if adding a small noise for plotting (Default is TRUE). |
... |
Extra parameters passed to |
A ggplot object
Ming Tang (Original Code), Sam Marsh (Wrap single function, added/modified functionality)
https://twitter.com/tangming2005
library(Seurat) Stacked_VlnPlot(seurat_object = pbmc_small, features = c("CD3E", "CD8", "GZMB", "MS4A1"), x_lab_rotate = TRUE)
library(Seurat) Stacked_VlnPlot(seurat_object = pbmc_small, features = c("CD3E", "CD8", "GZMB", "MS4A1"), x_lab_rotate = TRUE)
Wrapper function save variety of data types to the object@misc
slot of Seurat object.
Store_Misc_Info_Seurat( seurat_object, data_to_store, data_name, list_as_list = FALSE, overwrite = FALSE )
Store_Misc_Info_Seurat( seurat_object, data_to_store, data_name, list_as_list = FALSE, overwrite = FALSE )
seurat_object |
object name. |
data_to_store |
data to be stored in |
data_name |
name to give the entry in |
list_as_list |
logical. If |
overwrite |
Logical. Whether to overwrite existing items with the same name. Default is FALSE, meaning
that function will abort if item with |
Seurat Object with new entries in the @misc
slot.
library(Seurat) clu_pal <- c("red", "green", "blue") pbmc_small <- Store_Misc_Info_Seurat(seurat_object = pbmc_small, data_to_store = clu_pal, data_name = "rd1_colors")
library(Seurat) clu_pal <- c("red", "green", "blue") pbmc_small <- Store_Misc_Info_Seurat(seurat_object = pbmc_small, data_to_store = clu_pal, data_name = "rd1_colors")
Wrapper function around Store_Misc_Info_Seurat
to store color palettes.
Store_Palette_Seurat( seurat_object, palette, palette_name, list_as_list = FALSE, overwrite = FALSE )
Store_Palette_Seurat( seurat_object, palette, palette_name, list_as_list = FALSE, overwrite = FALSE )
seurat_object |
object name. |
palette |
vector or list of vectors containing color palettes to store. If list of palettes
see |
palette_name |
name to give the palette(s) in |
list_as_list |
logical. If |
overwrite |
Logical. Whether to overwrite existing items with the same name. Default is FALSE, meaning
that function will abort if item with |
Seurat Object with new entries in the @misc
slot.
library(Seurat) clu_pal <- c("red", "green", "blue") pbmc_small <- Store_Misc_Info_Seurat(seurat_object = pbmc_small, data_to_store = clu_pal, data_name = "rd1_colors")
library(Seurat) clu_pal <- c("red", "green", "blue") pbmc_small <- Store_Misc_Info_Seurat(seurat_object = pbmc_small, data_to_store = clu_pal, data_name = "rd1_colors")
Modified ggprism theme which restores the legend title.
theme_ggprism_mod( palette = "black_and_white", base_size = 14, base_family = "sans", base_fontface = "bold", base_line_size = base_size/20, base_rect_size = base_size/20, axis_text_angle = 0, border = FALSE )
theme_ggprism_mod( palette = "black_and_white", base_size = 14, base_family = "sans", base_fontface = "bold", base_line_size = base_size/20, base_rect_size = base_size/20, axis_text_angle = 0, border = FALSE )
palette |
|
base_size |
|
base_family |
|
base_fontface |
|
base_line_size |
|
base_rect_size |
|
axis_text_angle |
|
border |
|
Returns a list-like object of class theme.
theme is a modified version of theme_prism
from ggprism package https://github.com/csdaw/ggprism
(License: GPL-3). Param text is from ggprism:theme_prism()
documentation theme_prism
.
Theme adaptation based on ggprism vignette
https://csdaw.github.io/ggprism/articles/themes.html#make-your-own-ggprism-theme-1.
# Generate a plot and customize theme library(ggplot2) df <- data.frame(x = rnorm(n = 100, mean = 20, sd = 2), y = rbinom(n = 100, size = 100, prob = 0.2)) p <- ggplot(data = df, mapping = aes(x = x, y = y)) + geom_point(mapping = aes(color = 'red')) p + theme_ggprism_mod()
# Generate a plot and customize theme library(ggplot2) df <- data.frame(x = rnorm(n = 100, mean = 20, sd = 2), y = rbinom(n = 100, size = 100, prob = 0.2)) p <- ggplot(data = df, mapping = aes(x = x, y = y)) + geom_point(mapping = aes(color = 'red')) p + theme_ggprism_mod()
Extract vector to the top loading genes for specified LIGER iNMF factor
Top_Genes_Factor(liger_object, liger_factor, num_genes = 10)
Top_Genes_Factor(liger_object, liger_factor, num_genes = 10)
liger_object |
LIGER object name. |
liger_factor |
LIGER factor number to pull genes from. |
num_genes |
number of top loading genes to return as vector. |
A LIGER Object
## Not run: top_genes_factor10 <- Top_Genes_Factor(liger_object = object, num_genes = 10) ## End(Not run)
## Not run: top_genes_factor10 <- Top_Genes_Factor(liger_object = object, num_genes = 10) ## End(Not run)
Shortcut for thematic modification to unrotate the x axis (e.g., for Seurat VlnPlot is rotated by default).
UnRotate_X(...)
UnRotate_X(...)
... |
extra arguments passed to |
Returns a list-like object of class theme.
library(Seurat) p <- VlnPlot(object = pbmc_small, features = "CD3E") p + UnRotate_X()
library(Seurat) p <- VlnPlot(object = pbmc_small, features = "CD3E") p + UnRotate_X()
Update human gene symbols using data from HGNC. This function will store cached data in package directory using (BiocFileCache). Use of this function requires internet connection on first use (or if setting update_symbol_data = TRUE
). Subsequent use does not require connection and will pull from cached data.
Updated_HGNC_Symbols( input_data, update_symbol_data = NULL, case_check_as_warn = FALSE, verbose = TRUE )
Updated_HGNC_Symbols( input_data, update_symbol_data = NULL, case_check_as_warn = FALSE, verbose = TRUE )
input_data |
Data source containing gene names. Accepted formats are:
|
update_symbol_data |
logical, whether to update cached HGNC data, default is NULL.
If |
case_check_as_warn |
logical, whether case checking of features should cause abort or only warn, default is FALSE (abort). Set to TRUE if atypical names (i.e. old LOC naming) are present in input_data. |
verbose |
logical, whether to print results detailing numbers of symbols, found, updated, and not found; default is TRUE. |
data.frame containing columns: input_features, Approved_Symbol (already approved; output unchanged), Not_Found_Symbol (symbol not in HGNC; output unchanged), Updated_Symbol (new symbol from HGNC; output updated).
## Not run: new_names <- Updated_HGNC_Symbols(input_data = Seurat_Object) ## End(Not run)
## Not run: new_names <- Updated_HGNC_Symbols(input_data = Seurat_Object) ## End(Not run)
Performs variable gene selection for LIGER object across the entire object instead of by dataset and then taking union.
Variable_Features_ALL_LIGER( liger_object, num_genes = NULL, var.thresh = 0.3, alpha.thresh = 0.99, tol = 1e-04, do.plot = FALSE, pt.size = 0.3, chunk = 1000 )
Variable_Features_ALL_LIGER( liger_object, num_genes = NULL, var.thresh = 0.3, alpha.thresh = 0.99, tol = 1e-04, do.plot = FALSE, pt.size = 0.3, chunk = 1000 )
liger_object |
LIGER object name. |
num_genes |
Number of genes to find. Optimizes the value of |
var.thresh |
Variance threshold. Main threshold used to identify variable genes. Genes with expression variance greater than threshold (relative to mean) are selected. (higher threshold -> fewer selected genes). |
alpha.thresh |
Alpha threshold. Controls upper bound for expected mean gene expression (lower threshold -> higher upper bound). (default 0.99) |
tol |
Tolerance to use for optimization if num.genes values passed in (default 0.0001). |
do.plot |
Display log plot of gene variance vs. gene expression. Selected genes are plotted in green. (Default FALSE) |
pt.size |
Point size for plot. |
chunk |
size of chunks in hdf5 file. (Default 1000) |
A LIGER Object with variable genes in correct slot.
Matching function parameter text descriptions are taken from rliger::selectGenes
which is called by this function after creating new temporary object/dataset.
https://github.com/welch-lab/liger. (License: GPL-3).
## Not run: liger_obj <- Variable_Features_ALL_LIGER(liger_object = liger_obj, num_genes = 2000) ## End(Not run)
## Not run: liger_obj <- Variable_Features_ALL_LIGER(liger_object = liger_obj, num_genes = 2000) ## End(Not run)
Creates variable features plot with N number of features already labeled by default.
VariableFeaturePlot_scCustom( seurat_object, num_features = 10, custom_features = NULL, label = TRUE, pt.size = 1, colors_use = c("black", "red"), repel = TRUE, y_axis_log = FALSE, assay = NULL, selection.method = NULL, ... )
VariableFeaturePlot_scCustom( seurat_object, num_features = 10, custom_features = NULL, label = TRUE, pt.size = 1, colors_use = c("black", "red"), repel = TRUE, y_axis_log = FALSE, assay = NULL, selection.method = NULL, ... )
seurat_object |
Seurat object name. |
num_features |
Number of top variable features to highlight by color/label. |
custom_features |
A vector of custom feature names to label on plot instead of labeling top variable genes. |
label |
logical. Whether to label the top features. Default is TRUE. |
pt.size |
Adjust point size for plotting. |
colors_use |
colors to use for plotting. Default is "black" and "red". |
repel |
logical (default TRUE). Whether or not to repel the feature labels on plot. |
y_axis_log |
logical. Whether to change y axis to log10 scale (Default is FALSE). |
assay |
Assay to pull variable features from. |
selection.method |
If more then one method use to calculate variable features specify which
method to use for plotting. See |
... |
Extra parameters passed to |
A ggplot object
library(Seurat) VariableFeaturePlot_scCustom(seurat_object = pbmc_small, num_features = 10)
library(Seurat) VariableFeaturePlot_scCustom(seurat_object = pbmc_small, num_features = 10)
Quick shortcuts to access viridis palettes
viridis_plasma_dark_high viridis_plasma_light_high viridis_inferno_dark_high viridis_inferno_light_high viridis_magma_dark_high viridis_magma_light_high viridis_dark_high viridis_light_high
viridis_plasma_dark_high viridis_plasma_light_high viridis_inferno_dark_high viridis_inferno_light_high viridis_magma_dark_high viridis_magma_light_high viridis_dark_high viridis_light_high
An object of class character
of length 250.
An object of class character
of length 250.
An object of class character
of length 250.
An object of class character
of length 250.
An object of class character
of length 250.
An object of class character
of length 250.
An object of class character
of length 250.
An object of class character
of length 250.
A color palette for plotting
## Not run: FeaturePlot_scCustom(object = seurat_object, features = "Cx3cr1", colors_use = viridis_plasma_dark_high, na_color = "lightgray") ## End(Not run)
## Not run: FeaturePlot_scCustom(object = seurat_object, features = "Cx3cr1", colors_use = viridis_plasma_dark_high, na_color = "lightgray") ## End(Not run)
Creates DimPlot with some of the settings modified from their Seurat defaults (colors_use, shuffle, label).
VlnPlot_scCustom( seurat_object, features, colors_use = NULL, pt.size = NULL, group.by = NULL, split.by = NULL, plot_median = FALSE, plot_boxplot = FALSE, median_size = 15, idents = NULL, num_columns = NULL, raster = NULL, add.noise = TRUE, ggplot_default_colors = FALSE, color_seed = 123, ... )
VlnPlot_scCustom( seurat_object, features, colors_use = NULL, pt.size = NULL, group.by = NULL, split.by = NULL, plot_median = FALSE, plot_boxplot = FALSE, median_size = 15, idents = NULL, num_columns = NULL, raster = NULL, add.noise = TRUE, ggplot_default_colors = FALSE, color_seed = 123, ... )
seurat_object |
Seurat object name. |
features |
Feature(s) to plot. |
colors_use |
color palette to use for plotting. By default if number of levels plotted is less than
or equal to 36 it will use "polychrome" and if greater than 36 will use "varibow" with shuffle = TRUE
both from |
pt.size |
Adjust point size for plotting. |
group.by |
Name of one or more metadata columns to group (color) cells by (for example, orig.ident); default is the current active.ident of the object. |
split.by |
Feature to split plots by (i.e. "orig.ident"). |
plot_median |
logical, whether to plot median for each ident on the plot (Default is FALSE). |
plot_boxplot |
logical, whether to plot boxplot inside of violin (Default is FALSE). |
median_size |
Shape size for the median is plotted. |
idents |
Which classes to include in the plot (default is all). |
num_columns |
Number of columns in plot layout. Only valid if |
raster |
Convert points to raster format. Default is NULL which will rasterize by default if greater than 100,000 total points plotted (# Cells x # of features). |
add.noise |
logical, determine if adding a small noise for plotting (Default is TRUE). |
ggplot_default_colors |
logical. If |
color_seed |
random seed for the "varibow" palette shuffle if |
... |
Extra parameters passed to |
A ggplot object
Many of the param names and descriptions are from Seurat to facilitate ease of use as this is simply a wrapper to alter some of the default parameters https://github.com/satijalab/seurat/blob/master/R/visualization.R (License: GPL-3).
library(Seurat) VlnPlot_scCustom(seurat_object = pbmc_small, features = "CD3E")
library(Seurat) VlnPlot_scCustom(seurat_object = pbmc_small, features = "CD3E")