Created
April 21, 2012 00:55
-
-
Save ohofmann/2433005 to your computer and use it in GitHub Desktop.
This file contains 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(simpleaffy) | |
library(mouse430a2.db) | |
library(arrayQualityMetrics) | |
library(RColorBrewer) | |
library(pheatmap) | |
#library(pathprint) | |
#library(ggplot2) | |
#library(ggdendro) | |
#library("AnnotationDbi") | |
#library("annotationTools") | |
# Parse array information, normalize with RMA | |
data.affy <- read.affy(covdesc='covdesc.txt', | |
path='./data', | |
verbose=T) | |
data.affy | |
pData(data.affy) | |
data.rma <- call.exprs(data.affy, 'rma') | |
# | |
# QC | |
# | |
arrayQualityMetrics(data.rma) | |
# Get gene identifiers | |
entrez <- as.vector(unlist(mget(rownames(all.exprs), | |
mouse430a2ENTREZID, | |
ifnotfound=NA))) | |
length(entrez) == length(rownames(all.exprs)) | |
symbols <- as.vector(unlist(mget(rownames(all.exprs), | |
mouse430a2SYMBOL, | |
ifnotfound=NA))) | |
length(symbols) == length(entrez) | |
# Extract expression matrix | |
all.exprs <- exprs(data.rma) | |
all.unlogged <- 2^all.exprs | |
# Get mean, standard deviation | |
rowMean <- apply(all.unlogged, 1, mean) | |
rowSD <- apply(all.unlogged, 1, sd) | |
# Create a data frame to hold information | |
df <- data.frame(all.unlogged) | |
df$Entrez <- entrez | |
df$Symbol <- symbols | |
df$Mean <- rowMean | |
df$SD <- rowSD | |
# Sort by mean | |
dfSort <- df[with(df, order(-Mean)), ] | |
head(dfSort) | |
write.table(dfSort, file='unloggedExpression.txt', | |
quote=F, sep='\t', row.names=T, | |
col.names=T) | |
# Explore percentiles | |
quantile(df$Mean) | |
quantile(df$Mean, probs=seq(0.95, 1, 0.01)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment