Commit 99429f00 authored by Lena Hersemann's avatar Lena Hersemann

if identification type information and protein information are available in...

if identification type information and protein information are available in the specified ms_data_prep_infos folder the information will now be included in the ms_limma result files
parent f71f7453
......@@ -13,7 +13,7 @@ suppressMessages(require(docopt))
doc = '
Perform a differential gene expression analysis using limma and edgeR
Usage: ms_limma.R [options] <count_matrix> <design_matrix>
Usage: ms_limma.R [options] <count_matrix> <design_matrix> <ms_data_prep_infos>
Options:
--contrasts=<tab_delim_table> Table with sample pairs for which dge analysis should be performed
......@@ -22,7 +22,6 @@ Options:
--pcutoff <pcutoff> Override q-value filter and filter by p-value instead
--out <name_prefix> Name to prefix all generated result files [default: ]
--lfc <lfc_cutoff> Just report genes with abs(lfc) > lfc_cutoff as hits [default: 1.0]
--protein_info <info_file> Protein infos extracted from MaxQuant result file and exported as part of ms_data_prep.R
'
# commandArgs = function(foo) c("--contrast", "contrasts.txt", "--protein_info", "../data_prep.feature_information.txt", "intens_imputed.txt", "exp_design.txt")
......@@ -57,6 +56,7 @@ count_matrix_file = opts$count_matrix
design_matrix_file = opts$design_matrix
contrasts_file = opts$contrasts
protein_info_file = opts$protein_info
ms_data_infos = opts$ms_data_prep_infos
assert(is.null(protein_info_file) || file.exists(protein_info_file), "invalid protein_info_file")
......@@ -102,12 +102,12 @@ if(!str_detect(expDesign$replicate, paste0(colnames(countData), sep = "|"))) { s
# import protein information
if (is.null(protein_info_file)) {
protein_info = distinct(countData, protein_ids)
prot_info <- file.path(ms_data_infos, "data_prep.feature_information.txt")
if (file.exists(prot_info)) {
protein_info <- read_tsv(prot_info)
} else {
protein_info <- read_tsv(protein_info_file)
protein_info = distinct(countData, protein_ids)
}
colnames(protein_info[,1]) <- "protein_ids"
#'
#' <br><br>
......@@ -440,6 +440,15 @@ deResults %>%
## Annotate results
deAnnot = deResults %>% left_join(protein_info, by = "protein_ids")
ident_info <- file.path(ms_data_infos, "data_prep.ident_types_summary.txt")
if (file.exists(ident_info)) {
ident <- read_tsv(ident_info)
deAnnot %<>%
left_join(ident %>% rename(c1_ident = ident_by_msms_match_missing), by = c("protein_ids", "condition_1" = "condition")) %>%
left_join(ident %>% rename(c2_ident = ident_by_msms_match_missing), by = c("protein_ids", "condition_2" = "condition"))
}
########################################################################################################################
#' ## Results & Discussion
......
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