Skip to content

Instantly share code, notes, and snippets.

Dmitry Grapov dgrapov

Block or report user

Report or block dgrapov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dgrapov
dgrapov / correlation edge list
Last active Aug 29, 2015
Making edge lists for correlation networks
View correlation edge list
#------------------------------------------------------
# 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 Apr 14, 2014
Test data set for ID translation
View mapping test set
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 Aug 29, 2015
edge list for making oxylipin networks (partial)
View oxylipins edge list
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 Aug 29, 2015
ggvis linked brushing bug
View app
library(shiny)
library(ggvis)
shinyApp(
ui =bootstrapPage(
actionButton("randomize", "Randomize"),
ggvisOutput("plot1"),
ggvisOutput("plot2"),
verbatimTextOutput("summary")
),
@dgrapov
dgrapov / RECA_test.R
Created Aug 21, 2015
Testing RECA: Relevant Component Analysis for Supervised Distance Metric Learning
View RECA_test.R
#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 / example.R
Last active Sep 21, 2015
Convert adjacency (or other) matrix to edge list
View example.R
library(reshape2)
gen.mat.to.edge.list<-function(mat,symmetric=TRUE,diagonal=FALSE,text=FALSE){
#create edge list from matrix
# if symmetric duplicates are removed
mat<-as.matrix(mat)
id<-is.na(mat) # used to allow missing
mat[id]<-"nna"
if(symmetric){mat[lower.tri(mat)]<-"na"} # use to allow missing values
if(!diagonal){diag(mat)<-"na"}
View test.r
#test
test<-function(){print("hello world!")}
View plotting power calculations
#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
View load devium.r
#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 Dec 13, 2015
CID_KEGG pairs
View CID_KEGG pairs
689043 C01197
6443013 C14762
6443013 C14762
6446027 C14765
6446027 C14765
11954058 C14813
6439873 C16326
6439873 C16326
1004 C00009
1023 C00013
You can’t perform that action at this time.