This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| library(Seurat) | |
| # Find specific markers for each cell type | |
| # Find specific markers for each cell type | |
| celltypes <- unique(expression_seurat_subset@ident) # list of cell types (unique ident labels of Seurat object) | |
| obj <- expression_seurat_subset # Seurat object | |
| specific_markers <- NULL | |
| # First we do all pairwise comparisons and retain any markers that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Basic function to convert human to mouse gene names | |
| convertHumanGeneList <- function(x){ | |
| require("biomaRt") | |
| human = useMart("ensembl", dataset = "hsapiens_gene_ensembl") | |
| mouse = useMart("ensembl", dataset = "mmusculus_gene_ensembl") | |
| genesV2 = getLDS(attributes = c("hgnc_symbol"), filters = "hgnc_symbol", values = x , mart = human, attributesL = c("mgi_symbol"), martL = mouse, uniqueRows=T) | |
| humanx <- unique(genesV2[, 2]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ##Plotting theme from (https://rpubs.com/Koundy/71792) | |
| theme_Publication_custom <- function(base_size=14, base_family="helvetica") { | |
| library(grid) | |
| library(ggthemes) | |
| (theme_foundation(base_size=base_size, base_family=base_family) | |
| + theme(plot.title = element_text(face = "bold", | |
| size = rel(1.2), hjust = 0.5), | |
| text = element_text(), | |
| panel.background = element_rect(colour = NA), | |
| plot.background = element_rect(colour = NA), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Plot PCA for ethnicity of a given VCF file | |
| ## Import publication theme | |
| ## A nice R ggplot theme that I found online. Original can be found here: | |
| ## https://rpubs.com/Koundy/71792 | |
| theme_Publication <- function(base_size=14, base_family="helvetica") { | |
| library(grid) | |
| library(ggthemes) | |
| (theme_foundation(base_size=base_size, base_family=base_family) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## 3.0 contains all regulons that are considered for AUCell scoring | |
| load("./int/3.0_regulons_forAUCell.RData") | |
| ## Define the gene you would like to find | |
| gene_of_interest <- "" | |
| ## Iterates over all regulon names in regulons and searches the gene of interest inside the regulon. | |
| for(reg in names(regulons)){ | |
| if(gene_of_interest %in% regulons[[reg]]){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ```{r} | |
| library(tidyr) | |
| library(dplyr) | |
| seurat_object <- seurat_objects.combined | |
| grouping_var <- "Treatment" | |
| cells_for_all_clusters <- data.frame() | |
| #colnames(cells_for_all_clusters) <- c("WT","THC","CBS") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ```{r} | |
| ## Read in some test data | |
| colorectal <- readRDS("D:/Studies_PhD/Single_Cell_data/colorectal_cancer_Li_et_al_2017_SCESet.rds") | |
| ``` | |
| ```{r} | |
| sData <- scDataConstructor(as.matrix(colorectal)) | |
| sData <- determineDropoutCandidates(sData) | |
| #sData <- wThreshold(sData) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(dplyr) | |
| library(tidyr) | |
| time_point <- readline(prompt="Enter time point: ") | |
| ## Load Seurat object | |
| seurat_object <- readRDS(paste("../Objects/",time_point,".Seurat_object.Rds",sep="")) | |
| ## Normalized expression data | |
| norm_exprs_sparse <- seurat_object@data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(dplyr) | |
| library(tidyr) | |
| time_points <- c("E14.5","E16.5","E18.5","P1","P4","P7") | |
| for(time_point in time_points){ | |
| ## Load Seurat object | |
| seurat_object <- readRDS(paste("../Objects/",time_point,".Seurat_object.Rds",sep="")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(dplyr) | |
| library(tidyr) | |
| ## Define S4 object with required components | |
| Clustering_info <- setClass("clustering_module",slots=c(tsne="data.frame", | |
| metadata="data.frame", | |
| norm_exprs="data.frame", | |
| marker_list="data.frame")) | |
| ## Let user enter the time point to process |