forked from MiguelCos/peptide_to_protein_mapping
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotein_coverage_visualization.R
48 lines (30 loc) · 1.15 KB
/
protein_coverage_visualization.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
## Protein coverage visualization script ----
# Miguel Cosenza 07.05.2020 ----
## WHICH PROTEIN DO YOU WANT TO PLOT? ----
# please type the UNIPROT ID for the desired protein
proteinid <- "A0A024QZX5"
# 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)}
# Generate data frame for plotting ----
source(here::here("R/getcovaragedata.R"))
covdata <- getcoveragedata(proteinGroups = proteins,
peptides = pepts)
# Generate peptide-to-protein coverage plot ----
source(here::here("R/plot_coverage.R"))
plot_coverage(covdata,
id = proteinid)
covplot <- plot_coverage(covdata,id = proteinid)
print(covplot)
# Generate image file ----
if(!dir.exists("Plot_outputs"))dir.create("Plot_outputs")
ggsave(filename = paste0("Plot_outputs/coverage_plot_",proteinid,".tiff"),plot = covplot,
device = 'tiff')