Commit edabaa22 authored by Lena Hersemann's avatar Lena Hersemann

changed reporting of imputation and added export of imputation information

parent bcf2169c
......@@ -629,27 +629,21 @@ imputeData = normData %>%
left_join(expDesign, by=c("sample"="replicate")) %>%
group_by(condition, protein_ids) %>%
mutate(intensity_imp=impute_some(intensity)) %>%
ungroup() %>% select(protein_ids, sample, intensity_imp) %>%
spread(sample, intensity_imp)
ungroup()
# before impute
# msData[, 1:4] %>% arrange(protein_ids) %>% tail()
# after mean-impute of semi-complete records
# imputeData[, 1:4] %>% arrange(protein_ids) %>% tail()
imputeData %>% mutate(is_imputed = intensity != intensity_imp) %>%
write_tsv(path=add_prefix("imputation_info.txt"))
print(paste0(nrow(anti_join(msData, imputeData)), " out of ", nrow(msData), " rows changed due to imputation"))
print(paste0(nrow(anti_join(imputeData, normData)), " entries changed due to imputation"))
if (sample_num != ncol(imputeData)-1) {stop("ATTENTION: Final intensities matrix does not contain all input samples")}
finalData <- imputeData %>% select(protein_ids, sample, intensity_imp) %>%
spread(sample, intensity_imp)
if (sample_num != ncol(finalData)-1) {stop("ATTENTION: Final intensities matrix does not contain all input samples")}
#TODO: report information for each gene and condition, whether any value was imputed and add information to final limma results
# after zero-imputing of all remaining NAs
imputeData %<>% mutate_if(is.numeric, funs(replace(., is.na(.), 0)))
# imputeData
write_tsv(imputeData, path=add_prefix("intens_imputed.txt"))
# imputeData <- read_tsv(add_prefix("intens_imputed.txt"))
# [imputeData](`r add_prefix("intens_imputed.txt")`)
finalData %<>% mutate_if(is.numeric, funs(replace(., is.na(.), 0)))
write_tsv(finalData, path=add_prefix("intens_imputed.txt"))
#-----------------------------------------------------------------------------------------------------------------------
......
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