Sorry, originally intended to post to BioC.

Hi IainI just recently worked this out w/o errors. Use this line by line to
see if this helps.
Of course, in places where there are slight additions/modifications, please
use the appropriate code.


> library(affy)
> library(topGO)
> library(XXXXXXX) # annotation library, such as "hgu133plu2" - quotes are
unnecessary
> load("XXXXXXXXX.exprSet")
> allgenes=geneNames(exprset) # for pre-R2.4 objects, use this, else the
next line
> allgenes=featureNames(exprset) # for post-R2.4 objects, use this, else the
previous line
> length(allgenes) # will tell you how many genes you have, just for
verification
> y2=read.table("y2.txt") # list of significant genes by your favorite stat;
you can pass lists by other methods such as a SAM or multtest result as
well.
> y3=y2[,1] # if reading from a single col text file
> geneList=factor(as.integer(allgenes %in% y3))
> names(geneList)<-allgenes
> GOdata <- new("topGOdata", ontology = "MF", allGenes = geneList, affyLib =
"XXXXXXX",annot=annFUN.hgu)
> test.stat <- new("classicCount", testStatistic = GOFisherTest, name =
"Fisher test")
> resultFis <- getSigGroups(GOdata, test.stat)
> l <- list(classic = score(resultFis))
> allRes2 <- GenTable(GOdata, resultFis,topNodes=150) # prints a table w.
p-values
> showSigOfNodes(GOdata, score(resultFis), useInfo = "all",
sig.for.all=F,firstTerms=38) # based on your p-values from the test you can
pick a number of nodes. My number 38 is based on a p-cutoff of 0.01


Alternate to the classic score used above you can also use alternate
statistical scoring methods.

