Skip to contents

This function reads in the environmental data that accompanies the genetic data read in with genDataRead.

Usage

envDataReadFromObj(
  obj.in = stop("The object must be given!", .call = FALSE),
  file.out = NULL,
  dir.out = ".",
  cont = TRUE,
  overwrite = NULL
)

Arguments

obj.in

The object (matrix) with the environmental data.

file.out

The base name for the output files (see Details).

dir.out

The path to the directory where the output files will be saved.

cont

Logical - are the values continuous (TRUE, default) or categories (FALSE)? See Details.

overwrite

Logical: if a file with the given name exists, should it be overwritten or not? If NULL, the user will be prompt for input.

Value

A list of ffdf objects with the environmental data in numeric format.

Details

The environmental data such as methylation data can be large if the information is stored on per-SNP basis. Thus, when data is large, this function reads it in and creates a special ff object that stores the data without limiting the memory available. This can take time but needs to be performed only once. Later on, one can use the envDataLoad function to load the appropriate data from .ffData file saved to disk, which is a quick process.

Details

If 'file.out' is not given, the default is NULL and the output filenames are constructed based on the input filenames. The '_env' suffix is added to the base name and the .ffData file is written to disk. This file contains all the information needed to restore the ffdf object by calling envDataLoad function later on.

If 'cont' is TRUE (default), the output data will be a list of ff matrices containing single-precision values. However, before using this data as stratification values, the user needs to create categories - this can be done manually or with the provided envDataCategorize function.