Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Illumina Mouse Array and EPIC Version 2 #252

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 48 additions & 8 deletions R/preprocessFunnorm.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,18 @@ preprocessFunnorm <- function(rgSet, nPCs=2, sex = NULL, bgCorr = TRUE, dyeCorr
index <- match("BISULFITE CONVERSION I", controlNames)
if (array=="IlluminaHumanMethylation450k"){
addr <- getCtrlsAddr(exType = sprintf("BS Conversion I%sC%s", c(" ", "-", "-"), 1:3), index = index)
} else if (array == "IlluminaMouseMethylation") {
ids <- paste0(rep(c(396, 140), each = 2), rep(c("U", "C"), each = 2)) # mouse BS1 ids
addr <- getCtrlsAddr(exType = sprintf("BS1-%s_MUS", ids), index = index)
} else {
addr <- getCtrlsAddr(exType = sprintf("BS Conversion I%sC%s", c("-", "-"), 1:2), index = index)
}
greenControls.current <- greenControls[[ index ]][addr,,drop=FALSE]
if (array=="IlluminaHumanMethylation450k"){
addr <- getCtrlsAddr(exType = sprintf("BS Conversion I-C%s", 4:6), index = index)
} else if (array == "IlluminaMouseMethylation"){
ids <- paste0(rep(c(409, 318, 317), each = 2), rep(c("U", "C"), each = 2)) # mouse BS1 ids
addr <- getCtrlsAddr(exType = sprintf("BS1-%s_MUS", ids), index = index)
} else {
addr <- getCtrlsAddr(exType = sprintf("BS Conversion I-C%s", 3:5), index = index)
}
Expand All @@ -228,17 +234,33 @@ preprocessFunnorm <- function(rgSet, nPCs=2, sex = NULL, bgCorr = TRUE, dyeCorr

## Staining
index <- match("STAINING", controlNames)
addr <- getCtrlsAddr(exType = "Biotin (High)", index = index)
if (array == "IlluminaMouseMethylation"){
addr <- getCtrlsAddr(exType = "STN-Biotin-High", index = index)
} else {
addr <- getCtrlsAddr(exType = "Biotin (High)", index = index)
}
stain.green <- t(greenControls[[ index ]][addr,,drop=FALSE])
addr <- getCtrlsAddr(exType = "DNP (High)", index = index)
if (array == "IlluminaMouseMethylation"){
addr <- getCtrlsAddr(exType = "STN-DNP-High", index = index)
} else {
addr <- getCtrlsAddr(exType = "DNP (High)", index = index)
}
stain.red <- t(redControls[[ index ]][addr,, drop=FALSE ])

## Extension
index <- match("EXTENSION", controlNames)
addr <- getCtrlsAddr(exType = sprintf("Extension (%s)", c("A", "T")), index = index)
if (array == "IlluminaMouseMethylation"){
addr <- getCtrlsAddr(exType = sprintf("EXT-%s", c("A", "T")), index = index)
} else {
addr <- getCtrlsAddr(exType = sprintf("Extension (%s)", c("A", "T")), index = index)
}
extension.red <- t(redControls[[index]][addr,,drop=FALSE])
colnames(extension.red) <- paste0("extRed", 1:ncol(extension.red))
addr <- getCtrlsAddr(exType = sprintf("Extension (%s)", c("C", "G")), index = index)
if (array == "IlluminaMouseMethylation"){
addr <- getCtrlsAddr(exType = sprintf("EXT-%s", c("C", "G")), index = index)
} else {
addr <- getCtrlsAddr(exType = sprintf("Extension (%s)", c("C", "G")), index = index)
}
extension.green <- t(greenControls[[index]][addr,,drop=FALSE])
colnames(extension.green) <- paste0("extGrn", 1:ncol(extension.green))

Expand All @@ -254,10 +276,18 @@ preprocessFunnorm <- function(rgSet, nPCs=2, sex = NULL, bgCorr = TRUE, dyeCorr

## Non-polymorphic probes
index <- match("NON-POLYMORPHIC", controlNames)
addr <- getCtrlsAddr(exType = sprintf("NP (%s)", c("A", "T")), index = index)
if (array == "IlluminaMouseMethylation"){
addr <- getCtrlsAddr(exType = sprintf("NPM-%s_MUS", c("A", "T")), index = index)
} else {
addr <- getCtrlsAddr(exType = sprintf("NP (%s)", c("A", "T")), index = index)
}
nonpoly.red <- t(redControls[[index]][addr, ,drop=FALSE])
colnames(nonpoly.red) <- paste0("nonpolyRed", 1:ncol(nonpoly.red))
addr <- getCtrlsAddr(exType = sprintf("NP (%s)", c("C", "G")), index = index)
if (array == "IlluminaMouseMethylation"){
addr <- getCtrlsAddr(exType = sprintf("NPM-%s_MUS", c("C", "G")), index = index)
} else {
addr <- getCtrlsAddr(exType = sprintf("NP (%s)", c("C", "G")), index = index)
}
nonpoly.green <- t(greenControls[[index]][addr, ,drop=FALSE])
colnames(nonpoly.green) <- paste0("nonpolyGrn", 1:ncol(nonpoly.green))

Expand All @@ -274,7 +304,12 @@ preprocessFunnorm <- function(rgSet, nPCs=2, sex = NULL, bgCorr = TRUE, dyeCorr

## Specificity I
index <- match("SPECIFICITY I", controlNames)
addr <- getCtrlsAddr(exType = sprintf("GT Mismatch %s (PM)", 1:3), index = index)
if(array == "IlluminaMouseMethylation"){
ids <- paste0(rep(c("PM", "MM"), 3), rep(c(1:3), each = 2))
addr <- getCtrlsAddr(exType = sprintf("SP1-%s_HSA", ids), index = index)
} else {
addr <- getCtrlsAddr(exType = sprintf("GT Mismatch %s (PM)", 1:3), index = index)
}
greenControls.current <- greenControls[[index]][addr,,drop=FALSE]
redControls.current <- redControls[[index]][addr,,drop=FALSE]
spec1.green <- t(greenControls.current)
Expand All @@ -283,7 +318,12 @@ preprocessFunnorm <- function(rgSet, nPCs=2, sex = NULL, bgCorr = TRUE, dyeCorr
colMeans2(greenControls.current, na.rm = TRUE)

index <- match("SPECIFICITY I", controlNames) # Added that line
addr <- getCtrlsAddr(exType = sprintf("GT Mismatch %s (PM)", 4:6), index = index)
if(array == "IlluminaMouseMethylation"){
ids <- paste0(rep(c("PM", "MM"), 3), rep(c(4:6), each = 2))
addr <- getCtrlsAddr(exType = sprintf("SP1-%s_HSA", ids), index = index)
} else {
addr <- getCtrlsAddr(exType = sprintf("GT Mismatch %s (PM)", 4:6), index = index)
}
greenControls.current <- greenControls[[index]][addr,,drop=FALSE]
redControls.current <- redControls[[index]][addr,,drop=FALSE]
spec1.red <- t(redControls.current)
Expand Down
28 changes: 28 additions & 0 deletions R/read.meth.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,39 @@
arrayAnnotation <- c(
array = "IlluminaHumanMethylation450k",
annotation = .default.450k.annotation)
} else if(nProbes >= 361000 && nProbes <= 362000){
arrayAnnotation <- c(
array = "IlluminaMouseMethylation",
annotation = "12.v1.mm10")

# Install package if needed
if(!require("devtools")) install.packages("devtools") # install devtools
if(!require("IlluminaMouseMethylationmanifest")) devtools::install_github("chiaraherzog/IlluminaMouseMethylationmanifest")
if(!require("IlluminaMouseMethylationanno.12.v1.mm10")) devtools::install_github("chiaraherzog/IlluminaMouseMethylationanno.12.v1.mm10")

# Load library
suppressPackageStartupMessages(library(IlluminaMouseMethylationmanifest))
suppressPackageStartupMessages(library(IlluminaMouseMethylationanno.12.v1.mm10))

} else if (nProbes >= 1050000 && nProbes <= 1053000) {
# NOTE: "Current EPIC scan type"
arrayAnnotation <- c(
array = "IlluminaHumanMethylationEPIC",
annotation = .default.epic.annotation)
} else if(nProbes >= 1104000 && nProbes <= 1110000){
arrayAnnotation <- c(
array = "IlluminaHumanMethylationEPICv2",
annotation = "20a1.hg38")

# Install package if needed
if(!require("devtools")) install.packages("devtools") # install devtools
if(!require("IlluminaHumanMethylationEPICv2manifest")) devtools::install_github("jokergoo/IlluminaHumanMethylationEPICv2manifest")
if(!require("IlluminaHumanMethylationEPICv2anno.20a1.hg38")) devtools::install_github("jokergoo/IlluminaHumanMethylationEPICv2anno.20a1.hg38")

# Load library
suppressPackageStartupMessages(library(IlluminaHumanMethylationEPICv2manifest))
suppressPackageStartupMessages(library(IlluminaHumanMethylationEPICv2anno.20a1.hg38))

} else if (nProbes >= 1032000 && nProbes <= 1033000) {
# NOTE: "Old EPIC scan type"
arrayAnnotation <- c(
Expand Down