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'().  This header can be
          of any CEL header version.

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)

     # Assert that we found an ASCII CEL file, but any will do
     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 #
     ##############################################################

