Skip to content

Instantly share code, notes, and snippets.

View FloWuenne's full-sized avatar
💻

Florian Wuennemann FloWuenne

💻
View GitHub Profile
@FloWuenne
FloWuenne / extract_shiny_clustering_renamed_full.R
Last active May 2, 2018 20:28
Extract shiny clustering data for full dataset
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"))
@FloWuenne
FloWuenne / cluster_module_shiny_ALL_renamed.R
Last active April 26, 2018 14:12
Create shiny cluster modules for renamed datasets
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"))
@FloWuenne
FloWuenne / extract_shiny_data_Full_dataset.R
Last active April 26, 2018 14:31
Create an Rds file for the full heart maturation dataset
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"))
@FloWuenne
FloWuenne / gist:b2c31b18f60fbe1ffa20ca72e3006f5b
Created April 20, 2018 17:51
Takes as input an Rds file for clustering module (.Rmd code)
---
title: "Transform_to_feather"
author: "Florian Wuennemann"
date: "April 20, 2018"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
@FloWuenne
FloWuenne / gist:4a4c1532011186e1c5aae3150556b5c6
Created April 18, 2018 15:03
Make a nice ClusterTree from the initial ClusterTree plot from Seurat
## Build the ClusterTree from Seurat object
expression_seurat <- BuildClusterTree(expression_seurat,
do.plot=TRUE)
## Plot custom phylogenetic tree that is more easily interpretable
png(filename="./with_Batch_Cycle_Correction/ClusterTree.png", width=1800, height=1700, bg = "white", res = 150)
plot(ladderize([email protected][[1]]), adj=0,
label.offset=50,
edge.width=1)
nodelabels(frame="circle",bg="grey")
@FloWuenne
FloWuenne / Clustering_module_shiny_ALL_Rds.R
Last active April 20, 2018 19:17
Create clustering module for shiny server for all timepoints
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"))
@FloWuenne
FloWuenne / Run_clustering_module_Rds.R
Last active April 27, 2018 13:53
Run certain gists in R from GithubGist
library(devtools)
#### Specific datasets
## Specific time point Rds
source_gist("https://gist.github.com/FloWuenne/df2dca6804f562ed90db26a04508af31", filename = "Create_clustering_module_Rds.R")
## Specific time point .Rdata
source_gist("https://gist.github.com/FloWuenne/dfd1e00c198b2ae1adeb16720a844441",, filename = "Create_clustering_module_Rds.R")
#### All datasets
@FloWuenne
FloWuenne / Create_clustering_module_Rds.R
Last active April 17, 2018 20:03
Create .Rds object with components needed for clustering module of heartmat shiny server (for .Rds)
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
@FloWuenne
FloWuenne / extract_ALL_shiny_data.R
Last active April 17, 2018 17:55
Extract data for clustering module from all time points (For .Rdata)
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=""))
@FloWuenne
FloWuenne / extract_shiny_data.R
Last active April 17, 2018 12:35
Create .Rdata file from Seurat object for clustering module of shiny server (for .Rdata)
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