Bimap-direction        package:AnnotationDbi        R Documentation

_M_e_t_h_o_d_s _f_o_r _g_e_t_t_i_n_g/_s_e_t_t_i_n_g _t_h_e _d_i_r_e_c_t_i_o_n _o_f _a _B_i_m_a_p _o_b_j_e_c_t,
_a_n_d _u_n_d_i_r_e_c_t_e_d _m_e_t_h_o_d_s _f_o_r _g_e_t_t_i_n_g/_c_o_u_n_t_i_n_g/_s_e_t_t_i_n_g _i_t_s _k_e_y_s

_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).

     They are divided in 2 groups: (1) methods for getting or setting
     the direction of a Bimap object and (2) methods for getting,
     counting or setting the left or right keys (or mapped keys only)
     of a Bimap object. Note that all the methods in group (2) are
     undirected methods i.e. what they return does NOT depend on the
     direction of the map (more on this below).

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

       ## Getting or setting the direction of a Bimap object
       direction(x)
       direction(x) <- value
       revmap(x, ...)

       ## Getting, counting or setting the left or right keys (or mapped
       ## keys only) of a Bimap object
       Lkeys(x)
       Rkeys(x)
       Llength(x)
       Rlength(x)
       mappedLkeys(x)
       mappedRkeys(x)
       count.mappedLkeys(x)
       count.mappedRkeys(x)
       Lkeys(x) <- value
       Rkeys(x) <- value
       subset(x, ...)

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

       x: A Bimap object. 

   value: A single integer or character string indicating the new
          direction in 'direction(x) <- value'. A character vector
          containing the new keys (must be a subset of the current
          keys) in 'Lkeys(x) <- value' and 'Rkeys(x) <- value'. 

     ...: Extra argument for 'revmap' can be:

          '_o_b_j_N_a_m_e' The name to give to the reversed map (only
               supported if 'x' is an AnnDbBimap object).


          Extra arguments for 'subset' can be:

          '_L_k_e_y_s' The new Lkeys.

          '_R_k_e_y_s' The new Rkeys.

          '_d_r_o_p._i_n_v_a_l_i_d._k_e_y_s' If 'drop.invalid.keys=FALSE' (the
               default), an error will be raised if the new Lkeys or
               Rkeys contain invalid keys i.e. keys that don't belong
               to the current Lkeys or Rkeys. If
               'drop.invalid.keys=TRUE', invalid keys are silently
               dropped.

          '_o_b_j_N_a_m_e' The name to give to the submap (only supported if
               'x' is an AnnDbBimap object).


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

     All Bimap objects have a direction which can be left-to-right
     (i.e. the mapping goes from the left keys to the right keys) or
     right-to-left (i.e. the mapping goes from the right keys to the
     left keys). A Bimap object 'x' that maps from left to right is
     considered to be a direct map. Otherwise it is considered to be an
     indirect map (when it maps from right to left).

     'direction' returns '1' on a direct map and '-1' otherwise.

     The direction of 'x' can be changed with 'direction(x) <- value'
     where value must be '1' or '-1'. An easy way to reverse a map
     (i.e. to change its direction) is to do 'direction(x) <- -
     direction(x)', or, even better, to use 'revmap(x)' which is
     actually the recommended way for doing it.

     The 'Lkeys' and 'Rkeys' methods return respectively the left and
     right keys of a Bimap object. Unlike the 'keys' method (see
     '?keys' for more information), these methods are
     direction-independent i.e. what they return does NOT depend on the
     direction of the map. Such methods are also said to be "undirected
     methods"  and methods like the 'keys' method are said to be
     "directed methods".

     All the methods described below are also "undirected methods".

     'Llength(x)' and 'Rlength(x)' are equivalent to (but more
     efficient than) 'length(Lkeys(x))' and 'length(Rkeys(x))',
     respectively.

     The 'mappedLkeys' (or 'mappedRkeys') method returns the left keys
     (or right keys) that are mapped to at least one right key (or one
     left key).

     'count.mappedLkeys(x)' and 'count.mappedRkeys(x)' are equivalent
     to (but more efficient than) 'length(mappedLkeys(x))' and
     'length(mappedRkeys(x))', respectively.

     'Lkeys(x) <- value' and 'Rkeys(x) <- value' are the undirected
     versions of 'keys(x) <- value' (see '?keys' for more information)
     and 'subset(x, Lkeys=new_Lkeys, Rkeys=new_Rkeys)' is provided as a
     convenient way to reduce the sets of left and right keys in one
     single function call.

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

     '1L' or '-1L' for 'direction'.

     A Bimap object of the same subtype as 'x' for 'revmap' and
     'subset'.

     A character vector for 'Lkeys', 'Rkeys', 'mappedLkeys' and
     'mappedRkeys'.

     A single non-negative integer for 'Llength', 'Rlength',
     'count.mappedLkeys' and 'count.mappedRkeys'.

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

     H. Pages

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

     Bimap, Bimap-keys, BimapFormatting, AnnDbBimap-envirAPI

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

       library(hgu95av2.db)
       ls(2)
       x <- hgu95av2GO
       x
       summary(x)
       direction(x)

       length(x)
       Llength(x)
       Rlength(x)

       keys(x)[1:4]
       Lkeys(x)[1:4]
       Rkeys(x)[1:4]

       count.mappedkeys(x)
       count.mappedLkeys(x)
       count.mappedRkeys(x)

       mappedkeys(x)[1:4]
       mappedLkeys(x)[1:4]
       mappedRkeys(x)[1:4]

       y <- revmap(x)
       y
       summary(y)
       direction(y)

       length(y)
       Llength(y)
       Rlength(y)

       keys(y)[1:4]
       Lkeys(y)[1:4]
       Rkeys(y)[1:4]

       ## etc...

       ## Get rid of all unmapped keys (left and right)
       z <- subset(y, Lkeys=mappedLkeys(y), Rkeys=mappedRkeys(y))

