applyttestPep: Function to apply t-test separately for all peptides of each...

Description Usage Arguments Value See Also Examples

View source: R/applyttestPep.R

Description

Generate fold changes and p-values for each protein (col 1) determined by a number of peptides (col 2).

Usage

1
applyttestPep(peptides, Group, doLogs = TRUE, numerator = levels(as.factor(Group))[1])

Arguments

peptides

Data frame with two descriptive columns: proteins, peptides, then data in the remaining ncol - 2 columns.

Group

Factor describing data membership. Must have two levels, and length = ncol(mat) - 2.

doLogs

TRUE/FALSE, log-transform data prior to analysis

numerator

The group level used as the numerator in the fold change.

Value

Data frame with rows Protein, fold change and p-value.

See Also

applyttest

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# make random matrix with first 10 proteins differentially expressed
mat = exp(6+matrix(rnorm(6000), ncol=6))
Protein = sort(paste("P", sample(1:300, 1000, replace=TRUE)))
Peptide = paste("Pep", 1:1000)
for (j in 1:10) mat[Protein == unique(Protein)[j], 4:6] = 3*mat[Protein == unique(Protein)[j], 1:3]

res = applyttestPep(data.frame(Protein, Peptide, mat), rep(c("A", "B"), each=3), numerator="B")
# first 10 proteins should have fold change 3
plot(log(res$FC), -log(res$pval), col=rainbow(2)[1+ as.numeric(1:1000 > 10)])

# add some missing values
mat[5:20,4] = NA
res = applyttestPep(data.frame(Protein, Peptide, mat), rep(c("A", "B"), each=3), numerator="B")
# first 10 proteins should have fold change 3
plot(log(res$FC), -log(res$pval), col=rainbow(2)[1+ as.numeric(1:1000 > 10)])

SwathXtend documentation built on Nov. 8, 2020, 6:42 p.m.