read_met {BPRMeth} | R Documentation

## Read methylation file

### Description

`read_met` reads a file containing methylation data using the `fread` function. Since there are different technologies, e.g. array, bulk BS-Seq, scBS-Seq, and still there is no standard file format, different options are available, check the Important section below on the file format for each type you choose. If a file format is not availabe, you need to read the file and create a `GRanges` object, where the data are ordered by chromosome and genomic location.

### Usage

    read_met(
      file,
      type = "sc_seq",
      strand_info = FALSE,
      chr_discarded = NULL,
      min_bulk_cov = 4,
      max_bulk_cov = 1000,
      delimiter = "\t"
    )

### Arguments

`file` | File name.
`type` | Type of technology as character. Either "bulk_seq", "sc_seq" or "array". Check the Important section below for more details.
`strand_info` | Logical, whether or not the file contains strand information.
`chr_discarded` | Optional vector with chromosomes to be discarded.
`min_bulk_cov` | Minimum number of reads mapping to each CpG site. Used only for "bulk_seq" and CpGs with less reads will be discarded as noise.
`max_bulk_cov` | Maximum number of reads mapping to each CpG site. Used only for "bulk_seq" and CpGs with less reads will be discarded as noise.
`delimiter` | Delimiter format the columns are splitted. Default is tab.

### Value

A `GRanges` object.

The GRanges object contains one or two additional metadata columns:

- `met`: Methylation level.

  - For "array" this is the Beta or M-values

  - For "sc_seq" this is either 0 or 1 (unmethylated or methylated)

  - For "bulk_seq" this contains the number of methylated reads for each CpG.

- `total`: Total number of reads for each CpG. Present only for "bulk_seq" type.

These columns can be accessed as follows: `granges_obj$met`

### Important

Depending on technology `type` we assume different file formats.

- `"array"` File format: "chromosome", "start", "strand" (optional), "met" .

- `"sc_seq"` File format: "chromosome", "start", "strand" (optional), "met" . Where "met" should contain only 1s or 0s.

- `"bulk_seq"` File format: "chromosome", "start", "strand" (optional), "met", "total".

By default columns are considered in tab delimited format.

### Author(s)

C.A.Kapourani C.A.Kapourani@ed.ac.uk

### See Also

`read_anno`, `read_expr`, `create_region_object`

### Examples

    # Obtain the path to files
    file <- system.file("extdata", "dummy_met.bed", package = "BPRMeth")
    met_dt <- read_met(file)

    # Extract methylation level
    met <- met_dt$met

[Package BPRMeth version 1.16.0 Index]