Description Usage Details Value Author(s) References See Also Examples
View source: R/Autoplotprotein.R
Draw the protein site
1 | plotsite()
|
The tool ennable visualization of amino acid changes at the protein level,The scale of a protein domain and the position of a functional motif/site will be precisely defined. The features available include site
Location of the site in 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | ##---- 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 ()
{
protein = read.table("Protein.txt", sep = "\t", stringsAsFactors = F)
domain = read.table("Domain.txt", sep = "\t", stringsAsFactors = F)
length = read.table("Length.txt", sep = "\t", stringsAsFactors = F)
site = read.table("Site.txt", sep = "\t", stringsAsFactors = F)
muta = read.table("Mutagenesis.txt", sep = "\t", stringsAsFactors = F)
option = read.table("Option.txt", sep = "\t", stringsAsFactors = F)
zoomin = read.table("ZoomIn.txt", sep = "\t", stringsAsFactors = F)
Site = function(position, position2, name, height = -0.3,
x_y, up_down) {
h1 = -0.1
h2 = -0.2
h = -0.4
hh1 = -2.8
if (up_down == "up") {
if (position == position2) {
segments(position, hh1 + height, position, hh1 +
height + h)
}
else {
segments(position, hh1 + height, position, hh1 +
height + h1)
segments(position2, hh1 + height + h - h2, position2,
hh1 + height + h)
segments(position, hh1 + height + h1, position2,
hh1 + height + h - h2)
}
text(position2, hh1 + height + h - 0.02, name, srt = 90,
adj = c(0, 0.5), cex = 0.8)
}
else {
if (position == position2) {
segments(position, hh1, position, hh1 - h)
}
else {
segments(position, hh1, position, hh1 - h1)
segments(position2, hh1 - h + h2, position2,
hh1 - h)
segments(position, hh1 - h1, position2, hh1 -
h + h2)
}
text(position2, hh1 - h + 0.02, name, srt = 270,
adj = c(0, 0.5), cex = 0.8)
}
}
Change_x = function(site_pos, site_name, protein_width) {
dec = 1.4 * protein_width/100
position2 = 1:length(site_pos)
position2[1] = site_pos[1]
if (length(site_pos) > 1) {
for (i in 2:length(site_pos)) {
if (site_pos[i] - site_pos[i - 1] <= dec) {
if (site_pos[i] != site_pos[i - 1]) {
position2[i] = position2[i - 1] + dec
}
else {
position2[i] = position2[i - 1]
}
}
else {
position2[i] = site_pos[i]
}
}
}
return(position2)
}
if (!is.na(site[1, 1])) {
position2 = Change_x(site[, 1], site[, 2], as.numeric(length[2]))
for (i in 1:nrow(site)) {
Site(position = as.numeric(site[i, 1]), position2 = position2[i],
name = as.character(site[i, 2]), height = as.numeric(protein[4]),
x_y = flag, up_down = "up")
}
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.