These methods are part of the Bimap interface
?Bimap for a quick overview of the Bimap
objects and their interface).
1 2 3 4 5 6
A Bimap object. If the method being caled is
A character vector containing the new keys (must be a subset of the current keys).
A character vector containing the keys of the map elements to extract.
keys(x) returns the set of all valid keys for map
keys(hgu95av2GO) is the set of all probe set IDs
for chip hgu95av2 from Affymetrix.
Please Note that in addition to
will also work for
AnnotationDb objects and related objects
Note also that the double bracket operator
[[ for Bimap
objects is guaranteed to work only with a valid key and will raise
an error if the key is invalid.
?`Bimap-envirAPI` for more information
about this operator.)
length(x) is equivalent to (but more efficient than)
A valid key is not necessarily mapped (
[[ will return an
NA on an unmapped key).
isNA(x) returns a logical vector of the same length as
TRUE value is used to mark keys that are NOT mapped
FALSE value to mark keys that ARE mapped.
mappedkeys(x) returns the subset of
keys(x) where only
mapped keys were kept.
count.mappedkeys(x) is equivalent to (but more efficient than)
Two (almost) equivalent forms of subsetting a Bimap object
are provided: (1) by setting the keys explicitely and (2) by using
the single bracket operator
[ for Bimap objects.
Let's say the user wants to restrict the mapping to the subset of
valid keys stored in character vector
mykeys. This can be
done either with
keys(x) <- mykeys (form (1)) or with
y <- x[mykeys] (form (2)).
Please note that form (1) alters object
x in an irreversible
way (the original keys are lost) so form (2) should be preferred.
All the methods described on this pages are "directed methods"
i.e. what they return DOES depend on the direction of the Bimap
object that they are applied to (see
more information about this).
A character vector for
A single non-negative integer for
A logical vector for
A Bimap object of the same subtype as
Bimap, Bimap-envirAPI, Bimap-toTable, BimapFormatting, AnnotationDb, select, columns
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
library(hgu95av2.db) x <- hgu95av2GO x length(x) count.mappedkeys(x) x[1:3] links(x[1:3]) ## Keep only the mapped keys keys(x) <- mappedkeys(x) length(x) count.mappedkeys(x) x # now it is a submap ## The above subsetting can also be achieved with x <- hgu95av2GO[mappedkeys(hgu95av2GO)] ## mappedkeys() and count.mappedkeys() also work with an environment ## or a list z <- list(k1=NA, k2=letters[1:4], k3="x") mappedkeys(z) count.mappedkeys(z) ## retrieve the set of primary keys for the ChipDb object named 'hgu95av2.db' keys <- keys(hgu95av2.db) head(keys)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.