This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(RJSONIO) | |
# locations will be an array of objects in JSON | |
# expected serialization: {"locations": [ {"path":"https://s3.amazonaws.com/foo/bar/", "type":"awss3"} ]} | |
e1 <- list(locations=list(list(path="https://s3.amazonaws.com/foo/bar/",type="awss3"))) | |
e2 <- fromJSON(toJSON(e1)) | |
if(!(names(e2) == 'locations')) | |
stop("Roundtrip R->JSON->R failed names") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Predictive Modeling: Drug Response in Cancer Cell Lines | |
======================================================= | |
This is a demo of **Knitr**, an R package for authoring executable documents, documents that mix formatted text, source code and graphical output. I've used In Sock's demos of drug response in [CCLE][1] data, but I've probably gotten most of the analysis mixed up. Apologies to In Sock. | |
Analysis of cancer cell lines for drug sensitity using: | |
* [Cancer Cell Line Encyclopedia][1] | |
* [Gene Set Enrichment Analysis][2] | |
Workflow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Compute the intersection of all combinations of the | |
## elements in the list of vectors l. Might be useful | |
## for generating Venn/Euler diagrams. | |
## There might be better ways to do this! | |
overlap <- function(l) { | |
results <- list() | |
# combinations of m elements of list l | |
for (m in seq(along=l)) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(MASS) | |
CreateSigma <- function(rho, p) { | |
aux1 <- matrix(rep(1:p, p), p, p) | |
aux2 <- matrix(rep(1:p, each = p), p, p) | |
rho^abs(aux1 - aux2) | |
} | |
rho <- 0.5 | |
p <- 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(MASS) | |
library(synapseClient) | |
## create a matrix with defined correlation structure | |
cm <- matrix(c(1.0,0.5,0.25,0.125, 0.5,1,0.5,0.25, 0.25,0.5,1,0.5, 0.125,0.25,0.5,1), nrow=4, ncol=4) | |
m <- mvrnorm( 100, rep(0.0, 4), cm) | |
cor(m) | |
d <- Data(parentId=1493172, name='matrix100x4') | |
d <- storeEntity(d) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# crontab -e | |
# */20 * * * * /home/ubuntu/checkpoint.py > /home/ubuntu/checkpoint.log 2>&1 | |
import os | |
hosts = [] | |
with open('/usr/local/Rmpi/hostfile.plain') as f: | |
for line in f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
system('cp ../rssd.10x.node* .') | |
dfs <- lapply( list.files('.','rssd.10x.*'), function(fn) { read.delim(fn, sep="\t", header=T) } ) | |
df <- do.call(rbind, dfs) | |
dim(df) | |
all(is.na(df$error)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'fileutils' | |
require 'right_aws' | |
require 'optparse' | |
require 'pp' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion":"2010-09-09", | |
"Description":"Start up a parallel Bioconductor cluster with ssh access. **WARNING** This template creates Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", | |
"Parameters":{ | |
"BiocVersion" : { | |
"Description" : "Bioconductor Version. 2.11 is recommended.", | |
"Type" : "String", | |
"Default": "2.11", | |
"AllowedValues": ["2.11"], | |
"ConstraintDescription": "Must be 2.11" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Demonstrate following redirects with POST using urllib2. | |
## | |
## Note: This is an experiment and may not be the best way | |
## to go about doing this. For example, why not just | |
## change the endpoints and issue a new request? Do | |
## we really want to be redirected on every request? | |
############################################################ | |
import urllib2 | |
import json |