plotmutagensis: ploting mutagensis

Description Usage Details Value Author(s) References See Also Examples

View source: R/Autoplotprotein.R

Description

Draw the mutagensis of the protein

Usage

1

Details

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 mutagensis

Value

The location, height and name of the transition point

Author(s)

Xiaoyu Zhang

References

https://cran.r-project.org/doc/manuals/R-exts.html

See Also

codehelp

Examples

  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
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
##---- 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)
    Mutagenesis = function(position, position2, color, height2, 
        height, up_down, start, end, pc, cex1) {
        h1 = -0.1
        h2 = -1.4
        h = -1.6
        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)
            }
        }
        x = 0
        kong1 = (round(log(start, 10)) + 1) * start/50
        kong2 = (round(log(end, 10)) + 1) * end/50
        if (round(log(end, 10)) + 1 <= 5) {
            kong2 = (round(log(end, 10)) + 1) * end/50
        }
        else {
            kong2 = 5 * end/50
        }
        boxplot(x, xlim = c(start - kong1, end + kong2), ylim = c(1, 
            -5.5), axes = FALSE, add = TRUE, border = FALSE)
        points(position2, height2, pch = pc, col = color, cex = cex1)
    }
    Change_h = function(muta_pos, muta_name, protein_h) {
        d = 0.1
        d1 = 0.26
        hh1 = -2.8
        height2 = 1:length(muta_pos)
        height2[1] = hh1 + protein_h - d1
        position_h = muta_pos
        position_h[1] = muta_pos[1]
        if (length(muta_pos) > 1) {
            for (i in 2:length(muta_pos)) {
                if (muta_pos[i] == position_h[i - 1]) {
                  height2[i] = height2[i - 1] - d
                }
                else {
                  height2[i] = hh1 + protein_h - d1
                }
            }
        }
        height2
    }
    Change_m = function(muta, protein_width) {
        dec = 1.4 * protein_width/100
        position3 = 1:length(muta)
        position3[1] = muta[1]
        if (length(muta) > 1) {
            for (i in 2:length(muta)) {
                if (muta[i] - muta[i - 1] <= dec) {
                  if (muta[i] != muta[i - 1]) {
                    position3[i] = position3[i - 1] + dec
                  }
                  else {
                    position3[i] = position3[i - 1]
                  }
                }
                else {
                  position3[i] = muta[i]
                }
            }
        }
        position3
    }
    if (!is.na(muta[1, 1])) {
        position3 = Change_m(muta[, 1], as.numeric(length[2]))
        height2 = Change_h(muta[, 1], muta[, 2], as.numeric(protein[4]))
        for (i in 1:nrow(muta)) {
            Mutagenesis(position = as.numeric(muta[i, 1]), position2 = position3[i], 
                color = as.character(muta[i, 2]), height2 = height2[i], 
                height = as.numeric(protein[4]), up_down = "up", 
                start = as.numeric(length[1]), end = as.numeric(length[2]), 
                pc = as.numeric(protein[7]), cex1 = as.numeric(protein[8]))
        }
    }
  }

Autoplotprotein documentation built on May 2, 2019, 9:12 a.m.