[BioC] how can I apply a function to each element of a GeneSetCollection (GSEABase)

Francois Pepin fpepin at cs.mcgill.ca
Wed Jan 7 22:31:57 CET 2009


Hi Burak,

How about:

GeneSetCollection(lapply(test1,
   function(f) {geneIds(f) = "burak";return(f)}))

Works well with me:

GeneSetCollection
   names: chr16q, chr5q23 (2 total)
   unique identifiers: burak (1 total)
   types in collection:
     geneIdType: SymbolIdentifier (1 total)
     collectionType: BroadCollection (1 total)

Francois

burak kutlu wrote:
> Hello
> I am trying to apply a function to each element of a GeneSetCollection object. I have a problem preserving the data class, if I use lapply(). Is using a for loop my only option?
> Thanks for any help
> -burak
> 
> Here's what I do:
> 
>> gsc
> GeneSetCollection
>   names: chr16q, chr5q23, ..., INOSITOL_OR_PHOSPHATIDYLINOSITOL_KINASE_ACTIVITY (5452 total)
>   unique identifiers: CMAR, USP10, ..., UCHL5IP (39655 total)
>   types in collection:
>     geneIdType: SymbolIdentifier (1 total)
>     collectionType: BroadCollection (1 total)
> 
>> test1 = GeneSetCollection(gsc[[1]],gsc[[2]])
>> test1
> GeneSetCollection
>   names: chr16q, chr5q23 (2 total)
>   unique identifiers: CMAR, USP10, ..., LOC728586 (91 total)
>   types in collection:
>     geneIdType: SymbolIdentifier (1 total)
>     collectionType: BroadCollection (1 total)
> 
>> lapply(test1,function(f) {geneIds(f) = "burak";return(f)})
> [[1]]
> setName: chr16q
> geneIds: burak (total: 1)
> geneIdType: Symbol
> collectionType: Broad
>   bcCategory: c1 (Positional)
>   bcSubCategory:  NA
> details: use 'details(object)'
> 
> [[2]]
> setName: chr5q23
> geneIds: burak (total: 1)
> geneIdType: Symbol
> collectionType: Broad
>   bcCategory: c1 (Positional)
>   bcSubCategory:  NA
> details: use 'details(object)'
> 
> ## returns a list
> 
>> sessionInfo()
> R version 2.8.0 (2008-10-20)
> x86_64-unknown-linux-gnu
> 
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
> 
> attached base packages:
> [1] grDevices datasets  splines   graphics  stats     utils     tools
> [8] methods   base
> 
> other attached packages:
>  [1] org.Hs.eg.db_2.2.6  RSQLite_0.7-1       GSEABase_1.4.0
>  [4] graph_1.20.0        annotate_1.20.0     xtable_1.5-4
>  [7] AnnotationDbi_1.4.1 RMySQL_0.6-1        DBI_0.2-4
> [10] simpleaffy_2.18.0   gcrma_2.14.1        matchprobes_1.14.0
> [13] genefilter_1.22.0   survival_2.34-1     affy_1.20.0
> [16] Biobase_2.2.0
> 
> loaded via a namespace (and not attached):
> [1] affyio_1.10.1        cluster_1.11.11      preprocessCore_1.4.0
> [4] XML_1.98-1
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list