Skip to content

Instantly share code, notes, and snippets.

Avatar

David Jenkins dfjenkins3

View GitHub Profile
@dfjenkins3
dfjenkins3 / createSCTKE_from_Rsubread_and_multiqc.R
Created Jul 25, 2018
Create SCTKE from Rsubread and multiqc
View createSCTKE_from_Rsubread_and_multiqc.R
library(singleCellTK)
createSCTKE_from_Rsubread_and_multiqc <- function(matdir, r1multi, r2multi){
r1annot <- read.table(r1multi, sep="\t", row.names = 1, header=TRUE)
colnames(r1annot) <- paste0(colnames(r1annot), "_R1")
rownames(r1annot) <- gsub("_R1$", "", rownames(r1annot))
r2annot <- read.table(r2multi, sep="\t", row.names = 1, header=TRUE)
colnames(r2annot) <- paste0(colnames(r2annot), "_R2")
rownames(r2annot) <- gsub("_R2$", "", rownames(r2annot))
if(any(rownames(r1annot)!=rownames(r2annot))){
@dfjenkins3
dfjenkins3 / cellranger_dir_to_sctke.R
Last active Jun 7, 2018
Convert Cell Ranger outs Directory to a SingleCelltkExperiment
View cellranger_dir_to_sctke.R
#' Convert Cell Ranger outs Directory to a SingleCelltkExperiment
#'
#' This function creates a SingleCelltkExperiment object from a Cell Ranger
#' output directory. The filtered count matrix, pca, tsne, and clustering
#' results are stored in the object. This function requires the cellrangerRkit
#' package which is not on CRAN or Bioconductor. Install it using the directions
#' available here:
#'
#' https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/rkit
#'
@dfjenkins3
dfjenkins3 / runlimma.R
Created May 11, 2017
Simple Limma Function
View runlimma.R
library(limma)
library(edgeR)
# function to return the toptable from limma
# indata: raw count matrix for all kras comparisons
# subsetcols: column indices for columns that you want to subset
# firstannot: the name of the first annotation
# secondannot: the name of the second annotation
get_toptable <- function(indata, subsetcols, firstannot, secondannot){
subset_gfp_wt <- indata[,subsetcols]
@dfjenkins3
dfjenkins3 / read10x.R
Created May 5, 2017
Using cellrangerRkit to read in 10X genomics results in R
View read10x.R
#credit to @myajima
library(cellrangerRkit) #install using https://s3-us-west-2.amazonaws.com/10x.files/supp/cell-exp/rkit-install-1.1.0.R
pipestance_path <-getwd()
download_sample(sample_name="pbmc3k",
sample_dir=pipestance_path,
host="https://s3-us-west-2.amazonaws.com/10x.files/samples/cell/")
gbm <- load_cellranger_matrix(pipestance_path)
@dfjenkins3
dfjenkins3 / code.R
Last active Apr 30, 2017
Example ComplexHeatmap
View code.R
create_complexheatmap <- function(indata){
set.seed(123)
sample.annotation <- data.frame(SampleType=sample(c("groupA","groupB"),
size = ncol(indata),
replace = TRUE))
topha <- HeatmapAnnotation(df = sample.annotation,
col = list(SampleType = c("groupA" = "coral3",
"groupB" = "aquamarine4")),
@dfjenkins3
dfjenkins3 / hist_widget.R
Last active Apr 18, 2017
Shiny Widget Example
View hist_widget.R
library(shiny)
hist_widget <- function() {
shinyApp(
ui = fluidPage(
sidebarLayout(
sidebarPanel(sliderInput("n", "Bins", 5, 100, 20)),
mainPanel(plotOutput("hist"))
)
),
View keybase.md

Keybase proof

I hereby claim:

  • I am dfjenkins3 on github.
  • I am dfjenkins3 (https://keybase.io/dfjenkins3) on keybase.
  • I have a public key whose fingerprint is 596F 88F4 BA92 A8AE BB47 7D84 8916 F2F3 B5CA 1207

To claim this, I am signing this object:

View pca.R
#run PCA
pca.results <- prcomp(t(expression))
#vector of colors
cols <- as.character(indata$Annotation)
cols[cols=="K"] <- 'red'
cols[cols=="LG"] <- 'lightgreen'
cols[cols=="G"] <- 'darkgreen'
#plot it
@dfjenkins3
dfjenkins3 / compare_tggates_drugmatrix.md
Created Dec 17, 2015
Comparing GenTox with Bacterial.Mutagenesis
View compare_tggates_drugmatrix.md

Comparing GenTox with Bacterial.Mutagenesis

library(Biobase)

setwd(file.path("C:","Users","djenk","OneDrive","grad_school","05-2015_fall",
                "BS830_microarray","20151218-Final_Project"))

#TG-GATEs Data (Discovery Set)
@dfjenkins3
dfjenkins3 / compare_tggates_drugmatrix.Rmd
Created Dec 17, 2015
Comparing GenTox with Bacterial.Mutagenesis
View compare_tggates_drugmatrix.Rmd
# Comparing GenTox with Bacterial.Mutagenesis
```{r}
library(Biobase)
setwd(file.path("C:","Users","djenk","OneDrive","grad_school","05-2015_fall",
"BS830_microarray","20151218-Final_Project"))
#TG-GATEs Data (Discovery Set)
load("Rat.Liver.in_vivo.repeat.annotated.RData")