tests/testthat/test_heavylabels-functions.R

context("heavylabels-functions")

## test_that(".calculateHeavyLabels", {
##     path <- system.file(file.path("extdata"), package="Pbase")

##     p <- Proteins(file.path(path, "heavylabels_proteins_of_interest.fasta"))
##     r <- read.csv(file.path(path, "heavylabels_groundtruth.csv"),
##                 stringsAsFactors = FALSE)

##     ## the fasta file has invalid comments
##     ## names([email protected]) <- ametadata(p)$Comment
##     [email protected] <- aa(p)[order(names(aa(p)))]

##     ## cleave the proteins using PLGS rule
##     pc <- cleave(p, custom = "[KR](?=[^P])")

##     peptides <- setNames(r$Peptide, r$Protein)

##     ## calculate labeled peptides
##     heavyLabels <- calculateHeavyLabels(pc, peptides, endsWith = NULL)

##     ## ensure same order
##     i <- match(paste0(r$Protein, r$Peptide),
##                paste0(heavyLabels$Protein, heavyLabels$Peptide))
##     heavyLabels <- heavyLabels[i, ]

##     ## overwrite rownames
##     rownames(heavyLabels) <- NULL

##     ## compare only the following columns
##     cols <- c("Protein", "Peptide", "spikeTideResult", "spikeTide")

##     expect_equal(r[, cols], heavyLabels[, cols])
##     expect_error(calculateHeavyLabels(pc, unname(peptides)),
##                  paste0("No names for ", sQuote("peptides"), " available!"))
##     expect_error(calculateHeavyLabels(p, peptides),
##                  paste0("You have to ", sQuote("cleave"), " your proteins first!"))
## })

Try the Pbase package in your browser

Any scripts or data that you put into this service are public.

Pbase documentation built on Nov. 17, 2017, 9:03 a.m.