> test.statel <- new("elimCount", testStatistic = GOFisherTest, name =
"Fisher test",cutoff=0.05) # uses the elim method developed by Adrian Alexa
> teststat2=new("classicScore",testStatistic=GOKSTest, name="KS Test") #
uses a Kolmogorov-Smirnov test
> teststatwt=new("weightCount",testStatistic=GOFisherTest,name="Weight
Test",sigRatio="ratio") # uses a weighted test

Best
BALA.

On Tue, Oct 7, 2008 at 11:58 AM, Iain Gallagher <
iaingallagher@btopenworld.com> wrote:

> ok... it was a simple error!! doh!
>
> instead of:
>
> GOdata<-new('topGOdata', ontology='BP',
> allGenes=geneList,
> + annot = annotFUN.gene2GO, gene2GO=test1)
>
> I needed
>
> GOdata<-new('topGOdata', ontology='BP',
> allGenes=geneList,
> + annot = annFUN.gene2GO, gene2GO=test1)
> ie it's
> annot = annFUN.gene2GO
> and NOT
>
> annot = annotFUN.gene2GO
> Great!
>
> Thanks again for your replies.
>
> Iain
> --- On Tue, 7/10/08, Iain Gallagher <iaingallagher@btopenworld.com> wrote:
> From: Iain Gallagher <iaingallagher@btopenworld.com>
> Subject: Re: [BioC] topGO problem
> To: "Adrian Alexa" <adrian.alexa@gmail.com>
> Cc: bioconductor@stat.math.ethz.ch
> Date: Tuesday, 7 October, 2008, 6:52 PM
>
> Thanks for your replies Adrian and James.
>
> My data is as before. I construct the topGO data object with:
>
> > GOdata<-new('topGOdata', ontology='BP',
> allGenes=geneList,
> + annot = annotFUN.gene2GO, gene2GO=test1)
>
> and I get
>
> Building most specific GOs .....Error in .local(.Object, ...) : object
> "annotFUN.gene2GO" not found
>
> hmm... not so good.
>
> > str(test1[1:10])
> List of 10
>  $ ENST00000000233: chr [1:4] "GO:0007264" "GO:0015031"
> "GO:0016192" "GO:0006886"
>  $ ENST00000000412: chr [1:4] "GO:0006810" "GO:0006898"
> "GO:0008333" "GO:0015761"
>  $ ENST00000000442: chr [1:2] "GO:0006350" "GO:0006355"
>  $ ENST00000001008: chr [1:6] "GO:0006457" "GO:0006463"
> "GO:0006825" "GO:0007566" ...
>  $ ENST00000001146: chr [1:7] "GO:0001709" "GO:0007140"
> "GO:0007283" "GO:0009954" ...
>  $ ENST00000002165: chr [1:2] "GO:0005975" "GO:0008152"
>  $ ENST00000002829: chr "GO:0007275"
>  $ ENST00000003100: chr [1:2] "GO:0055114" "GO:0006508"
>  $ ENST00000003302: chr [1:3] "GO:0006511" "GO:0006512"
> "GO:0008152"
>  $ ENST00000004531: chr [1:4] "GO:0006520" "GO:0006810"
> "GO:0015807" "GO:0006865"
>
> looks ok
>
> > str(geneList)
>  Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
>  - attr(*, "names")= chr [1:25068] "ENST00000000233"
> "ENST00000000412" "ENST00000000442"
> "ENST00000001008" ...
>
> looks ok!
>
> I thought perhaps I had made a fundamental error like a spelling error some
> where, but pasting in Adrians line made no difference. So I've probably
> made
> another error!
>
> Any further advice would be appreciated.
>
> Thanks
>
> Iain
>
> > sessionInfo()
> R version 2.7.2 (2008-08-25)
> i386-apple-darwin8.11.1
>
> locale:
> en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8
>
> attached base packages:
> [1] tools     stats     graphics  grDevices utils     datasets
> methods   base
>
> other attached packages:
>  [1] biomaRt_1.14.1      RCurl_0.9-4
> topGO_1.8.1         SparseM_0.78
>  [5] GO.db_2.2.0         AnnotationDbi_1.2.0 RSQLite_0.6-8
> DBI_0.2-4
>  [9] Biobase_2.0.0       graph_1.18.1
>
> loaded via a namespace (and not attached):
> [1] XML_1.96-0      cluster_1.11.11
> >
>
> --- On Tue, 7/10/08, Adrian Alexa <adrian.alexa@gmail.com> wrote:
> From: Adrian Alexa <adrian.alexa@gmail.com>
> Subject: Re: [BioC] topGO problem
> To: iaingallagher@btopenworld.com
> Date: Tuesday, 7 October, 2008, 9:36 AM
>
> Hi Iain,
>
> try this line:
>
> GOdata<-new('topGOdata', ontology='BP', allGenes=geneList,
> annotationFun = annotFUN.gene2GO, gene2GO=test1)
>
> You need to specify the name of the parameters for the constructor of
> a topGOdata. In your case, you forgot to match the annotFUN.gene2GO
> with the annotationFun parameter.
>
> Regards,
> Adrian
>
>
>
>
>
> On Mon, Oct 6, 2008 at 9:52 PM, Iain Gallagher
> <iaingallagher@btopenworld.com> wrote:
> > Hi
> >
> > I'm trying to use topGO to analyse a list of interesting genes
> generated using the Affy HGU-133plus2 platform but a custom cdf.
> >
> > The gene universe is a list of Ensembl transcript ids. I have annotated
> these with the BP GO using biomaRt
> >
> >> head(bio_process_go)
> >   go_biological_process_id ensembl_transcript_id
> > 1               GO:0007264       ENST00000000233
> > 2               GO:0015031       ENST00000000233
> > 3               GO:0016192       ENST00000000233
> > 4               GO:0006886       ENST00000000233
> > 5               GO:0006810       ENST00000000412
> > 6               GO:0006898       ENST00000000412
> >
> > and created a list object for feeding to topGO
> >
> >
> >
> > e.g.
> >
> >>test1<-unstack(bio_process_go)
> >> str(test1)
> > List of 13847
> >  $ ENST00000000233: chr [1:4] "GO:0007264"
> "GO:0015031" "GO:0016192" "GO:0006886"
> >  $ ENST00000000412: chr [1:4] "GO:0006810"
> "GO:0006898" "GO:0008333" "GO:0015761"
> >  $ ENST00000000442: chr [1:2] "GO:0006350"
> "GO:0006355"
> >  $ ENST00000001008: chr [1:6] "GO:0006457"
> "GO:0006463" "GO:0006825" "GO:0007566" ...
> >
> > I have created the named factor which topGO should use to seperate my
> interesting genes from the list.
> >
> > e.g.
> >
> >> str(geneList)
> >  Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
> >  - attr(*, "names")= chr [1:25068] "ENST00000000233"
> "ENST00000000412" "ENST00000000442"
> "ENST00000001008" ...
> >
> > I then create my topGO data object thus:
> >
> > GOdata<-new('topGOdata', ontology='BP',
> allGenes=geneList, annotFUN.gene2GO, gene2GO=test1)
> >
> > using the annotFUN.gene2GO argument since that's the direction my
> annotation goes in.
> >
> > However I get the following error:
> >
> > Building most specific GOs .....Error in .local(.Object, ...) :
> >   argument "annotationFun" is missing, with no default
> >
> > Can anyone advise on where I'm going wrong?
> >
> > Thanks
> >
> > Iain
> >
> >> sessionInfo()
> > R version 2.7.0 (2008-04-22)
> > i386-apple-darwin8.10.1
> >
> > locale:
> > en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.UTF-8/en_GB.UTF-8
> >
> > attached base packages:
> > [1] tools     stats     graphics  grDevices utils     datasets  methods
> base
> >
> > other attached packages:
> >  [1] topGO_1.8.1         SparseM_0.78        GO.db_2.2.0
> AnnotationDbi_1.2.0
> >  [5] RSQLite_0.6-8       DBI_0.2-4           Biobase_2.0.0
> graph_1.18.1
> >  [9] biomaRt_1.14.1      RCurl_0.9-4
> >
> > loaded via a namespace (and not attached):
> > [1] XML_1.96-0      cluster_1.11.10
> >
> >
> >        [[alternative HTML version deleted]]
> >
> >
> > _______________________________________________
> > Bioconductor mailing list
> > Bioconductor@stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/bioconductor
> > Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
> >
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

