Bimap-keys           package:AnnotationDbi           R Documentation

_M_e_t_h_o_d_s _f_o_r _m_a_n_i_p_u_l_a_t_i_n_g _t_h_e _k_e_y_s _o_f _a _B_i_m_a_p _o_b_j_e_c_t

_D_e_s_c_r_i_p_t_i_o_n:

     These methods are part of the Bimap interface (see '?Bimap' for a
     quick overview of the Bimap objects and their interface).

_U_s_a_g_e:

       keys(x)
       #length(x)
       isNA(x)
       mappedkeys(x)
       count.mappedkeys(x)
       keys(x) <- value
       #x[i]

_A_r_g_u_m_e_n_t_s:

       x: A Bimap object. 

   value: A character vector containing the new keys (must be a subset
          of the current keys). 

       i: A character vector containing the keys of the map elements to
          extract. 

_D_e_t_a_i_l_s:

     'keys(x)' returns the set of all valid keys for map 'x'. For
     example, 'keys(hgu95av2GO)' is the set of all probe set IDs for
     chip hgu95av2 from Affymetrix. Note 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. (See
     '?`AnnDbBimap-envirAPI`' for more information about this
     operator.)

     'length(x)' is equivalent to (but more efficient than)
     'length(keys(x))'.

     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 'x' where
     the 'TRUE' value is used to mark keys that are NOT mapped and the
     '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)
     'length(mappedkeys(x))'.

     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 '?direction' for more
     information about this).

_V_a_l_u_e:

     A character vector for 'keys' and 'mappedkeys'.

     A single non-negative integer for 'length' and 'count.mappedkeys'.

     A logical vector for 'isNA'.

     A Bimap object of the same subtype as 'x' for 'x[i]'.

_A_u_t_h_o_r(_s):

     H. Pages

_S_e_e _A_l_s_o:

     Bimap, AnnDbBimap-envirAPI, Bimap-toTable, BimapFormatting

_E_x_a_m_p_l_e_s:

       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)

