1 | peptideBarPlot(peptide.assignment.fraction, peptide.assignment.original, prefix)
|
peptide.assignment.fraction |
|
peptide.assignment.original |
|
prefix |
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 | ##---- 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.assignment.fraction, peptide.assignment.original,
prefix)
{
peptide.slice.unique.idx <- lapply(strsplit(peptide.assignment.fraction,
";"), length) == 1
peptide.original.unique.idx <- lapply(strsplit(peptide.assignment.original,
";"), length) == 1
unique.count <- matrix(nrow = 2, ncol = 2)
unique.count[1, 1] <- sum(peptide.original.unique.idx)
unique.count[1, 2] <- sum(peptide.slice.unique.idx)
unique.count[2, 1] <- length(peptide.original.unique.idx) -
sum(peptide.original.unique.idx)
unique.count[2, 2] <- length(peptide.slice.unique.idx) -
sum(peptide.slice.unique.idx)
dev.new(width = 3.5, height = 5)
barplot(unique.count, ylim = c(0, 20000), ylab = "Number of Peptides",
names = c("Original", "Re-Fraction"), col = c("darkblue",
"red"), legend = c("Unique Peptide", "Shared Peptide"),
horiz = F, border = NA)
text(0.7, unique.count[1, 1]/2, unique.count[1, 1], cex = 1,
col = "white")
text(0.7, unique.count[1, 1] + unique.count[2, 1]/2, unique.count[2,
1], cex = 1, col = "white")
text(1.9, unique.count[1, 2]/2, unique.count[1, 2], cex = 1,
col = "white")
text(1.9, unique.count[1, 2] + unique.count[2, 2]/2, unique.count[2,
2], cex = 1, col = "white")
dev.new(width = 3.5, height = 5)
peptide.assignment.ratio <- c(sum(peptide.original.unique.idx)/length(peptide.original.unique.idx),
sum(peptide.slice.unique.idx)/length(peptide.slice.unique.idx))
peptide.assignment.ratio <- round(peptide.assignment.ratio *
100)
barplot(peptide.assignment.ratio, names = c("Original", "Re-Fraction"),
ylab = "Percentage of Unique Peptide (%)", col = c("darkblue",
"red"), border = NA)
text(0.7, peptide.assignment.ratio[1]/2, paste(round(peptide.assignment.ratio[1]),
"%", sep = ""), cex = 1, col = "white")
text(1.9, peptide.assignment.ratio[2]/2, paste(round(peptide.assignment.ratio[2]),
"%", sep = ""), cex = 1, col = "white")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.