On Wed, Nov 23, 2011 at 2:29 AM, Martin Morgan <mtmorgan@fhcrc.org> wrote:

> On 11/22/2011 02:33 PM, Biase, Fernando Henrique wrote:
>
>> Hi everyone,
>>
>> Is there a way to retrieve the level for a GO category in R?
>>
>> As of now I am retrieving terms by using the following code:
>>
>>  BP_terms<- stack(lapply(mget(GO_BP_Cats_**5_more_genes$category,
>>> GOTERM, ifnotfound=NA), Term))
>>>
>>
>> Now I wanted go get the level (3,4,5...,9).
>>
>> I looked into the "annotate" package and the " .db" (I am using
>> org.Bt.eg.db) usage but could not find it.
>>
>> Any hint would be very much appreciated.
>>
>
> Hi,
>
> Maybe using the CHILDREN (immediate descendants) or OFFSPRING maps ? For
> instance
>
> > toTable(GOBPCHILDREN["GO:**0071842"])
>        go_id      go_id RelationshipType
> 1  GO:0006323 GO:0071842             is_a
> 2  GO:0006996 GO:0071842             is_a
> 3  GO:0007028 GO:0071842             is_a
> 4  GO:0030030 GO:0071842             is_a
> 5  GO:0034621 GO:0071842             is_a
> 6  GO:0034994 GO:0071842             is_a
> 7  GO:0035845 GO:0071842             is_a
> 8  GO:0043062 GO:0071842             is_a
> 9  GO:0043580 GO:0071842             is_a
> 10 GO:0071844 GO:0071842             is_a
> 11 GO:0071845 GO:0071842             is_a
> 12 GO:0071956 GO:0071842             is_a
> 13 GO:0072553 GO:0071842             is_a
> 14 GO:0097061 GO:0071842             is_a
>
> or
>
> > length(mappedLkeys(**GOBPOFFSPRING["GO:0071842"]))
> [1] 1683
>
> The 'Lkeys' could be retrieved recursively, or to find out more
> information about the terms
>
> > toTable(GOTERM[mappedLkeys(**GOBPCHILDREN["GO:0071842"])])
>
> If you want to do something more than enumerate the children, perhaps the
> graph package would be appropriate.
>

I had a look at makeGOGraph in GOstats.  We can run the example and then
use RBGL's sp.between to get a path

> example(makeGOGraph)

mkGOGr>  library("hgu95av2.db")

mkGOGr>  set.seed(321)

mkGOGr>  uniqun <- function(x) unique(unlist(x))

mkGOGr>  gN <- uniqun(sample(hgu95av2ENTREZID, 4))

mkGOGr>  gg1 <- makeGOGraph(gN, "BP", chip="hgu95av2.db")
> sp.between(gg1, "GO:0006366", "GO:0008150")
$`GO:0006366:GO:0008150`
$`GO:0006366:GO:0008150`$length
[1] 5

$`GO:0006366:GO:0008150`$path_detail
[1] "GO:0006366" "GO:0006351" "GO:0010467" "GO:0043170" "GO:0008152"
[6] "GO:0008150"

$`GO:0006366:GO:0008150`$length_detail
$`GO:0006366:GO:0008150`$length_detail[[1]]
GO:0006366->GO:0006351 GO:0006351->GO:0010467 GO:0010467->GO:0043170
                     1                      1                      1
GO:0043170->GO:0008152 GO:0008152->GO:0008150
                     1                      1

However when I tried to get the mapfun parameter to work with the
org.Bt.eg.db mappings, I came a-cropper.  Some of the doc on the GOstats
makeGOGraph man page seems to be out of date.  A little programming with
org.* and GO.db will probably yield a general method.


> sessionInfo()
R Under development (unstable) (2011-11-15 r57665)
Platform: x86_64-apple-darwin10.8.0/x86_64 (64-bit)

locale:
[1]
en_US.US-ASCII/en_US.US-ASCII/en_US.US-ASCII/C/en_US.US-ASCII/en_US.US-ASCII

attached base packages:
[1] grid      stats     graphics  grDevices datasets  utils     tools
[8] methods   base

other attached packages:
 [1] Rgraphviz_1.33.0     RBGL_1.31.1          GO.db_2.6.1
 [4] hgu95av2.db_2.6.3    org.Hs.eg.db_2.6.4   GOstats_2.21.0
 [7] RSQLite_0.10.0       DBI_0.2-5            graph_1.33.0
[10] Category_2.21.0      AnnotationDbi_1.17.4 Biobase_2.15.1
[13] BiocGenerics_0.1.3   BiocInstaller_1.3.3  weaver_1.21.0
[16] codetools_0.2-8      digest_0.5.1

loaded via a namespace (and not attached):
[1] annotate_1.33.0   genefilter_1.37.0 GSEABase_1.17.1   IRanges_1.13.8
[5] splines_2.15.0    survival_2.36-10  XML_3.4-3         xtable_1.6-0


>
> Hope that helps,
>
> Martin
>
>
>> Thanks in advance, Fernando
>>
>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________**_________________ Bioconductor mailing
>> list Bioconductor@r-project.org
>> https://stat.ethz.ch/mailman/**listinfo/bioconductor<https://stat.ethz.ch/mailman/listinfo/bioconductor>Search the
>> archives:
>> http://news.gmane.org/gmane.**science.biology.informatics.**conductor<http://news.gmane.org/gmane.science.biology.informatics.conductor>
>>
>
>
> --
> Computational Biology
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
>
> Location: M1-B861
> Telephone: 206 667-2793
>
>
> ______________________________**_________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/**listinfo/bioconductor<https://stat.ethz.ch/mailman/listinfo/bioconductor>
> Search the archives: http://news.gmane.org/gmane.**
> science.biology.informatics.**conductor<http://news.gmane.org/gmane.science.biology.informatics.conductor>
>

	[[alternative HTML version deleted]]

