suppressMessages(library(limma))
suppressMessages(library(qvalue))
suppressMessages(library(data.table))
suppressMessages(library(cowplot))
suppressMessages(library(tidyverse))
cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
#set1 <- fread('../data/ALA_Set01.csv')
#set2 <- fread('../data/ALA_Set02.csv')
#set3 <- fread('../data/ALA_Set03.csv')
#set4 <- fread('../data/ALA_Set04.csv')
#set5 <- fread('../data/ALA_Set05.csv')
set1 <- fread(file.path('..', 'data', 'data_09162017', 'Set01.csv'))
set2 <- fread(file.path('..', 'data', 'data_09162017', 'Set02.csv'))
set3 <- fread(file.path('..', 'data', 'data_09162017', 'Set03.csv'))
set4 <- fread(file.path('..', 'data', 'data_09162017', 'Set04.csv'))
set5 <- fread(file.path('..', 'data', 'data_09162017', 'Set05.csv'))
transformData <- function(dat){
dat <- subset(dat, Checked==TRUE)
setnames(dat,
old = c('Checked',
'Abundance: F1: 114, Control',
'Abundance: F1: 115, Sample',
'Abundance: F1: 116, Sample',
'Abundance: F1: 117, Sample'),
new = c('isProtein',
'X114',
'X115',
'X116',
'X117'))
dat <- dat[dat$isProtein == TRUE,]
dat <- dat[, c('Accession', 'Description', 'Exp. q-value',
'Coverage', '# Peptides', '# PSMs', '# Unique Peptides',
'# Protein Groups', '# AAs', 'X114', 'X115', 'X116', 'X117')]
dat <- transform(dat,
X114 = as.numeric(X114),
X115 = as.numeric(X115),
X116 = as.numeric(X116),
X117 = as.numeric(X117)
)
dat.melt <- melt(dat)
return(dat.melt)
}
makeBoxPlot <- function(dat){
ggplot(dat, aes(x=variable, y=value, fill=factor(variable))) +
geom_boxplot(position = "dodge") +
scale_fill_manual(values = c(cbPalette[2],cbPalette[4],cbPalette[6],cbPalette[7])) +
scale_y_log10()+ labs(fill='Channel') +
ggtitle('Intensitites') +
xlab('Channel') +
ylab('log2 Intensity')
}
set1.transformed <- transformData(set1)
To be consistent with reshape2's melt, id.vars and measure.vars are internally guessed when both are 'NULL'. All non-numeric/integer/logical type columns are conisdered id.vars, which in this case are columns [Accession, Description, Exp. q-value, Coverage, ...]. Consider providing at least one of 'id' or 'measure' vars in future.
set2.transformed <- transformData(set2)
To be consistent with reshape2's melt, id.vars and measure.vars are internally guessed when both are 'NULL'. All non-numeric/integer/logical type columns are conisdered id.vars, which in this case are columns [Accession, Description, Exp. q-value, Coverage, ...]. Consider providing at least one of 'id' or 'measure' vars in future.
set3.transformed <- transformData(set3)
To be consistent with reshape2's melt, id.vars and measure.vars are internally guessed when both are 'NULL'. All non-numeric/integer/logical type columns are conisdered id.vars, which in this case are columns [Accession, Description, Exp. q-value, Coverage, ...]. Consider providing at least one of 'id' or 'measure' vars in future.
set4.transformed <- transformData(set4)
To be consistent with reshape2's melt, id.vars and measure.vars are internally guessed when both are 'NULL'. All non-numeric/integer/logical type columns are conisdered id.vars, which in this case are columns [Accession, Description, Exp. q-value, Coverage, ...]. Consider providing at least one of 'id' or 'measure' vars in future.
set5.transformed <- transformData(set5)
To be consistent with reshape2's melt, id.vars and measure.vars are internally guessed when both are 'NULL'. All non-numeric/integer/logical type columns are conisdered id.vars, which in this case are columns [Accession, Description, Exp. q-value, Coverage, ...]. Consider providing at least one of 'id' or 'measure' vars in future.
Already normalized?
makeBoxPlot(set1.transformed) +ggtitle('Set1')
makeBoxPlot(set2.transformed) +ggtitle('Set2')
makeBoxPlot(set3.transformed) +ggtitle('Set3')
makeBoxPlot(set4.transformed) +ggtitle('Set4')
makeBoxPlot(set5.transformed) +ggtitle('Set5')
accessionList <- list(set1.transformed$Accession,
set2.transformed$Accession,
set3.transformed$Accession,
set4.transformed$Accession,
set5.transformed$Accession)
combos <- Reduce(c,lapply(2:length(accessionList),
function(x) combn(1:length(accessionList),x,simplify=FALSE) ))
lapply(combos, function(x) length(Reduce(intersect, accessionList[x])) )
[[1]]
[1] 2567
[[2]]
[1] 2373
[[3]]
[1] 2143
[[4]]
[1] 2447
[[5]]
[1] 2397
[[6]]
[1] 2111
[[7]]
[1] 2598
[[8]]
[1] 2243
[[9]]
[1] 2407
[[10]]
[1] 2194
[[11]]
[1] 2095
[[12]]
[1] 1896
[[13]]
[1] 2211
[[14]]
[1] 1926
[[15]]
[1] 2066
[[16]]
[1] 1924
[[17]]
[1] 1902
[[18]]
[1] 2122
[[19]]
[1] 1931
[[20]]
[1] 1962
[[21]]
[1] 1763
[[22]]
[1] 1922
[[23]]
[1] 1790
[[24]]
[1] 1780
[[25]]
[1] 1785
[[26]]
[1] 1681