Skip to content

Commit

Permalink
resolving gene-site ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
vladpetyuk committed May 6, 2024
1 parent 4d42787 commit 77c7bcb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions R/read_FragPipe_TMT.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,21 @@ read_FragPipe_TMT <- function(path = NULL, org_to_retain = NULL, use_gene_as_pro
else if (grepl("single-site", basename(path_to_file))) {
if(use_gene_as_prot_id){
df <- df %>%
filter(Gene != "") %>%
mutate(rowname = paste0(Gene,
"-",
sub("[^_]*_([A-Z]\\d+)","\\1",Index)))
if(anyDuplicated(df$rowname)){
stop("Duplicates in the gene-based site names. Switch to use_gene_as_prot_id = FALSE.")
}
# let's try to resolve by ReferenceIntensity
if(!("ReferenceIntensity" %in% colnames(df))){
stop("Duplicates in the gene-based site names. Can't resolve ambiguity.
Switch to use_gene_as_prot_id = FALSE.")
} else {
df <- df %>%
group_by(rowname) %>%
slice_max(ReferenceIntensity)
}
}
}else{
df <- df %>% mutate(rowname = Index)
}
Expand Down

0 comments on commit 77c7bcb

Please sign in to comment.