Skip to content

Instantly share code, notes, and snippets.

View oganm's full-sized avatar
🤦‍♂️

B. Ogan Mancarcı oganm

🤦‍♂️
View GitHub Profile
#!/usr/bin/env Rscript
library(magrittr)
library(reshape2)
d <- read.csv("FINAL LAB DATA Mar 23 2017.csv", colClasses="character", fileEncoding = "UTF-8-BOM")
d <- d[order(d$ID),]
# assign each visit a number (per patient)
visit.numbers <- tapply(d$Collection.Date, d$ID, function (x)
{
"data": [
{
"name": "050512MJA_U133_2.0_IB29.CEL",
"description": "",
"sequencePairedReads": null,
"sequenceReadCount": null,
"sequenceReadLength": null,
"outlier": false,
"metadata": null,
@oganm
oganm / lazyShreejoy.R
Created October 26, 2017 03:18
marker heatmap for shreejoy
devtools::install_github('oganm/neuroExpressoAnalysis')
library(neuroExpressoAnalysis)
devtools::install_github('oganm/ogbox')
library(ogbox)
devtools::install_github('oganm/markerGeneProfile')
library(markerGeneProfile)
library(scales)
library(gplots)
library(stringr)
@oganm
oganm / shinyJsLogicalConclusion.R
Created January 8, 2018 08:40
ShinyJSLogicalConclusion
extendShinyjsEvenFurther = function(){
jscode <- '
Shiny.addCustomMessageHandler("mymessage", function(message) {
eval(message);
});
'
tags$head(tags$script(HTML(jscode)))
}
jsExecute = function(jscode,session){
@oganm
oganm / app.R
Created January 30, 2018 20:50
Update progress bar check to try on windows
library(shiny)
library(shinyWidgets)
moduleUI = function(id){
ns = NS(id)
tagList(actionButton(inputId = ns('update'),label = 'update'),
progressBar(id = "progressBar", value = 50),
checkboxInput(inputId = ns('checkbox'),label = 'shinyCheckbox',value = FALSE))
}
@oganm
oganm / addSRD.R
Last active February 22, 2018 02:16
Editing grimoire
library(stringr)
library(magrittr)
library(pdftools)
library(Hmisc)
capitalizeAll = function(x){
words = strsplit(x, ' ') %>% {.[[1]]}
capital = sapply(words, function(x){
if(x %in% c('for','of','and','to','into','with','the','from','via')){
return(x)
@oganm
oganm / ontologyPlay.R
Created February 14, 2018 01:31
playing with ontologies
# ontologyPlot package requires bioconductor package Rgraphvis
# source("https://bioconductor.org/biocLite.R")
# biocLite("Rgraphvis")
# install.packages('ontologyIndex')
# install.packages('ontologyPlot')
library(ontologyIndex)
library(ontologyPlot)
download.file(url = 'http://purl.obolibrary.org/obo/uberon.obo',destfile = 'uberon.obo')
@oganm
oganm / geneListCellCode.R
Created February 20, 2018 00:42
CellCODE with gene lists
library(CellCODE)
library(dplyr)
library(purrr)
library(magrittr)
library(markerGeneProfile)
data('mouseMarkerGenesCombined')
# this function will turn gene lists into CellCODE inputs
cellCodeInput = function(genes){
geneCount = genes %>% map(length)
@oganm
oganm / lilahFiles.R
Created May 15, 2018 05:03
lilah's gene list for publication
regions = c('Cortex','Hippocampus','Striatum','Cerebellum','Thalamus')
regions %>% lapply(function(x){
cellTypes = names(mouseMarkerGenesCombined[[x]])
cellTypes %>% lapply(function(y){
data.frame(symbol = mouseMarkerGenesCombined[[x]][[y]], NCBIid = mouseMarkerGenesCombinedNCBI[[x]][[y]])
})
})
@oganm
oganm / compileChars.R
Created July 17, 2018 01:52
compile chars backup
library(import5eChar)
library(purrr)
library(ogbox)
library(dplyr)
library(ggplot2)
library(stringr)
library(igraph)
library(glue)
library(cowplot)
charFiles = c(list.files('/srv/shiny-server/printSheetApp/chars/',full.names = TRUE),