Skip to content

Instantly share code, notes, and snippets.

View dgrapov's full-sized avatar

Dmitry Grapov dgrapov

View GitHub Profile
@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 / dplyr_tutorial.Rmd
Created April 28, 2015 23:21
hands on with dplyr
---
title: "Hands-on with dplyr"
author: "Dmitry Grapov"
output:
html_document:
keep_md: yes
---
## Introduction
@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 / 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 / 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 / Data Summaries and Tests
Created November 12, 2013 17:13
Example of data summary tools.
#demonstration of data summary tools
#enable necessary functions
source("http://pastebin.com/raw.php?i=JVyTrYRD")
#get demo data
library(RCurl)
url<-getURL("https://docs.google.com/spreadsheet/pub?key=0Ap1AEMfo-fh9dGFHRk81cVJaMTIxUjQzSlo2RS1RZXc&single=true&gid=0&output=csv",ssl.verifypeer = FALSE)
tmp.data<-read.csv(textConnection(url))
#Prepare to generate data summaries and conduct statitcal tests
@dgrapov
dgrapov / server.R
Last active December 20, 2015 14:39
compare skewed to normal distrubution
shinyServer(function(input,output){
mydat <- reactive(function() {
scale(rsnorm(input$obs, location = input$mean, scale =input$variance,
shape = input$skew),center=TRUE,scale=TRUE)
})
ndat <- reactive(function() {
scale(rnorm(input$obs, mean = input$mean, sd =input$variance),center=TRUE, scale=TRUE)
})
@dgrapov
dgrapov / server.R
Last active December 20, 2015 14:29 — forked from jknowles/server.R
# Script to demonstrate distributions
library(VGAM)
library(eeptools)
library(shiny)
library(ggplot2)
shinyServer(function(input,output){
@dgrapov
dgrapov / server.r
Last active October 24, 2016 12:43
Testing Shiny input text area. Based on http://stackoverflow.com/questions/14452465/how-to-create-textarea-as-input-in-a-shiny-webapp-in-r. Need to put .js in www folder.
shinyServer(function(input, output, session) {
inputTextarea <- function(inputId, value="", nrows, ncols) {
tagList(
singleton(tags$head(tags$script(src = "textarea.js"))),
tags$textarea(id = inputId,
class = "inputtextarea",
rows = nrows,
cols = ncols,
as.character(value))
)
@dgrapov
dgrapov / query PubMed
Last active December 19, 2015 00:48
Check for key word in PubMed article titles
#Check pubmed article titles for a given year for a keyword (using partial matching).
library(XML)
library(stringr)
#get PubMed Ids for all journals for a given year
getPubMedIds<-function(year=2013, max=100){
#max = maximum results to return
url<-paste0("http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=",year,"[PDAT]&RetMax=",max)