Last active
December 16, 2015 06:19
-
-
Save sashaphanes/5390110 to your computer and use it in GitHub Desktop.
getting p-values from two dataframes
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
#read MAOA and MAOB human RNAseq data and use t.test by regions | |
setwd("/home/mydirectory/work.dir/allen.brain/human") | |
maoa = read.csv("combinedA.csv") | |
maob = read.csv("combinedB.csv") | |
test.result = mapply(t.test, maoa, maob) | |
#store p-values by brain region: | |
#p.values = mapply(function(x, y) t.test(x,y)$p.value, maoa, maob) | |
#store p-values in a column with regions in a separate column: | |
p.values = stack(mapply(function(x, y) t.test(x,y)$p.value, maoa, maob)) | |
#order p-values | |
ordered = p.values[with(p.values, order(values)),] | |
#make a heatmap | |
matrix.maoa = as.matrix(maoa) | |
matrix.maob = as.matrix(maob) | |
fun = Vectorize(function(i,j) t.test(matrix.maoa[,i],matrix.maob[,j])$p.value) | |
res = outer(1:169,1:169,FUN = "fun") | |
image(1:169,1:169,res,axes=FALSE,xlab="MAOA",ylab="MAOB") | |
axis(1, at = 1:169,labels=colnames(maoa)) | |
axis(2, at = 1:169,labels=colnames(maoa)) | |
#TOP REGIONS OF HUMAN DIFFERENTIAL EXPRESSION | |
#Central Nucleus | |
#VIIIB | |
#Crus II | |
#middle frontal gyrus | |
#III | |
#Anterior group of nuclei | |
#precuneus | |
#pontine raphe nucleus | |
#Supramammillary nucleus | |
#VI | |
#Inferior occipital gyrus | |
#central glial substance | |
#CA4 field | |
#Paraventricular Nuclei of Thalamus | |
#Ventromedial hypothalamic nucleus | |
#Posterior group of nuclei | |
#Tuberomammillary nucleus | |
#Perifornical nucleus | |
#central grey substance of midbrain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment