Skip to content

Instantly share code, notes, and snippets.

View dgrapov's full-sized avatar

Dmitry Grapov dgrapov

View GitHub Profile
@dgrapov
dgrapov / correlation edge list
Last active August 29, 2015 13:57
Making edge lists for correlation networks
#------------------------------------------------------
# demonstration of making edge lists for
# correlation network analysis
# by Dmitry Grapov
# 031814
#------------------------------------------------------
# load devium library for all functions
source("http://pastebin.com/raw.php?i=JVyTrYRD") # sources function to download github repo (https://github.com/dgrapov/devium)
@dgrapov
dgrapov / mapping test set
Created April 14, 2014 16:15
Test data set for ID translation
Name KEGG id
Carnitine C00318
catechin C06562
threonine C00188
threonic acid C01620
phenylethylamine C05332
phenylalanine C00079
N-acetyl-L-ornithine C00437
mannitol C00392
glutathione C00051
@dgrapov
dgrapov / oxylipins edge list
Last active August 29, 2015 14:02
edge list for making oxylipin networks (partial)
sourceName sourceKEGG sourceCID targetName targetKEGG targetCID indirect
arachidonic_acid C00219 444899 TXB2 C05963 5283137 y
arachidonic_acid C00219 444899 PGE2 C00584 5280360 y
arachidonic_acid C00219 444899 LTB4 C02165 5280492 y
linoleic_acid C01595 5280450 9,10,13-TriHOME C14835 5282965 y
linoleic_acid C01595 5280450 9,12,13-TriHOME C14833 9858729 y
linoleic_acid C01595 5280450 EKODE 5283007 y
arachidonic_acid C00219 444899 11(12)-EpETrE 53480479 n
arachidonic_acid C00219 444899 11-HETE C14780 5283168 n
arachidonic_acid C00219 444899 12-HETE C14777 5283155 n
@dgrapov
dgrapov / app
Last active August 29, 2015 14:20
ggvis linked brushing bug
library(shiny)
library(ggvis)
shinyApp(
ui =bootstrapPage(
actionButton("randomize", "Randomize"),
ggvisOutput("plot1"),
ggvisOutput("plot2"),
verbatimTextOutput("summary")
),
@dgrapov
dgrapov / RECA_test.R
Created August 21, 2015 13:42
Testing RECA: Relevant Component Analysis for Supervised Distance Metric Learning
#R code, testing RECA with the iris data
library(RECA)
#test data
data(iris)
x<-iris[,-5]
y<-iris$Species
#similar groups (species) in each chunk (n=3)
chunksvec<-as.numeric(y)
@dgrapov
dgrapov / test.r
Last active December 10, 2015 22:48
test
#test
test<-function(){print("hello world!")}
#purpose: model the relationship between effects size, sample size and power
# holding the significance level constant (p = 0.05) for three of the most common statistical tests:
# 1) t-Test (two-sample)
# then visualize the results for medium small, medium and large effect sizes (0.2,0.5,0.8 ; http://www.uccs.edu/lbecker/effect-size.html)
#Need pwr package
if(!require(pwr)){install.packages("pwr");library("pwr")}
# t-TEST
#load devium (or any other package) from github repo
source.git.hub<-function(url = "https://github.com/dgrapov/devium/tree/master/R")
{
if(require(RCurl)==FALSE){install.packages("RCurl");library(RCurl)} else { library(RCurl)}
#get the names of all scripts to source
obj<-getURL("https://github.com/dgrapov/devium/tree/master/R",ssl.verifypeer=FALSE)
tmp<-strsplit(obj,'href=\"/')
tmp2<-unlist(strsplit(as.character(unlist(tmp)),'class'))
scripts<-gsub("/blob","",gsub('\" ',"",tmp2[grep("dgrapov/devium/blob/master/R/",tmp2)])) # fix formatting
@dgrapov
dgrapov / CID_KEGG pairs
Last active December 13, 2015 19:39
CID_KEGG pairs
689043 C01197
6443013 C14762
6443013 C14762
6446027 C14765
6446027 C14765
11954058 C14813
6439873 C16326
6439873 C16326
1004 C00009
1023 C00013
C00005 C00006
C00003 C00004
C00002 C00008
C00019 C00021
C00007 C00027
C00010 C00024
C00002 C00020
C00002 C00013
C00002 C00009
C00015 C00029