Commit 8918e9c1 authored by Leon-Charles Tranchevent's avatar Leon-Charles Tranchevent
Browse files

Second part of the Step 05 update.

parent 93963df9
......@@ -60,7 +60,7 @@ do
echo ' \includegraphics[scale=0.32]{'"$OUTPUT_FOLDER"''"${datasetName}"'_plot_YvsX.png}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' \caption{Plots for the '"$datasetName"' dataset. (Left) Heatmap for all Y-chromosome probes.' | sed -r 's/_/\\_/g' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' (Right) Plot of the ratio between the average Y and average X signals.' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' Blue is for females, green for males and grey for unknow gender.}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo ' Blue is for females, green for males and grey for unknown gender.}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '\end{figure}' >> ${OUTPUT_FOLDER}/results_summary.tex
echo '' >> ${OUTPUT_FOLDER}/results_summary.tex
fi
......
......@@ -8,6 +8,9 @@ library("Biobase")
library("hgu133plus2.db")
library("hgu133a.db")
library("u133x3p.db")
library("illuminaHumanv3.db")
library("hgug4112a.db")
library("hgfocus.db")
library("ArrayUtils")
library("tidyverse")
source("../libs/conf/confR.R")
......@@ -70,10 +73,23 @@ for (i in seq_len(length(config$datasets))) {
exp_eset <- ArrayUtils::read_eset(exp_data_fn)
# Annotate the eset with gene information for better outputs.
# First, we collect raw the gene annotations from bioconductor packages.
gene_annots_raw <- ArrayUtils::get_affy_annots(dataset$array_type, rownames(exp_eset))
# TODO: here read instead the sorted GPL file for special case.
# Then we still need to collapose the rows and merge to the rownames of eset.
# First, we collect raw the gene annotations and we have two options
# either from the Bioconductor package or from the processed GPL file.
platform_config <- get_platform(config, dataset$array_type)
# First, from a bioconductor package (usual case).
gene_annots_raw <- NULL
if (platform_config$library_name != "NA") {
gene_annots_raw <- ArrayUtils::get_gene_annots_from_package(platform_config$library_name,
rownames(exp_eset))
} else {
# TODO: here read instead the sorted GPL file for special case.
gpl_annot_folder <- paste0(raw_data_dir, "/Platforms/")
gpl_annot_filename <- paste0(platform_config$geo_name, "_gene_annots.tsv")
gene_annots_raw <- ArrayUtils::get_gene_annots_from_file(gpl_annot_folder,
gpl_annot_filename,
rownames(exp_eset))
}
# Then, we make sure we deal with duplicates and reorder the df to match the eset.
gene_annots_raw %>%
......
......@@ -4,33 +4,40 @@ platforms:
platform_name: HGU133A
biomart_name: affy_hg_u133a
geo_name: GPL96
library_name: hgu133a.db
-
vendor: Affymetrix
platform_name: HGU133Plus2
biomart_name: affy_hg_u133_plus_2
geo_name: GPL570
library_name: hgu133plus2.db
-
vendor: Affymetrix
platform_name: U133_X3P
biomart_name: affy_u133_x3p
geo_name: GPL1352
library_name: u133x3p.db
-
vendor: Affymetrix
platform_name: HG-Focus
biomart_name: affy_hg_focus
geo_name: GPL201
library_name: hgfocus.db
-
vendor: Agilent
platform_name: G4112F
biomart_name: agilent_wholegenome_4x44k_v1
geo_name: GPL6480
library_name: hgug4112a.db
-
vendor: Illumina
platform_name: HumanV2
biomart_name: NA
geo_name: GPL6255
library_name: NA
-
vendor: Illumina
platform_name: HumanV3
biomart_name: illumina_humanht_12_v3
geo_name: GPL6947
library_name: illuminaHumanv3.db
\ No newline at end of file
......@@ -16,11 +16,11 @@ library("yaml")
#' to the names given in the YAML files. All YML files are read when filenames are
#' not provided.
#'
#' @param config_dirs The folders in which configuration files are located.
#' Default to NULL.
#' @param config_files The names of the project configuration files.
#' Default to NULL.
#' @return A list of parameters extracted from the read files.
#' @param config_dirs The folders in which configuration files are located.
#' Default to NULL.
#' @param config_files The names of the project configuration files.
#' Default to NULL.
#' @return A list of parameters extracted from the read files.
read_config <- function(config_dirs = NULL,
config_files = NULL) {
......@@ -78,3 +78,25 @@ read_config <- function(config_dirs = NULL,
# Return the full configuration.
return(conf)
}
#' @title To obtain the platform configuration of a given platform.
#'
#' @description This function parses the configuration of all platforms and only
#' returns the configuration of the desired platform (defined by name).
#'
#' @param configuration The overall configuration (incl. of the platforms).
#' @param platform_name The name of the platform whose configuration is required.
#' Default to "".
#' @return The platform configuration as a vector. One item of the global configuration list.
get_platform <- function(configuration, platform_name = "") {
local_configuration <- configuration
if (!is.null(configuration$platforms)) {
local_configuration <- configuration$platforms
}
for(i in seq_len(length(local_configuration))) {
if (local_configuration[[i]]$platform_name == platform_name) {
return(local_configuration[[i]])
}
}
return(NULL)
}
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