---
title: "Working with Horvath Mammal (Mammal40) Array"
date: "`r BiocStyle::doc_date()`"
package: sesame
output: BiocStyle::html_document
fig_width: 8
fig_height: 6
vignette: >
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteIndexEntry{5. Horvath Mammal40 Array}
  %\VignetteEncoding{UTF-8}
---

```{r message=FALSE, warning=FALSE, include=FALSE}
library(sesame)
library(dplyr)
options(rmarkdown.html_vignette.check_title = FALSE)
```

SeSAMe supports Mammal 40 array natively.

## Cache Mammal40

```{r}
sesameDataCache("Mammal40")
```

## Load Mammal40 array IDAT

```{r}
res_grn = sesameDataDownload("GSM4411982_Grn.idat.gz")
res_red = sesameDataDownload("GSM4411982_Red.idat.gz")
sset = readIDATpair(sprintf("%s/GSM4411982", res_red$dest_dir))
```

Preprocess the sigset to produce beta values.
The standard `noob`, `dyeBiasCorrTypeINorm` works as expected:
```{r}
sset_normalized = sset %>%
                  noob %>%
                  dyeBiasCorrTypeINorm
```
Retrieve beta values using the following commands
```{r}
betas = sset_normalized %>%
        qualityMask %>%
        detectionMask %>%
        getBetas
```
