SRUtil-class            package:ShortRead            R Documentation

"._S_R_U_t_i_l" _a_n_d _r_e_l_a_t_e_d _c_l_a_s_s_e_s

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

     These classes provide important utility functions in the
     'ShortRead' package, but may occasionally be seen by the user and
     are documented here for that reason.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Utility classes include:



        *  '.SRUtil-class' a virtual base class from which all utility
           classes are derived.

        *  'SRError-class' created when errors occur in 'ShortRead'
           package code.

        *  'SRWarn-class' created when warnings occur in 'ShortRead'
           package code

        *  'SRList-class' representing a list (heterogeneous
           collection) of objects.

        *  'SRVector-class' representing a vector (homogeneous
           collection, i.e., all elements of the same class) of
           objects.


     Objects from these classes are not normally constructed by the
     user. However, constructors are available, as follows.

     'SRError(type, fmt, ...)', 'SRWarn(type, fmt, ...)':


     _t_y_p_e 'character(1)' vector describing the type of the error.
          'type' must come from a pre-defined list of types.

     _f_m_t a 'sprintf'-style format string for the message to be reported
          with the error.

     ... additional arguments to be interpolated into 'fmt'.


     'SRList(...)'


     ... elements of any type or length to be placed into the 'SRList'.
          If the length of '...' is 1 and the  argument is a list, then
          the list itself is placed into 'SRList'.


     'SRVector(..., vclass)'


     ... elements all satisfying an 'is' relationship with 'vclass', to
          be placed in 'SRVector'.

     _v_c_l_a_s_s the class to which all elements in '...' belong. If
          'vclass' is missing and 'length(list(...))' is greater than
          zero, then 'vclass' is taken to be the class of the first
          argument of '...'.


     'SRVector' errors:


     _S_R_V_e_c_t_o_r_C_l_a_s_s_D_i_s_a_g_r_e_e_m_e_n_t this error occurs when not all arguments
          '...' satisfy an is relationship with 'vclass'.


_S_l_o_t_s:

     'SRError' and 'SRWarn' have the following slots defined:


     '._t_y_p_e': Object of class '"character"' containing the type of
          error or warning. '.type' must come from a pre-defined list
          of types, see, e.g., 'ShortRead:::.SRError_types'.

     '._m_e_s_s_a_g_e': Object of class '"character"' containing a detailed
          message describing the error or warning.


     'SRList' has the following slot defined:


     '._s_r_l_i_s_t': Object of class '"list"' containing the elements in the
          list.


     'SRVector' extends 'SRList', with the following additional slot:


     '_v_c_l_a_s_s': Object of class '"character"' naming the type of object
          all elements of 'SRVector' must be.


_M_e_t_h_o_d_s:

     Accessors are available for all slots, and have the same name as
     the slot, e.g., 'vclass' to access the 'vclass' slot of
     'SRVector'.  Internal slots (those starting with . also have
     accessors, but these are not exported e.g., 'ShortRead:::.type'.

     'SRList' has the following methods:



     _l_e_n_g_t_h 'signature(x = "SRList")': return the ('integer(1)') length
          of the 'SRList'.

     _n_a_m_e_s 'signature(x = "SRList")': return a character vector of list
          element names. The length of the returned vector is the same
          as the length of 'x'.

     _n_a_m_e_s<- 'signature(x = "SRList", value = "character")': assign
          'value' as names for members of 'x'.

     [ 'signature(x = "SRList", i = "ANY", j = "missing")': subset the
          list using standard R list subset paradigms.

     [[ 'signature(x = "SRList", i = "ANY", j = "missing")': select
          element i from the list, using standard R list selection
          paradigms.

     _l_a_p_p_l_y 'signature(X = "SRList")': apply a function to all elements
          of 'X', with additional arguments interpreted as with
          'lapply'.

     _s_a_p_p_l_y 'signature(X = "SRList")': apply a function to all elements
          of 'X', simplifying the result if possible. Additional
          arguments interpreted as with 'sapply'.

     _s_h_o_w 'signature(object = "SRList")': display an informative
          summary of the object content, including the length of the
          list represented by 'object'.

     _d_e_t_a_i_l 'signature(object = "SRList")': display a more extensive
          version of the object, as one might expect from printing a
          standard list in R.


     'SRVector' inherits all methods from 'SRList', and has the
     following additional methods:



     _s_h_o_w 'signature(object = "SRVector")': display an informative
          summary of the object content, e.g., the vector class
          ('vclass') and length.

     _d_e_t_a_i_l 'signature(object = "SRVector")': display a more extensive
          version of the object, as one might expect from a printing a
          standard R list.


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

     Martin Morgan

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

     getClass(".SRUtil", where=getNamespace("ShortRead"))
     ShortRead:::.SRError_types
     ShortRead:::.SRWarn_types

     detail(SRList(1:5, letters[1:5]))

     tryCatch(SRVector(1:5, letters[1:5]),
              SRVectorClassDisagreement=function(err) {
                  cat("caught:", conditionMessage(err), "\n")
              })

