% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make_meth_rse.R
\name{makeMethRSEFromArrayFiles}
\alias{makeMethRSEFromArrayFiles}
\title{Create a HDF5-backed RangedSummarizedExperiment for methylation values in array files}
\usage{
makeMethRSEFromArrayFiles(
  array_files,
  probe_name_column = 1,
  beta_value_column = 2,
  normalization_factor = NULL,
  decimal_places = NA,
  probe_ranges,
  sample_metadata = NULL,
  hdf5_dir,
  dataset_name = "beta",
  overwrite = FALSE,
  chunkdim = NULL,
  temporary_dir = NULL,
  BPPARAM = BiocParallel::bpparam(),
  ...
)
}
\arguments{
\item{array_files}{A vector of paths to bedGraph files. Automatically detects if array_files contain a header if every field in the first line is a character.}

\item{probe_name_column}{The number of the column which corresponds to the name of the probes. Default is 1st column.}

\item{beta_value_column}{The number of the column which corresponds to the beta values . Default is 2nd column.}

\item{normalization_factor}{An optional numerical value to divide methylation values by to convert them to fractions e.g. 100 if they are percentages.
Default is not to leave values as they are in the input files.}

\item{decimal_places}{Integer indicating the number of decimal places to round beta values to. Default is 2.}

\item{probe_ranges}{A GRanges object giving the genomic locations of probes where each region corresponds to a separate probe.
There should be a metadata column called name with the name of the probe associated with each region.
Any probes in array_files that are not in probe_ranges are ignored.}

\item{sample_metadata}{Sample metadata to be used as colData for the RangedSummarizedExperiment}

\item{hdf5_dir}{Directory to save HDF5 file. Is created if it doesn't exist. HDF5 file is called assays.h5.}

\item{dataset_name}{Name to give data set in HDF5 file. Default is "beta".}

\item{overwrite}{TRUE or FALSE indicating whether to allow overwriting if dataset_name already exists in assays.h5. Default is FALSE.}

\item{chunkdim}{The dimensions of the chunks for the HDF5 file. Should be a vector of length 2 giving the number of rows and then the number of columns in each chunk.}

\item{temporary_dir}{Name to give a temporary directory to store intermediate files. A directory with this name cannot already exist.
Default is to create a name using tempfile("temporary_meth_chunks_").}

\item{BPPARAM}{A BiocParallelParam object for parallel processing. Defaults to \code{BiocParallel::bpparam()}.}

\item{...}{Additional arguments to be passed to HDF5Array::HDF5RealizationSink() for controlling the physical properties of the created HDF5 file,
such as compression level. Uses the defaults for any properties that are not specified.}
}
\value{
A RangedSummarizedExperiment with methylation values for all methylation sites in meth_sites. Methylation sites will be in the same order as sort(meth_sites).
}
\description{
Create a HDF5-backed RangedSummarizedExperiment for methylation values in array files
}
\examples{
# Get human CpG sites for hg38 genome build
data("infinium_450k_probe_granges_hg19", package = "methodical")

# Get paths to array files
array_files <- list.files(path = system.file('extdata', package = 'methodical'), 
  pattern = ".txt.gz", full.names = TRUE)

# Create sample metadata
sample_metadata <- data.frame(
  tcga_project = "LUAD",
  sample_type = "Tumour", submitter = gsub("_01.tsv.gz", "", basename(array_files)),
  row.names = gsub(".tsv.gz", "", basename(array_files))
)

# Create a HDF5-backed RangedSummarizedExperiment from array files using default chumk dimensions
meth_rse <- makeMethRSEFromArrayFiles(array_files = array_files, 
 probe_ranges = infinium_450k_probe_granges_hg19, 
 sample_metadata = sample_metadata, hdf5_dir =  paste0(tempdir(), "/array_file_hdf5_1"))

}
