Skip to content

Instantly share code, notes, and snippets.

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

B. Ogan Mancarcı oganm

🤦‍♂️
View GitHub Profile
@oganm
oganm / add_links.R
Created October 4, 2024 20:37
GSE add links
@oganm
oganm / ethanol.R
Created February 7, 2024 23:28
alcoholic gemma
devtools::load_all()
library(magrittr)
datasets <- get_datasets(uris = 'http://purl.obolibrary.org/obo/MONDO_0000408')
relevant_terms <- attributes(datasets)$filter %>% stringr::str_extract_all('http.*?(?=,|\\))') %>% {.[[1]]}
relevant_terms %<>% c('http://purl.obolibrary.org/obo/CHEBI_16236')
dataset_contrasts <- datasets$experiment.shortName %>%
lapply(function(x){
@oganm
oganm / replace.R
Created April 19, 2023 22:09
Term replacement
library(RCurl)
library(xml2)
library(dplyr)
library(stringr)
obsolete <- readr::read_tsv('obsolete-terms.txt')
# get our ontology files
ontologies <- system2("ssh" ,paste0(ontology_server," ls ", ontology_path),stdout = TRUE)
@oganm
oganm / roll20Message.R
Created August 29, 2020 03:38
send messages to roll20 chat using chromote
library(chromote)
startRoll20Session = function(email, password, gameLink,view = FALSE){
b <- chromote::ChromoteSession$new()
if(view){
b$view()
}
b$Page$navigate(gameLink)
b$DOM$enable()
@oganm
oganm / differential download.r
Last active August 10, 2020 12:18
yeast download for jesse
library(gemmaAPI)
# identify all yeast datasets
yeastStudies = taxonInfo('yeast',request = 'datasets',limit = 0)
studyIDs = yeastStudies %>% purrr::map_chr('id')
# get metadata for yeast studies
yeastMetadata = studyIDs %>% lapply(compileMetadata,outputType = 'list')
@oganm
oganm / flagCoords.R
Last active April 7, 2020 14:16
flagCoords
# source https://en.wikipedia.org/wiki/Flag_of_Turkey
# suggested width for narrow images
coverWidth = 590
starOverlap = 2/5-1/3
# approximate and arbitrary
G = coverWidth* (4/3 - starOverlap)
@oganm
oganm / install.R
Last active April 7, 2020 14:27
install arbitrary packages from command line
#!/usr/bin/Rscript
# Rscript install.R packageName
# point of this is to be able to install arbitrary packages from CRAN, github, bioconductor, etc from command line
# used for my remote server where I use the root library to share packages between my user and the shiny user
# sudo install.R glue oganm/ogbox bioc::3.6/affy
library(dplyr)
library(ogbox)
print(.libPaths())
@oganm
oganm / pkgRank.R
Created May 8, 2019 21:40
cranlogs package rank
library(cranlogs)
library(dplyr)
allPackages = available.packages() %>% rownames
groups = cut(seq_along(allPackages), breaks = seq(0,length(allPackages),20)) %>% {.=as.character(.);.[is.na(.)]='last';factor(.,levels = unique(.))}
package_groups = split(allPackages,groups)
package_groups %>% lapply(function(x){
@oganm
oganm / terrainStuff.R
Created March 26, 2019 21:44
terrain stuff
library(rayshader)
library(ambient)
k = 8
m = noise_perlin(dim = c(2^k,2^k),octaves = 9)
mToMap(m)
m = noise_simplex(c(2^k,2^k),fractal = 'fbm',octaves = 4,lacunarity = 2,gain = .5,frequency = .01)
@oganm
oganm / notes.lua
Created February 9, 2019 22:56
luanotes
for i in pairs(table) do print(i) end -- list things in table