Skip to content

Instantly share code, notes, and snippets.

@bobthecat
bobthecat / get_the_data.r
Created May 16, 2012 06:35
Obtaining a gene list from data in GEO
library(GEOquery); library(RankProd); library(mouse4302.db)
## Download the data from GEO
gse12499 <- getGEO('GSE12499',GSEMatrix=TRUE)
e <- exprs(gse12499[[1]])
dim(e)
[1] 45101 10
## Rank Product
eRP <- RP(e[,c(1:3, 7:10)], cl=c(0,0,0,1,1,1,1), rand = 123)
table <- topGene(eRP, cutoff=0.001, method="pfp", logged=TRUE,
logbase=2, gene.names=rownames(e))
@bobthecat
bobthecat / pubmed_pain.r
Created May 15, 2012 22:44
pubmed trend for pain
source('pubmed_trend.r')
sex.pub <- pubmed_trend(search.str = 'Sex+Characteristics[mh] AND Pain[mh]', year.span=1970:2011)
analgesic.pub <- pubmed_trend(search.str = 'Sex+Characteristics[mh] AND Analgesics[mh]', year.span=1970:2011)
source('plot_bar.r')
library("RColorBrewer")
pdf(file='sex_pain.pdf', height=8, width=8)
par(las=1)
colorfunction = colorRampPalette(brewer.pal(9, "Reds"))
@bobthecat
bobthecat / pubmed_barplot
Created May 15, 2012 22:40
Barplot for pubmed trend
plot_bar <- function(x=sex.pub, linecol="royalblue", cols, addArg=TRUE) {
bp <- barplot(x, col=cols, add=addArg)
fit <- stats::lowess(x, f=1/3)
lines(x=bp, fit$y, col=linecol, lwd=3)
}
#! /usr/bin/perl -w
#
# pubmed_trend.pl
#
# Created by David Ruau on 2011-02-17.
# Department of Pediatrics/Div. System Medicine Stanford University.
#
##################### USAGE #########################
#
# Query PubMed with Eutils tools