names(getClass("GeneIdentifierType")@subclasses)
# create an AnnotationIdentifier, and ask it's type
geneIdType(AnnotationIdentifier(annotation="hgu95av2"))
# Construct a GeneSet from an ExpressionSet, using the 'annotation'
# field of ExpressionSet to recognize the genes as AnnotationType
data(sample.ExpressionSet)
gs <- GeneSet(sample.ExpressionSet[100:109],
setName="sample.GeneSet", setIdentifier="123")
geneIdType(gs) # AnnotationIdentifier
## Read a Broad set from the system (or a url), and discover their
## GeneIdentifierType
fl <- system.file("extdata", "Broad.xml", package="GSEABase")
bsets <- getBroadSets(fl)
sapply(bsets, geneIdType)
## try to combine gene sets with different set types
try(gs & sets[[1]])
## Not run:
# ## Use the annotation package associated with the original
# ## ExpressionSet to map to EntrezIdentifier() ...
# geneIdType(gs) <- EntrezIdentifier()
# ## ...and try again
# gs & bsets[[1]]
#
# ## Another way to change annotation to Entrez (or other) ids
# probeIds <- featureNames(sample.ExpressionSet)[100:109]
# geneIds <- getEG(probeIds, "hgu95av2")
# GeneSet(EntrezIdentifier(),
# setName="sample.GeneSet2", setIdentifier="101",
# geneIds=geneIds)
# ## End(Not run)
## Create a new identifier
setClass("FooIdentifier",
contains="GeneIdentifierType",
prototype=prototype(
type=new("ScalarCharacter", "Foo")))
## Create a constructor (optional)
FooIdentifier <- function() new("FooIdentifier")
geneIdType(FooIdentifier())
## tidy up
removeClass("FooIdentifier")
Run the code above in your browser using DataLab