impute_met_files: Impute/predict methylation files

Description Usage Arguments Value Author(s) See Also Examples

View source: R/utils.R

Description

Make predictions of missing methylation states, i.e. perfrom imputation using Melissa. Each file in the directory will be used as input and a new file will be created in outdir with an additional column containing the predicted met state (value between 0 and 1). Note that predictions will be made only on annotation regions that were used for training Melissa. Check impute_test_met, if you want to make predictions only on test data.

Usage

1
2
3
4
5
6
7
8
9
impute_met_files(
  met_dir,
  outdir = NULL,
  obj,
  anno_region,
  basis = NULL,
  is_predictive = TRUE,
  no_cores = NULL
)

Arguments

met_dir

Directory of methylation files, each file corresponds to a single cell. It should contain three columns <chr> <pos> <met_state> (similar to the input required by create_melissa_data_obj), where met_state can be any value that denotes missing CpG information, e.g. -1. Note that files can contain also CpGs for which we have coverage information, and we can check the predictions made by Melissa, hence the value can also be 0 (unmet) or (1) met. Predictions made by Melissa, will not change the <met_state> column. Melissa will just add an additional column named <predicted>.

outdir

Directory to store the output files for each cell with exactly the same name. If NULL, then a directory called 'imputed' inside 'met_dir' will be created by default.

obj

Output of Melissa inference object.

anno_region

Annotation region object. This will be the outpuf of create_melissa_data_obj function, e..g melissa_data$anno_region. This is required to select those regions that were used to train Melissa.

basis

Basis object, if NULL we perform imputation using Melissa, otherwise using BPRMeth (then obj should be BPRMeth output).

is_predictive

Logical, use predictive distribution for imputation, or choose the cluster label with the highest responsibility.

no_cores

Number of cores to be used for parallel processing of data.

Value

A new directory outdir containing files (cells) with predicted / imputed methylation states per CpG location.

Author(s)

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

See Also

create_melissa_data_obj, melissa, filter_regions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# Met directory
met_dir <- "name_of_met_dir"
# Annotation file name
anno_file <- "name_of_anno_file"
# Create data object
melissa_data <- create_melissa_data_obj(met_dir, anno_file)
# Run Melissa
melissa_obj <- melissa(X = melissa_data$met, K = 2)
# Annotation object
anno_region <- melissa_data$anno_region

# Peform imputation
impute_met_dir <- "name_of_met_dir_for_imputing_cells"
out <- impute_met_files(met_dir = impute_met_dir, obj = melissa_obj,
                        anno_region = anno_region)

## End(Not run)

andreaskapou/Melissa documentation built on June 12, 2020, 5:54 p.m.