---
title: "Batch Normalise"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Batch Normalise}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

## Create Metaboprep object

```{r setup}
library(metaboprep)

data     <- read.csv(system.file("extdata", "dummy_data.csv", package = "metaboprep"), header=T, row.names = 1) |> as.matrix()
samples  <- read.csv(system.file("extdata", "dummy_samples.csv", package = "metaboprep"), header=T, row.names = 1)
features <- read.csv(system.file("extdata", "dummy_features.csv", package = "metaboprep"), header=T, row.names = 1)

## create Metaboprep object
mydata <- Metaboprep(data = data, samples = samples, features = features)

## summary of Metaboprep object
summary(mydata)
```

## Run batch normalisation

```{r batch_normalise}
mydata <- mydata |>
  batch_normalise(run_mode_col = "platform", run_mode_colmap = c(pos="pos", neg="neg")) |>
  print()
```

## Accessing data

### Raw input data

```{r data}
mydata@data[1:5, 1:5, "input"]
```

### Batch normlalised data

```{r}
mydata@data[1:5, 1:5, "batch_normalised"]
```


