Skip to content

Instantly share code, notes, and snippets.

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

B. Ogan Mancarcı oganm

🤦‍♂️
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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)
{
"data": [
{
"name": "050512MJA_U133_2.0_IB29.CEL",
"description": "",
"sequencePairedReads": null,
"sequenceReadCount": null,
"sequenceReadLength": null,
"outlier": false,
"metadata": null,
#!/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)
# if added to a shiny server, fixes the range of the slider to a predetermined length
oldSliderCoordinates = reactiveValues(range1 = data$date %>% max %>% subtract(sliderSize), # initial slider location 1
range2 = data$date %>% max) # initial slider location 2
observe({
range = input$dateRange[2] - input$dateRange[1]
range %<>% as('numeric')
if(range > sliderSize){
if(input$dateRange[2]!= oldSliderCoordinates$range2){
@oganm
oganm / explicit.R
Last active January 7, 2017 16:14
library(dplyr)
library(magrittr)
baseR = c('base','compiler','datasets','graphics','grDevices','grid','methods','parallel','splines','stats','stats4','tcltk','utils')
explicit = function(fileIn,fileOut,
ignore = baseR){
file = readLines(fileIn)