Skip to content

Instantly share code, notes, and snippets.

View gungorbudak's full-sized avatar

Gungor Budak gungorbudak

View GitHub Profile
@gungorbudak
gungorbudak / multiplot.R
Created January 16, 2016 22:56
Multiple graphs on one page (ggplot2)
# Multiple plot function
#
# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)
# - cols: Number of columns in layout
# - layout: A matrix specifying the layout. If present, 'cols' is ignored.
#
# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
# then plot 1 will go in the upper left, 2 will go in the upper right, and
# 3 will go all the way across the bottom.
#
@gungorbudak
gungorbudak / a^nb^2nc^3n.yaml
Created May 26, 2018 12:32
Turing machine for a^nb^2nc^3n for n >= 0
name: a^nb^2nc^3n
source code: |
input: 'aabbbbcccccc'
blank: '_'
start state: start
table:
start:
a: {write: x, R: q1}
y: {R: start}
z: {R: start}
import os
import networkx as nx
WORKDIR = ''
IREFINDEX_FILE = os.path.join(WORKDIR, '9606.mitab.01-22-2018.txt')
def parse_irefindex_alias(alias):
splits = alias.split('|')
@gungorbudak
gungorbudak / read.pc2.gmt.R
Created December 27, 2019 12:18
Utility function to read and parse GMT file provided by Pathway Commons into R
library(stringr)
read.pc2.gmt <- function(file, organism=9606, datasource='kegg', idtype='hgnc symbol') {
# utility function to read and parse GMT file
# provided by Pathway Commons into R
# i.e. https://www.pathwaycommons.org/archives/PC2/v12/PathwayCommons12.All.hgnc.gmt.gz
gmt <- list()
con <- file(file, open='r')
for (line in readLines(con)) {
line_parts <- unlist(strsplit(line, '\t'))
desc_keys <- c('name', 'datasource', 'organism', 'idtype')
@gungorbudak
gungorbudak / mannwhitneyu.js
Last active October 17, 2023 16:24
Mann Whitney U test Javascript implementation
'use strict';
(function(exports) {
var rank = {
/*
* Standart ranking
*
* The MIT License, Copyright (c) 2014 Ben Magyar
*/