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
for i in pairs(table) do print(i) end -- list things in table |
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) | |
generatePatterns = function(patterns, # final outputs here | |
helperPatterns = NULL, # intermediate patterns that won't be returned here | |
.open= '{', .close = '}'){ | |
for (i in seq_along(helperPatterns)){ | |
helperPatterns[[i]] = with(helperPatterns[1:i], | |
{glue::glue(helperPatterns[[i]], |
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) | |
diamonds = ggplot2::diamonds | |
filterBy = 'color' | |
diamonds %>% filter(!!rlang::sym(filterBy) == 'E') | |
diamonds %>% group_by(!!rlang::sym(filterBy)) | |
diamonds %>% mutate(!!rlang::sym('new_col'):='yes') |
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(OpenImageR) | |
library(oro.dicom) | |
library(dplyr) | |
library(magrittr) | |
library(magick) | |
dicompath = '/home/omancarci/Dropbox/MRI' | |
imageFiles = list.files(file.path(dicompath,'DICOM'),recursive = TRUE,full.names = TRUE) |
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) | |
# available names stolen from https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go---------------------- | |
left = c("admiring", | |
"adoring", | |
"affectionate", | |
"agitated", | |
"amazing", | |
"angry", | |
"awesome", |
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
getGithubFile = function(githubPath,branch = 'master', downloadPath = NULL,token = NULL){ | |
if(is.null(downloadPath)){ | |
downloadPath = tempfile() | |
} | |
path = strsplit(githubPath,'/')[[1]] | |
file = paste(path[3:length(path)], collapse = '/') | |
contents = gh::gh('GET /repos/:username/:reponame/contents/:dir?ref=:branch', | |
username = path[1], | |
reponame = path[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
# this is to get data from a single git repository | |
library(dplyr) | |
library(anytime) | |
library(patchwork) | |
library(ggplot2) | |
commits = git2r::commits() | |
commitTime= commits %>% sapply(function(x){x$author$when$time}) %>% anytime |
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(magrittr) | |
library(dplyr) | |
library(homologene) | |
library(gemmaAPI) # github.com/pavlidisLab/gemmaAAPI.R | |
library(markerGeneProfile) # github.com/pavlidisLab/markerGeneProfile | |
data("mouseMarkerGenesCombined") | |
# get mouse homologues of the hitlist | |
hitlist = readxl::read_xlsx('gene of interest.xlsx',col_names = FALSE) %>% | |
unlist %>% human2mouse %$% mouseGene |
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(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), |
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
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]]) | |
}) | |
}) |