forked from MiguelCos/peptide_to_protein_mapping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pept2protein_n_drawProteins_integration.R
80 lines (48 loc) · 2.11 KB
/
pept2protein_n_drawProteins_integration.R
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
### Script for integrating peptide to protein mapping with drawProteins package ----
# for visualization of structural information
# Miguel Cosenza 21.05.2020 ----
# Load packages ----
library(tidyverse)
library(drawProteins)
## WHICH PROTEIN DO YOU WANT TO PLOT? ----
# please type the UNIPROT ID for the desired protein
proteinid <- "P37802"
# Q5JWB9
## EXECUTE CODE ----
# Load required data ----
if(!exists("pepts")){
pepts <- read.delim(file = "Data/peptides.txt",
sep = "\t",
stringsAsFactors = FALSE)}
if(!exists("proteins")){
proteins <- read.delim(file = "Data/proteinGroups.txt",
sep = "\t",
stringsAsFactors = FALSE)}
coverageinfo <- dplyr::select(proteins,
Protein.IDs, matches("Sequence.coverage....")) %>%
mutate(protein = stringr::word(Protein.IDs, sep = ";")) %>%
dplyr::select(-Protein.IDs, protein,matches("Sequence.coverage....")) %>%
dplyr::select(protein,Sequence.coverage....)
# Generate data frame for plotting ----
source(here::here("R/getcovaragedata.R"))
covdata <- getcoveragedata(proteinGroups = proteins,
peptides = pepts,
id = proteinid)
## Extract protein features from Uniprot with drawProteins package ----
features <- drawProteins::get_features(proteinid)
featuresdf <- drawProteins::feature_to_dataframe(features)
## Integrate peptide features and uniprot features ----
source(here::here("R/add_peptides.R"))
wpept_features <- add_peptides(featuresdf,
peptide_coverage_data = covdata)
# drawCanvas
canvas <- draw_canvas(wpept_features)
# draw the protein chain
wchain <- draw_chains(canvas, wpept_features)
# draw domains
wdomains <- draw_domains(wchain, wpept_features, label_domains = FALSE)
# draw folding (structural info) ----
hel <- draw_folding(wdomains, wpept_features)
# draw peptides ----
source(here::here("R/draw_peptides.R"))
w_pepts <- draw_peptides(hel, wpept_features)