View Single Post
Old 10-03-2011, 08:51 AM   #2
ECO
--Site Admin--
 
Location: SF Bay Area, CA, USA

Join Date: Oct 2007
Posts: 1,358
Default

This is cake in R...

Depending on how large the datasets are, read them into R. The example below (using read.table) is just for using the clipboard in MacOSX (highlight in excel, copy, then run that line). The equiv in windows is read.table("clipboard",sep='\t',header=TRUE).

Code:
> df1 <- read.table(pipe("pbpaste"),header=TRUE)
> df1
  Gene Change    Padj
1    1    212 0.00060
2    2     99 0.09000
3    3     15 0.70000
4    4     59 0.45600
5    5    418 0.00001
6    6    566 0.00000
> df2 <- read.table(pipe("pbpaste"),header=TRUE)
> df2
  Gene Statistic    FDR
1    1        28 0.0005
2    2        17 0.0070
3    3         3 0.8100
4    4         8 0.2800
5    5        48 0.0020
6    6       111 0.0000
> df3 <- merge(df1,df2)
> df3
  Gene Change    Padj Statistic    FDR
1    1    212 0.00060        28 0.0005
2    2     99 0.09000        17 0.0070
3    3     15 0.70000         3 0.8100
4    4     59 0.45600         8 0.2800
5    5    418 0.00001        48 0.0020
6    6    566 0.00000       111 0.0000
> df3[df3$Padj< 0.05 & df3$FDR < 0.05,]
  Gene Change  Padj Statistic   FDR
1    1    212 6e-04        28 5e-04
5    5    418 1e-05        48 2e-03
6    6    566 0e+00       111 0e+00
> write.csv(df3[df3$Padj< 0.05 & df3$FDR < 0.05,])
"","Gene","Change","Padj","Statistic","FDR"
"1",1,212,6e-04,28,5e-04
"5",5,418,1e-05,48,0.002
"6",6,566,0,111,0
ECO is offline   Reply With Quote