Commit 864d332b authored by domingue's avatar domingue

Outputs table with normalized intensities; add mean intensities to results table

parent 5b3943f6
......@@ -512,6 +512,8 @@ wrap_plots(volcano_l)
# ==========================================================================
# Tidy results
# ==========================================================================
library("SummarizedExperiment")
# Generate a wide data.frame
df_wide <- get_df_wide(dep)
# colnames(df_wide)
......@@ -519,14 +521,28 @@ df_wide <- get_df_wide(dep)
df_long <- get_df_long(dep)
# colnames(df_long)
# prepare sample means
sample_means <- df_wide %>%
# prepare condition means
cond_means <- df_wide %>%
select(name, experimental_design$label) %>%
gather(label, intensity, -name) %>%
left_join(experimental_design) %>%
group_by(name, condition) %>%
summarize(mean_expr = mean(intensity, na.rm = T)) %>%
ungroup()
ungroup() %>%
inner_join(., ., by = "name", suffix = c("_1", "_2")) %>%
rename(
condition_1 = "condition",
condition_2 = "control",
mean_expr_1 = "mean_expr_condition",
mean_expr_2 = "mean_expr_control"
)
all_means <- assay(dep) %>%
data.frame() %>%
rownames_to_column("name") %>%
gather(ID, val, -name) %>%
group_by(name) %>%
summarize(aveexpr = mean(val, na.rm = TRUE))
# prepare protein information
protein_info <- df_wide %>%
......@@ -583,9 +599,18 @@ dep_results <- stats_tab %>%
significant == "TRUE" & log2FoldChange < 0 ~ "Down"
)
) %>%
left_join(cond_means) %>%
left_join(all_means) %>%
left_join(protein_info)
## export intensities used for the differential expression analysis
assay(dep) %>%
as_df() %>%
rownames_to_column("name") %>%
left_join(protein_info) %>%
select(-imputed, -num_NAs) %>%
write_tsv(paste0(results_prefix, ".norm_abundance_by_replicate.txt"))
#' ### Frequency plot of significant proteins and overlap of conditions
......
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