Learn R Programming

SwathXtend (version 1.0.0)

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

Description

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

Usage

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.

Details

References

See Also

applyttest

Examples

Run this code

# 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)])

Run the code above in your browser using DataLab