createCel             package:affxparser             R Documentation

_C_r_e_a_t_e_s _a_n _e_m_p_t_y _C_E_L _f_i_l_e

_D_e_s_c_r_i_p_t_i_o_n:

     Creates an empty CEL file.

_U_s_a_g_e:

     createCel(filename, header, nsubgrids=0, overwrite=FALSE, ..., verbose=FALSE)

_A_r_g_u_m_e_n_t_s:

filename: The filename of the CEL file to be created.

  header: A 'list' structure describing the CEL header, similar to the
          structure returned by 'readCelHeader'().

overwrite: If 'FALSE' and the file already exists, an exception is
          thrown, otherwise the file is created.

nsubgrids: The number of subgrids.

     ...: Not used.

 verbose: An 'integer' specifying how much verbose details are
          outputted.

_D_e_t_a_i_l_s:

     Currently only binary (v4) CEL files are supported. The current
     version of the method does not make use of the Fusion SDK, but its
     own code to create the CEL file.

_V_a_l_u_e:

     Returns (invisibly) the pathname of the file created.

_R_e_d_u_n_d_a_n_t _f_i_e_l_d_s _i_n _t_h_e _C_E_L _h_e_a_d_e_r:

     There are a few redundant fields in the CEL header.  To make sure
     the CEL header is consistent, redundant fields are cleared and
     regenerated.  For instance, the field for the total number of
     cells is calculated from the number of cell rows and columns.

_A_u_t_h_o_r(_s):

     Henrik Bengtsson (<URL: http://www.braju.com/R/>)

_E_x_a_m_p_l_e_s:

     ##############################################################
     if (require("AffymetrixDataTestFiles")) {            # START #
     ##############################################################

     # Search for first available ASCII CEL file
     path <- system.file("rawData", package="AffymetrixDataTestFiles")
     files <- findFiles(pattern="[.](cel|CEL)$", path=path, recursive=TRUE, firstOnly=FALSE)
     files <- grep("ASCII", files, value=TRUE)
     file <- files[1]

     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     # Read the CEL header
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     hdr <- readCelHeader(file)
     stopifnot(hdr$version == 3)

     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     # Create a CEL v4 file of the same chip type
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     outFile <- file.path(tempdir(), "zzz.CEL")
     if (file.exists(outFile))
       file.remove(outFile)
     createCel(outFile, hdr, overwrite=TRUE)
     str(readCelHeader(outFile))

     # Verify correctness by update and re-read a few cells
     intensities <- as.double(1:100)
     indices <- seq(along=intensities)
     updateCel(outFile, indices=indices, intensities=intensities)
     value <- readCel(outFile, indices=indices)$intensities
     stopifnot(identical(intensities, value))

     ##############################################################
     }                                                     # STOP #
     ##############################################################

