[BioC] Adding to GeneSetCollection object from function

Iain Gallagher iaingallagher at btopenworld.com
Fri Mar 11 22:36:59 CET 2011


Hello list,

I have written a small function to create GeneSets from a list object. As each GeneSet is generated I would like to add them to a GeneSetCollection object.

How do I do this?

#toy code
library(GSEABase)

testList <- list('hsa-mir-451'=c('SATB2', 'MECP2', 'CTNNBIP1'), 'hsa-mir-452'=c('SATB2', 'MEIS2', 'PRDM16'), 'hsa-mir-453'=c('SATB2', 'SNAI1', 'MECP2'))

geneSetFunc <- function(listIn)
    {
    l <- length(listIn)
    setNames <- names(listIn)
    for (i in 1:l) {
    gsTest <- GeneSet(unique(listIn[[i]]), geneIdType=SymbolIdentifier(), setName = names[i])


    }

    return(gsTest)
}

test <- geneSetFunc(testList)

test2 <- GeneSetCollection(test)

As it stands only the last GeneSet out makes the collection & as each output arrives in the collection it overwrites the previous.

Thanks for any help / pointers.

best

i

> sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_GB.utf8       LC_NUMERIC=C             
 [3] LC_TIME=en_GB.utf8        LC_COLLATE=en_GB.utf8    
 [5] LC_MONETARY=C             LC_MESSAGES=en_GB.utf8   
 [7] LC_PAPER=en_GB.utf8       LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C      

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

other attached packages:
[1] GSEABase_1.12.1      graph_1.28.0         annotate_1.28.0     
[4] AnnotationDbi_1.12.0 Biobase_2.10.0      

loaded via a namespace (and not attached):
[1] DBI_0.2-5     RSQLite_0.9-4 tools_2.12.2  XML_3.2-0     xtable_1.5-6 
> 




More information about the Bioconductor mailing list