Commit 24846b85 authored by Leon-Charles Tranchevent's avatar Leon-Charles Tranchevent
Browse files

Small correction in file / folder naming for batch correction.

parent 6d95399a
......@@ -49,6 +49,24 @@ correct_batch_effect <- function(eset,
}
}
# We remove the probes that have 0 variance accross the samples for each batch.
# Not doing so will prevent Combat from running.
exp_data <- Biobase::exprs(eset)
clean_probe_list <- rownames(exp_data)
for (b in unique(batch_data$Batch)) {
# We take care of batch b.
samples_in_batch <- which(batch_data$Batch == b)
exp_data_batch <- exp_data[, samples_in_batch]
probe_vars <- apply(exp_data_batch, 1, var)
probe_var_0 <- names(probe_vars[probe_vars == 0])
if (length(probe_var_0) > 0) {
clean_probe_list <- setdiff(clean_probe_list, probe_var_0)
}
}
remove(b, samples_in_batch, exp_data_batch, probe_vars, probe_var_0)
eset <- Biobase::ExpressionSet(exp_data[clean_probe_list, ])
remove(exp_data, clean_probe_list)
# ComBat corrects for the batch effect.
data_bc <- sva::ComBat(dat = Biobase::exprs(eset),
batch = batch_data$Batch,
......
......@@ -90,7 +90,7 @@ preprocess_data_affymetrix_gcrma <- function(input_data_dir, output_data_files,
# We return the created ESET(s).
if (batch_correction == "BOTH") {
return(list(eset, eset_bc))
return(list(eset_bc, eset))
} else {
return(eset)
}
......
......@@ -89,7 +89,7 @@ preprocess_data_affymetrix_scan <- function(input_data_dir, output_data_files,
# We return the created ESET(s).
if (batch_correction == "BOTH") {
return(list(eset, eset_bc))
return(list(eset_bc, eset))
} else {
return(eset)
}
......
......@@ -115,7 +115,7 @@ preprocess_data_agilent_limma <- function(input_data_dir, output_data_files,
# We return the created ESET(s).
if (batch_correction == "BOTH") {
return(list(eset, eset_bc))
return(list(eset_bc, eset))
} else {
return(eset)
}
......
......@@ -132,7 +132,7 @@ preprocess_data_illumina_beadarray <- function(input_data_dir, output_data_files
# We return the created ESET(s).
if (batch_correction == "BOTH") {
return(list(eset, eset_bc))
return(list(eset_bc, eset))
} else {
return(eset)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment