readCdfUnits           package:affxparser           R Documentation

_R_e_a_d_s _u_n_i_t_s (_p_r_o_b_e_s_e_t_s) _f_r_o_m _a_n _A_f_f_y_m_e_t_r_i_x _C_D_F _f_i_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     Reads units (probesets) from an Affymetrix CDF file. Gets all or a
     subset of units (probesets).

_U_s_a_g_e:

     readCdfUnits(filename, units=NULL, readXY=TRUE, readBases=TRUE, readExpos=TRUE, readType=TRUE, readDirection=TRUE, stratifyBy=c("nothing", "pmmm", "pm", "mm"), readIndices=FALSE, verbose=0)

_A_r_g_u_m_e_n_t_s:

filename: The filename of the CDF file.

   units: An 'integer' 'vector' of unit indices specifying which units
          to be read.  If 'NULL', all units are read.

  readXY: If 'TRUE', cell row and column (x,y) coordinates are
          retrieved, otherwise not.

readBases: If 'TRUE', cell P and T bases are retrieved, otherwise not.

readExpos: If 'TRUE', cell "expos" values are retrieved, otherwise not.

readType: If 'TRUE', unit types are retrieved, otherwise not.

readDirection: If 'TRUE', unit directions are retrieved, otherwise not.

stratifyBy: A 'character' string specifying which and how elements in
          group fields are returned. If '"nothing"', elements are
          returned as is, i.e. as 'vector's. If '"pm"'/'"mm"', only
          elements corresponding to perfect-match (PM) / mismatch (MM)
          probes are returned (as 'vector's). If '"pmmm"', elements are
          returned as a matrix where the first row holds elements
          corresponding to PM probes and the second corresponding to MM
          probes.  Note that in this case, it is assumed that there are
          equal number of PMs and MMs; if not, an error is generated.
          Moreover, the PMs and MMs may not even be paired, i.e. there
          is no guarantee that the two elements in a column corresponds
          to a PM-MM pair.

readIndices: If 'TRUE', cell indices calculated from the row and column
          (X,Y) coordinates are retrieved, otherwise not.

 verbose: An 'integer' specifying the verbose level. If 0, the file is
          parsed quietly.  The higher numbers, the more details.

_V_a_l_u_e:

     A named 'list' where the names corresponds to the names of the
     units read.  Each element of the list is in turn a 'list'
     structure with three components: 

  groups: A 'list' with one component for each group (also called
          block). The information on each group is a 'list' with five
          components: 'x', 'y', 'pbase', 'tbase', 'expos', and
          'indices'.

    type: An 'integer' specifying the type of the unit, where 1 is
          "expression", 2 is "genotyping", 3 is "CustomSeq", and 4
          "tag".

direction: An 'integer' specifying the direction of the unit, which
          defines if the probes are interrogating the sense or the
          anti-sense target, where 0 is "no direction", 1 is "sense",
          and 2 is "anti-sense".

_A_u_t_h_o_r(_s):

     James Bullard, bullard@stat.berkeley.edu and Kasper Daniel Hansen,
     khansen@stat.berkeley.edu. Modified by Henrik Bengtsson (<URL:
     http://www.braju.com/R/>) to read any subset of units and/or
     subset of parameters, to stratify by PM/MM, and to return cell
     indices.d

_R_e_f_e_r_e_n_c_e_s:

     [1] Affymetrix Inc, Affymetrix GCOS 1.x compatible file formats,
     June 14, 2005. <URL: http://www.affymetrix.com/support/developer/>

_S_e_e _A_l_s_o:

     'readCdfCellIndices'().

_E_x_a_m_p_l_e_s:

     for (zzz in 0) {

     # Find any CDF file
     cdfFile <- findCdf()
     if (is.null(cdfFile))
       break

     # Read all units in a CDF file [~20s => 0.34ms/unit]
     cdf0 <- readCdfUnits(cdfFile, readXY=FALSE, readExpos=FALSE)

     # Read a subset of units in a CDF file [~6ms => 0.06ms/unit]
     units1 <- c(5, 100:109, 34)
     cdf1 <- readCdfUnits(cdfFile, units=units1, readXY=FALSE, readExpos=FALSE)
     stopifnot(identical(cdf1, cdf0[units1]))
     rm(cdf0)

     # Create a unit name to index map
     names <- readCdfUnitNames(cdfFile)
     units2 <- match(names(cdf1), names)
     stopifnot(all.equal(units1, units2))
     cdf2 <- readCdfUnits(cdfFile, units=units2, readXY=FALSE, readExpos=FALSE)

     stopifnot(identical(cdf1, cdf2))

     # Clean up
     rm(cdfFile, units1, cdf1, names, units2, cdf2)

     } # for (zzz in 0)

