Description Usage Details Value Author(s) References See Also Examples
Download the length of the protein, including the starting and ending positions
1 |
Download the length of the protein, including the starting and ending positions
The length of the protein
Xiaoyu Zhang
https://cran.r-project.org/doc/manuals/R-exts.html
codehelp
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 | ##---- 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 ()
{
library(XML)
library(plyr)
protein = read.table("Protein.txt", sep = "\t", stringsAsFactors = F)
name = protein[2]
url_p = "http://www.uniprot.org/uniprot/"
url_s = "#showFeatures"
url_w = paste(url_p, name, url_s, sep = "")
url = url_w
doc <- htmlParse(url)
position_l = xpathSApply (doc, "//table[@id= 'peptides_section']
/tr/td/ a[@class = 'position tooltipped']",
xmlValue)
s_l <- c()
for (i in 1:length(position_l)) {
s_l[i] <- gsub(pattern = "//D", replacement = "x", position_l[i])
}
s_l <- strsplit(s_l, "xxx")
d2_l <- laply(s_l, function(x) x[2])
r1_l <- 0
r2_l <- d2_l
dfrm_l <- data.frame(r1_l, r2_l)
write.table(dfrm_l, file = "Length.txt", sep = "/t", quote = FALSE,
row.names = F, col.names = F)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.