Skip to content

Instantly share code, notes, and snippets.

@arraytools
arraytools / foo.R
Created December 26, 2012 19:34
test gist
x <- read.delim("toy.txt", header=TRUE)
summary(x)
@arraytools
arraytools / server.R
Last active December 10, 2015 04:38
Interactive heatmap using sequential data. Note the Google Chrome browser works fine, and Firefox may or may not. The Microsoft IE does not work at all.
library(shiny)
library(gplots) # Just for redgreen() function. Will be replaced sol.
lr2 <- as.matrix(read.delim("toy.txt", header = TRUE)) # 3 genes, 20 arrays, sequential data.
sigma <- apply(lr2, 1, sd); sigma <- sigma/max(sigma)
# Define server logic required to generate and plot a random distribution
shinyServer(function(input, output) {
datainput <- reactive(function() {
@arraytools
arraytools / server.R
Last active December 10, 2015 04:48
heatmap using leukemia data (22282 genes, 58 arrays). Assume 'shiny' package is available. We can run shiny:::runGist("https://gist.github.com/4383351")
# shiny:::runApp("hello")
#
# To-Do-List:
# missing value case
#
library(shiny)
# library(gplots) # Just for redgreen() function. Will be replaced sol.
source(url("http://dl.dropbox.com/u/1014272/heatmapr.r"))
source(url("http://dl.dropbox.com/u/1014272/colorpanel.r"))
@arraytools
arraytools / server.R
Last active December 10, 2015 12:39
Heatmap using Pomeroy dataset
# shiny:::runApp("hello")
#
# To-Do-List:
# missing value case
#
library(shiny)
# library(gplots) # Just for redgreen() function. Will be replaced sol.
source(url("http://dl.dropbox.com/u/1014272/heatmapr.r"))
source(url("http://dl.dropbox.com/u/1014272/colorpanel.r"))
@arraytools
arraytools / biocLite.R
Last active December 10, 2015 19:48
Understand how *source("http://www.bioconductor.org/biocLite.R")* works. 1. After source("http://www.bioconductor.org/biocLite.R"), it checks R version and bioc version. 2. If it satisfies the condition (vers > "2.13" && biocVers > "2.8"), it will try to load *BiocInstaller* package. If loading BiocInstaller package is successful, then *biocLite…
## Mirrors: uncomment the following and change to your favorite CRAN mirror
## if you don't want to use the default (cran.fhcrc.org, Seattle, USA).
## options("repos" = "http://cran.fhcrc.org")
## Mirrors: uncomment the following and change to your favorite Bioconductor
## mirror, if you don't want to use the default (www.bioconductor.org,
## Seattle, USA)
## options("BioC_mirror" = "http://www.bioconductor.org")
local({
/*
* Robotics with the BOE Shield - RoamingWithIr plus LED
* Adaptation of RoamingWithWhiskers with IR object detection instead of
* contact switches.
*/
#include <Servo.h> // Include servo library
Servo servoLeft; // Declare left and right servos
Servo servoRight;
@arraytools
arraytools / GeneIDs.txt
Created September 23, 2013 14:19
Simple text file used for testing reading by C++
ProbeSet Symbol
1552266_at ADAM32
1007_s_at DDR1
1487_at ESRRA
1294_at UBA7
1552257_a_at TTLL12
1405_i_at CCL5
1053_at RFC2
1320_at PTPN21
1316_at THRA
@arraytools
arraytools / memoryTest.cpp
Last active December 23, 2015 20:29
memory leak test
#include <iostream>
using namespace std;
void foo(unsigned long long n)
{
double *ptr = new (std::nothrow) double[n];
if (!ptr) {
cout << "Failed to allocate double[n]" << endl;
} else {
@arraytools
arraytools / ip.txt
Created September 28, 2013 16:34
Given a list of ip, we want to plot the locations on google map
66.249.75.44
79.133.216.100
79.133.216.107
46.105.54.115
180.76.5.156
199.30.20.52
199.30.20.105
27.153.249.94
199.30.28.131
199.30.20.130
@arraytools
arraytools / build-R-based-on-git
Last active August 29, 2015 14:20
build-R-base-on-git
# sudo apt-get update
# sudo apt-get install git
# sudo apt-get build-dep r-base
# about 350MB as of R 3.2.0
git clone https://github.com/wch/r-source.git
cd r-source
R_PAPERSIZE=letter \
R_BATCHSAVE="--no-save --no-restore" \