Commit 6a8dbf82 authored by Leon-Charles Tranchevent's avatar Leon-Charles Tranchevent
Browse files

Adaptation to new version of ArrayLibs (bug inversion bc / no bc).

parent 4daf7830
......@@ -71,9 +71,9 @@ for (i in seq_len(length(config$datasets))) {
message(paste0("[", Sys.time(), "] [", dataset_name, "][", normalization_method,
"] Starting pre-processing (with batches)."))
output_data_files <- c(paste0(output_data_subdir, dataset_name, "_normalized_",
normalization$name, "_batchcorrection.tsv"),
normalization$name, "_nobatchcorrection.tsv"),
paste0(output_data_subdir, dataset_name, "_normalized_",
normalization$name, "_nobatchcorrection.tsv"))
normalization$name, "_batchcorrection.tsv"))
esets <- ArrayUtils::preprocess_data(raw_data_subdir,
output_data_files,
platform = dataset$platform,
......@@ -91,7 +91,7 @@ for (i in seq_len(length(config$datasets))) {
"] Starting QC (with batch effect correction)."))
output_data_subdir_bc <- paste0(output_data_subdir, "batchcorrection/")
dir.create(output_data_subdir_bc, showWarnings = TRUE, recursive = FALSE, mode = "0777")
ArrayUtils::run_quality_control_on_preprocessed(esets[[1]],
ArrayUtils::run_quality_control_on_preprocessed(esets[[2]],
raw_data_subdir,
output_data_subdir_bc,
phenotype_groups = dataset_groups,
......@@ -105,7 +105,7 @@ for (i in seq_len(length(config$datasets))) {
"] Starting QC (without batch effect correction)."))
output_data_subdir_nobc <- paste0(output_data_subdir, "nobatchcorrection/")
dir.create(output_data_subdir_nobc, showWarnings = TRUE, recursive = FALSE, mode = "0777")
ArrayUtils::run_quality_control_on_preprocessed(esets[[2]],
ArrayUtils::run_quality_control_on_preprocessed(esets[[1]],
raw_data_subdir,
output_data_subdir_nobc,
phenotype_groups = dataset_groups,
......
......@@ -72,72 +72,129 @@ do
datasetName=${datasets__dataset_name[$i]}
if [ "${datasetName}" != "" ]
then
suitableForFact=${datasets__suitable_for_factorial_analysis[$i]}
if [ "${suitableForFact}" == "'TRUE'" ]
then
# Regular case, the factorial analysis was done.
# MD plots.
echo '\begin{figure}[ht]' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \centering' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_FemaleVsMale.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
# MD plots.
echo '\begin{figure}[ht]' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \centering' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_FemaleVsMale.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_FemaleVsMale_PD.png ]
then
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_FemaleVsMale_PD.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_FemaleVsMale_control.png ]
then
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_FemaleVsMale_control.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_PDVsControl.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_PDVsControl.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_PDVsControl_females.png ]
then
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_PDVsControl_females.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_PDVsControl_males.png ]
then
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_PDVsControl_males.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_Gender_disease_status.png ]
then
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_Gender_disease_status.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_Disease_status_gender.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \caption{MD plots of all Limma analyses for dataset '"$datasetName"'.' | sed -r 's/_/\\_/g' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' Each plot represents the mean signal (x-axis) versus its deviation (y-axis).' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Top left) Gender based analysis (Females vs males)' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Top center) Gender based analysis (Females vs males) in PD patients' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Top right) Gender based analysis (Females vs males) in controls' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Middle left) Status based analysis (PD patients vs controls)' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Middle center) Status based analysis (PD patients vs controls) for females' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Middle right) Status based analysis (PD patients vs controls) for males' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Bottom left) First factorial analysis (focus on disease status differences for the different genders).' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Bottom right) Second factorial analysis (focus on gender differences for the different disease status).' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' Note: the last two plots should be exactly the same.}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '\end{figure}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '' >> ${OUTPUT_FOLDER}/results_summary.tex
# Venn diagrams.
echo '\begin{figure}[ht]' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \centering' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.35]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_FemaleVsMale.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.35]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_PDVsControl.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.35]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_Disease_status_gender.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.35]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_Gender_disease_status.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \caption{Venn diagrams of the significant genes for all Limma analyses and for dataset '"$datasetName"'.' | sed -r 's/_/\\_/g' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Top left) Gender based analysis (Females vs males)' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Top right) Status based analysis (PD patients vs controls)' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Bottom left) First factorial analysis (focus on disease status differences for the different genders) and its components.' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Bottom right) Second factorial analysis (focus on gender differences for the different disease status) and its components.}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '\end{figure}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '' >> ${OUTPUT_FOLDER}/results_summary.tex
else
# We have not done the factorial analysis so we have less plots to show.
# MD plots.
echo '\begin{figure}[ht]' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \centering' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_FemaleVsMale.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_MD_PDVsControl.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \caption{MD plots of all Limma analyses for dataset '"$datasetName"'.' | sed -r 's/_/\\_/g' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' Each plot represents the mean signal (x-axis) versus its deviation (y-axis).' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Left) Gender based analysis (Females vs males)' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Right) Status based analysis (PD patients vs controls)}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '\end{figure}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '' >> ${OUTPUT_FOLDER}/results_summary.tex
# Venn diagrams.
echo '\begin{figure}[ht]' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \centering' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.35]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_FemaleVsMale.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.35]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_PDVsControl.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \caption{Venn diagrams of the significant genes for all Limma analyses and for dataset '"$datasetName"'.' | sed -r 's/_/\\_/g' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Left) Gender based analysis (Females vs males)' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Right) Status based analysis (PD patients vs controls)}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '\end{figure}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
echo ' \caption{MD plots of all Limma analyses for dataset '"$datasetName"'.' | sed -r 's/_/\\_/g' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' Each plot represents the mean signal (x-axis) versus its deviation (y-axis).' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' From top to bottom and from left to right: ' >> ${OUTPUT_FOLDER}/results_summary.tex
p=1
echo ' ('"$p"') Gender based analysis (Females vs males)' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_FemaleVsMale_PD.png ]
then
echo ' ('"$p"') Gender based analysis (Females vs males) in PD patients.' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_FemaleVsMale_control.png ]
then
echo ' ('"$p"') Gender based analysis (Females vs males) in controls.' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
fi
echo ' ('"$p"') Status based analysis (PD patients vs controls).' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_PDVsControl_females.png ]
then
echo ' ('"$p"') Status based analysis (PD patients vs controls) for females.' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_PDVsControl_males.png ]
then
echo ' ('"$p"') Status based analysis (PD patients vs controls) for males.' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_Gender_disease_status.png ]
then
echo ' ('"$p"') Factorial analysis (focus on disease status differences for the different genders).' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
fi
echo ' }' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '\end{figure}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '' >> ${OUTPUT_FOLDER}/results_summary.tex
# Venn plots.
echo '\begin{figure}[ht]' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \centering' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_FemaleVsMale.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_FemaleVsMale_PD.png ]
then
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_FemaleVsMale_PD.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_FemaleVsMale_control.png ]
then
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_FemaleVsMale_control.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_PDVsControl.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_PDVsControl_females.png ]
then
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_PDVsControl_females.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_PDVsControl_males.png ]
then
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_PDVsControl_males.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_Gender_disease_status.png ]
then
echo ' \includegraphics[scale=0.23]{'"$OUTPUT_FOLDER"''"$datasetName"'_venn_Gender_disease_status.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
echo ' \caption{Venn diagrams of the significant genes for all Limma analyses and for dataset '"$datasetName"'.' | sed -r 's/_/\\_/g' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' From top to bottom and from left to right: ' >> ${OUTPUT_FOLDER}/results_summary.tex
p=1
echo ' ('"$p"') Gender based analysis (Females vs males)' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_FemaleVsMale_PD.png ]
then
echo ' ('"$p"') Gender based analysis (Females vs males) in PD patients.' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_FemaleVsMale_control.png ]
then
echo ' ('"$p"') Gender based analysis (Females vs males) in controls.' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
fi
echo ' ('"$p"') Status based analysis (PD patients vs controls).' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_PDVsControl_females.png ]
then
echo ' ('"$p"') Status based analysis (PD patients vs controls) for females.' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_PDVsControl_males.png ]
then
echo ' ('"$p"') Status based analysis (PD patients vs controls) for males.' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
fi
if [ -f ${OUTPUT_FOLDER}${datasetName}_MD_Gender_disease_status.png ]
then
echo ' ('"$p"') Factorial analysis (focus on disease status differences for the different genders).' >> ${OUTPUT_FOLDER}/results_summary.tex
p=$((p+1))
fi
echo ' }' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '\end{figure}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
done
......
......@@ -169,6 +169,9 @@ for (i in seq_len(length(config$datasets))) {
correct_for_batch = dataset$has_batches,
cofactor_name = "Tissue",
block_key = "Patient",
run_topconfects = TRUE,
output_data_dir = output_data_dir,
file_prefix = dataset_name,
verbose = TRUE)
} else {
# We do not have paired data. Let's then set the age and batch co-factors.
......@@ -178,13 +181,18 @@ for (i in seq_len(length(config$datasets))) {
fit <- ArrayUtils::run_limma(pheno_data, exp_eset, limma_parameters,
correct_for_age = age_correct,
correct_for_batch = dataset$has_batches,
run_topconfects = TRUE,
output_data_dir = output_data_dir,
file_prefix = dataset_name,
verbose = TRUE)
}
rm(age_correct)
message(paste0("[", Sys.time(), "][", dataset_name, "][", j, "] Limma fit done."))
# We extract the DEGs for the coefficient of interest (for that limma analysis).
ArrayUtils::extract_DEGs(fit, limma_parameters$name, 1, output_data_dir, dataset_name)
ArrayUtils::extract_DEGs(fit, limma_parameters$name, 1,
output_data_dir = output_data_dir,
file_prefix = dataset_name)
rm(limma_parameters)
message(paste0("[", Sys.time(), "][", dataset_name, "][", j, "] DEG extraction done."))
} # End for each Limma analysis.
......
......@@ -23,16 +23,6 @@ limma_analyses:
coefficient: "PD - Control"
name: "PDVsControl"
clinical_factor: "Disease_status"
-
factor: gender_disease_status
coefficient: "F.PD - F.Control"
name: "PDVsControl_females"
clinical_factor: "Disease_status_females"
-
factor: gender_disease_status
coefficient: "M.PD - M.Control"
name: "PDVsControl_males"
clinical_factor: "Disease_status_males"
-
factor: gender_disease_status
coefficient: "F.PD - M.PD"
......@@ -43,6 +33,16 @@ limma_analyses:
coefficient: "F.Control - M.Control"
name: "FemaleVsMale_control"
clinical_factor: "Gender_Control"
-
factor: gender_disease_status
coefficient: "F.PD - F.Control"
name: "PDVsControl_females"
clinical_factor: "Disease_status_females"
-
factor: gender_disease_status
coefficient: "M.PD - M.Control"
name: "PDVsControl_males"
clinical_factor: "Disease_status_males"
-
factor: gender_disease_status
coefficient: "(F.PD - F.Control) - (M.PD - M.Control)"
......
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