1 | sampleSelector(peptide, slice.idx)
|
peptide |
|
slice.idx |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (peptide, slice.idx)
{
peptide.filtered <- peptide[grep("REV", invert = T, peptide[,
"Proteins"]), ]
peptide.filtered <- peptide.filtered[grep("CON", invert = T,
peptide.filtered[, "Proteins"]), ]
peptide.assignment <- as.character(peptide.filtered[, "Proteins"])
peptide.unique.idx <- lapply(strsplit(peptide.assignment,
";"), length) == 1
peptide.unique.pId <- peptide.assignment[peptide.unique.idx]
names(peptide.unique.pId) <- rownames(peptide.filtered)[peptide.unique.idx]
peptide.slices <- peptide.filtered[peptide.unique.idx, slice.idx]
peptide.range.slices <- peptide.slices[(rowSums(!is.na(peptide.slices)) <=
3), ]
peptide.count.slices <- peptide.range.slices[apply(peptide.range.slices,
1, max, na.rm = T) > 1, ]
selected <- c()
for (i in 1:nrow(peptide.count.slices)) {
idx <- which(!is.na(peptide.count.slices[i, ]))
if (length(idx) == 1) {
selected <- c(selected, rownames(peptide.count.slices)[i])
}
else {
flag <- 0
for (j in 1:(length(idx) - 1)) {
if ((idx[j] + 1) != idx[j + 1]) {
flag <- 1
}
}
if (flag == 0) {
selected <- c(selected, rownames(peptide.count.slices)[i])
}
}
}
peptide.unique.slices.pId <- peptide.unique.pId[selected]
peptide.unique.slices <- peptide.slices[selected, ]
train.psm <- list()
train.psm$selected <- selected
train.psm$pId <- peptide.unique.slices.pId
train.psm$fraction <- peptide.unique.slices
return(train.psm)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.