Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
Added intersection between experiments
  • Loading branch information
OrhunKok authored Oct 28, 2023
1 parent 60d89d3 commit dcab814
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions modules/dia-nn/020_Ion_Sampling/instrument_20_DIA_MS1_MS2_Ratio.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
init <- function() {

type <- 'plot'
box_title <- 'MS2/MS1 Intensity Ratio per precursor'
help_text <- 'Plotting the MS2/MS1 Intensity Ratio for all precursors.'
box_title <- 'MS2/MS1 Intensity Ratio for Intersected Precursors'
help_text <- 'Plotting the MS2/MS1 Intensity Ratio for Intersected precursors.'
source_file <- 'report'

.validate <- function(data, input) {
Expand All @@ -16,6 +16,22 @@ init <- function() {
plotdata$Ms1.Area <- as.numeric(plotdata$Ms1.Area)
plotdata$Precursor.Quantity <- as.numeric(plotdata$Precursor.Quantity)


#Assemble list of peptides in each Raw file
plotdata$Raw.file <- factor(plotdata$Raw.file)
expsInDF <- levels(plotdata$Raw.file)
peplist <- list()
for (i in 1:length(expsInDF)){
peptidesDF <- dplyr::filter(plotdata, Raw.file == expsInDF[i])
peptides <- dplyr::select(peptidesDF, Precursor.Id)
peplist[[i]] <- peptides
}
#Get intersection of all peptides
intersectList <- as.vector(Reduce(intersect, peplist))
#Get reduced dataframe for elements that match intersection
plotdata_Intersected <- dplyr::filter(plotdata, Precursor.Id %in% intersectList$Precursor.Id)
plotdata <- plotdata_Intersected

plotdata <- plotdata %>%
group_by(Raw.file, Precursor.Id) %>%
mutate(Ms2.Ms1.Ratio = Precursor.Quantity / Ms1.Area)
Expand Down

0 comments on commit dcab814

Please sign in to comment.