[R] Using Phyper

arun smartpink111 at yahoo.com
Wed May 15 17:35:58 CEST 2013


Hi Shanthi,
May be this link helps you (http://stats.stackexchange.com/questions/10328/using-rs-phyper-to-get-the-probability-of-list-overlap).

A.K.





________________________________
From: Shanthi Mulinti <shanthimulinti at gmail.com>
To: arun <smartpink111 at yahoo.com> 
Sent: Wednesday, May 15, 2013 10:25 AM
Subject: Re: Displaying median value over the horizontal(median)line in the boxplot



Arun,
          I am very sorry for bothering you but I wanted to ask you if you have any suggestions on using and interpreting Phyper output.
  I am working with expression data from two different 
treatments(two gene lists) and would like to know if the overlap of 
genes between the gene lists is by chance or is it significant. Based on
literature search it says use hypergeometric distribution - Phyper in 
R. 
Here is my data 
Total number of genes 26062 
Gene list 1 - 1000 
Gene list 2 - 1000 
Overlap between two lists - 233 
Now this is what I did 
phyper(233, 1000, 26062, 1000, lower.tail = FALSE, log.p = FALSE) 
[1] 2.539644e-123 
and got the answer. 
Can please some tell me how to interpret the output and also if I am doing it right, 
So with that output how can I say that the overlap between two geen lists is by chance or if it is significant. 

Thank you very much in advance. I am still in the learning curve and would appreciate any help.


Thank you 
Shanthi 




On Thu, Mar 21, 2013 at 4:19 PM, arun <smartpink111 at yahoo.com> wrote:

Hi,
>set.seed(45)
>test1<-data.frame(columnA=rnorm(7,45),columnB=rnorm(7,10)) #used an example probably similar to your actual data
>apply(test1,2,function(x) sprintf("%.1f",median(x)))
>#columnA columnB
># "44.5"  "10.2"
>par(mfrow=c(1,2))
>lapply(test1,function(x) {b<- boxplot(x,range=0,horizontal=TRUE);mtext(sprintf("%.1f",b$stats[3]),side=3,at=b$stats[3],line=-8)})
>A.K.
>
>
>
>----- Original Message -----
>From: "shanthimulinti at gmail.com" <shanthimulinti at gmail.com>
>To: smartpink111 at yahoo.com
>Cc:
>Sent: Thursday, March 21, 2013 4:05 PM
>Subject: Re: Displaying median value over the horizontal(median)line in the boxplot
>
>Here is what I am doing
>my=read.csv("test.csv")
>apply(my,2,median,na.rm=TRUE)
>b<-boxplot(my,range=0, pars=list(boxwex=0.6))
>After this I am not sure how to automatically list the median in each of the two boxplots
>
>test.csv has
>columnA  columnB
>1                 1       
>2                  2
>3                  3
>4                 4
>5                 5
>6                6
>7                7
>
>Finally how do I control the output. My actual data has a median value of 7.642552 but I only want it to be displayed as 7.6.
>
>Thank you so much for your help. I am very sorry for troubling you but I am very very new to this programming and to R as you can see.
>
>
>
><quote author='arun kirshna'>
>Hi,
>Lines1<-readLines(textConnection("Column1 -1,2,3,4,5,6,6,7
>COlumn2- 3,4,5,6,7,8,8
>Column3-- 45,66,7,8,89,
>COlumn4-5,6,7,7,8,9
>Column5 -5,6,7,8,8"))
>vec1<-unlist(strsplit(Lines1,"-"))
>
>dat1<-as.data.frame(t(read.table(text=vec1[grepl(",",vec1)],sep=",",fill=TRUE)))
>row.names(dat1)<-NULL
>colnames(dat1)<-tolower(gsub(" $","",vec1[grepl("^C",vec1)]))
>dat1
>#  column1 column2 column3 column4 column5
>#1       1       3      45       5       5
>#2       2       4      66       6       6
>#3       3       5       7       7       7
>#4       4       6       8       7       8
>#5       5       7      89       8       8
>#6       6       8      NA       9      NA
>#7       6       8      NA      NA      NA
>#8       7      NA      NA      NA      NA
>apply(dat1,2,median,na.rm=TRUE)
>#column1 column2 column3 column4 column5
>#    4.5     6.0    45.0     7.0     7.0
>
>#to save it as a pdf
>pdf("Shanthiboxplot.pdf")
>par(mfrow=c(3,2))
>lapply(dat1,function(x)
>{b<-boxplot(x,range=0,horizontal=TRUE);mtext(b$stats[3],side=3,at=b$stats[3],line=-8)})
>dev.off()
>
>#to just print it on screen
>par(mfrow=c(3,2))# you can change this according to your need
>lapply(dat1,function(x)
>{b<-boxplot(x,range=0,horizontal=TRUE);mtext(b$stats[3],side=3,at=b$stats[3],line=-8)})
>A.K.
></quote>
>Quoted from:
>http://r.789695.n4.nabble.com/Displaying-median-value-over-the-horizontal-median-line-in-the-boxplot-tp4661854p4661935.html
>
>



More information about the R-help mailing list