Skip to content

Instantly share code, notes, and snippets.

View jnhutchinson's full-sized avatar

jnhutchinson

  • Diamond Age Data Science
  • Boston, MA
  • X @ordinator
View GitHub Profile
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #40a070; }
library(plyr)
library(Rsamtools)
library(GenomicRanges)
library(Biostrings)
library(knitr)
matcher <- function(pattern, x) {
ind = gregexpr(pattern, x)[[1]]
start = as.numeric(ind)
end = start + attr(ind, "match.length")- 2
@jnhutchinson
jnhutchinson / tophatalign.RNASeqQC.sh
Created May 17, 2012 17:34
Tophatalign and RNA-Seq QC bash pipeline
## 2012-05-08 - first draft
## 2012-05-14 - got rid of repetitive parts of script
## added RNA-seqQC prep
###jnhutchinson
###bash script to run tophat alignments for WP-rna-seq
###hard coded
#basedataDir ---untrimmed
# ---trimmed
source("http://bioconductor.org/biocLite.R") #adds bioconductor site as a package source
BiocLite(“pheatmap”) #downloads and install pheatmap package from bioconductor
library(pheatmap) #loads pheatmap package
install.packages(“RColorBrewer”) #donwnloads and installs a package with useful color themes
Library(RColorBrewer) #load RcolorBrewer package
#LOAD DATA
data=read.delim(“KO-WT-OV-3way.sig.batch.exprs.xls”) #read in expression values for significantly correlated probesets
data=data[,1:6] #subsets data remove the gene symbols, names or EntrezIDs
@jnhutchinson
jnhutchinson / gist:1996136
Created March 7, 2012 20:53
Boston weather
library(XML)
address="Boston"
url = paste( "http://www.google.com/ig/api?weather=", URLencode(address), sep="" )
xml = xmlTreeParse(url, useInternalNodes=TRUE) # take a look at the xml output:
# Get the required informations:
condition=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/condition",xmlGetAttr,"data")
temp_c=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/temp_c",xmlGetAttr,"data")
humidity=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/humidity",xmlGetAttr,"data")
cat( paste("The Weather in ", address, " is ", condition, ". The temperature is ", temp_c, "°C. Humidity is ", humidity, "%.") )
@jnhutchinson
jnhutchinson / gist:1996114
Created March 7, 2012 20:50
get boston weather
library(XML)
address="Boston"
url = paste( "http://www.google.com/ig/api?weather=", URLencode(address), sep="" )
xml = xmlTreeParse(url, useInternalNodes=TRUE) # take a look at the xml output:
# Get the required informations:
condition=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/condition",xmlGetAttr,"data")
temp_c=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/temp_c",xmlGetAttr,"data")
humidity=xpathSApply(xml,"//xml_api_reply/weather/current_conditions/humidity",xmlGetAttr,"data")
cat( paste("The Weather in ", address, " is ", condition, ". The temperature is ", temp_c, "°C. Humidity is ", humidity, "%.") )