Skip to content

Commit 0ca06bc

Browse files
authored
Merge pull request #13 from weaversd/VolcanoErrorHandling
v0.1.12
2 parents f23d77b + 3a2b4fa commit 0ca06bc

4 files changed

Lines changed: 22 additions & 47 deletions

File tree

Documentation/Release Updates.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,9 @@ Version 0.1.10
5252

5353
Version 0.1.11
5454
2022-11-22
55-
- Added annotation option to display amino acid sequence along the x-axis.
55+
- Added annotation option to display amino acid sequence along the x-axis.
56+
57+
Version 0.1.12
58+
2023-03-10
59+
- Fixed bug that displayed peptide multiple times on volcano plot
60+
- Fixed PEAKS import bug

server.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ server <- function(input, output, session) {
120120

121121

122122
output$plot_intensity1 <- renderPlotly({
123+
print(intensity_vec1())
123124
validate(
124125
need(nrow(peptides1()) > 0, "Invalid peptide file. Check format.")
125126
)
@@ -1157,9 +1158,6 @@ PTM_regex_length <- reactive(length(PTM_regex()))
11571158
equal_variance_bool = input$equal_var,
11581159
remove_na = input$remove_na,
11591160
set_na = input$set_na_value)
1160-
print(str(df))
1161-
print("^^^DF within server")
1162-
browser()
11631161
return(df)
11641162
})
11651163

ui.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ library(shiny)
22
ui <- navbarPage(title = "PrIntMap-R",
33
tabPanel("Documentation",
44
includeMarkdown("Documentation/Documentation.md"),
5-
"Version 0.1.11"), #update version here for each push
5+
"Version 0.1.12"), #update version here for each push
66
tabPanel("Run",
77
flowLayout(
88
fileInput(inputId = "database_file", label = "Upload fasta database file",

www/Volcano_plot_functions.R

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -115,36 +115,7 @@ read_peptide_tsv_Metamorpheus_volcano <- function(peptide_file, sample_pattern,
115115
peptides <- read.csv(peptide_file, sep = "\t", header = T)
116116
filetype(peptides, "Combined", "Metamorpheus")
117117
if(length(names(peptides)[grepl("Total.Ion.Current", names(peptides))]) >0){
118-
# if(!(any(grepl(sample_pattern, peptides$File.Name)))){
119-
# stop("Sample pattern not found in file.")
120-
# }
121-
# else{
122-
# peptides$sequence <- peptides$Base.Sequence
123-
# names(peptides)[grepl("Total.Ion.Current", names(peptides))] <- "Intensity"
124-
# names(peptides)[grepl("PSM.Count.*", names(peptides))] <- "PSM"
125-
# names(peptides)[names(peptides) == "Full.Sequence"] <- "PEPTIDE"
126-
# names(peptides)[names(peptides) == "Protein.Accession"] <- "protein"
127-
# peptides <- peptides[peptides$PSM > 0,]
128-
# peptides <- peptides[str_detect(peptides$File.Name, paste0(".*", sample_pattern, ".*")),]
129-
# sample_count <- length(unique(peptides$File.Name))
130-
#
131-
# return(peptides)
132-
#
133-
# if (intensity_metric == "PSM") {
134-
# peptides <- peptides %>% pivot_wider(names_from = File.Name, values_from = PSM)
135-
# } else if (intensity_metric == "Intensity") {
136-
# peptides <- peptides %>% pivot_wider(names_from = File.Name, values_from = Intensity)
137-
# }
138-
#
139-
# new_names <- rep(NA, sample_count)
140-
# for (i in 1:sample_count) {
141-
# new_names[i] <- paste0("Volcano_intensity_", i)
142-
# }
143-
#
144-
# colnames(peptides)[(ncol(peptides) - (sample_count-1)):ncol(peptides)] <- new_names
145-
#
146-
# return(peptides)
147-
# }}
118+
148119
stop("Only quantified peptide results may be used for volcano plot from MetaMorpheus")
149120
} else {
150121
if(length(names(peptides)[grepl(sample_pattern, names(peptides))])<=0){
@@ -335,9 +306,20 @@ read_peptide_csv_generic_volcano <- function(peptide_file, sample_pattern, min_v
335306
combine_two_volcano_dfs <- function(df_1, df_2, min_valid_sample = 2, fdr = 0.05,
336307
fold_change_cutoff_plot = 1, fold_change_cutoff_sig = 5,
337308
equal_variance_bool = T, remove_na = T, set_na = 0) {
309+
310+
print(paste0("rows in df_1: " ,nrow(df_1)))
311+
print(paste0("rows in df_2: " ,nrow(df_2)))
312+
print(names(df_1))
313+
314+
print(head(df_1$PEPTIDE))
315+
print(head(df_1$sequence))
316+
print(head(df_1$protien))
338317

339-
combine_df <- full_join(df_1, df_2, by = c("PEPTIDE", "sequence", "protein"))
318+
combine_df <- full_join(df_1, df_2, by = c("PEPTIDE", "sequence", "protein"), multiple = "any")
340319

320+
print(paste0("rows in combined: " ,nrow(combine_df)))
321+
print(names(combine_df))
322+
341323
volcano_df1 <- combine_df[,grepl("Volcano_intensity_.*\\.x", names(combine_df))]
342324
volcano_df2 <- combine_df[,grepl("Volcano_intensity_.*\\.y", names(combine_df))]
343325

@@ -396,9 +378,6 @@ combine_two_volcano_dfs <- function(df_1, df_2, min_valid_sample = 2, fdr = 0.05
396378
combine_df$neg10logp[i] <- -log(combine_df$p_val[i], base = 10)
397379
}
398380
}
399-
400-
print(head(combine_df))
401-
print("^^^ combined DF")
402381

403382
return(combine_df)
404383
}
@@ -450,7 +429,7 @@ create_volcano_plot <- function(df, fdr = 0.05,
450429
df$color[df$l2fc_xy < -fold_change_cutoff_plot & df$neg10logp > y_cutoff] <- "Significant"
451430

452431
if (!is.null(protein_of_interest)) {
453-
df$color[grepl(protein_of_interest, df$protein)] <- "Prot_of_interest"
432+
df$color[grepl(protein_of_interest, df$protein.x)] <- "Prot_of_interest"
454433
}
455434

456435
if (length(unique(df$color)) == 1) {
@@ -492,13 +471,6 @@ create_volcano_plot <- function(df, fdr = 0.05,
492471
plot_title <- paste0("Peptide Volcano Plot: ", intensity_metric, " (", protein_of_interest, ")")
493472
}
494473

495-
496-
print(head(df))
497-
print("^^^ final DF")
498-
499-
print(maxx)
500-
print(minx)
501-
502474
plot <- ggplot() +
503475
geom_vline(xintercept = fold_change_cutoff_plot, linetype = 2) +
504476
geom_vline(xintercept = -fold_change_cutoff_plot, linetype = 2) +

0 commit comments

Comments
 (0)