Skip to content

Commit

Permalink
Merge pull request #240 from MoTrPAC/prot-tmt18-support
Browse files Browse the repository at this point in the history
Enable TMT-18
  • Loading branch information
biodavidjm authored May 23, 2024
2 parents 2565633 + 32380bc commit 9f234c7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: MotrpacBicQC
Type: Package
Title: QC/QA functions for the MoTrPAC community
Version: 0.9.4
Date: 2024-05-16
Version: 0.9.41
Date: 2024-05-22
Author: MoTrPAC Bioinformatics Center
Maintainer: David Jimenez-Morales <davidjm@stanford.edu>
Description: R Package for the analysis of MoTrPAC datasets.
Expand Down
4 changes: 4 additions & 0 deletions R/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ filter_required_columns <- function(df,
emeta_sample_coln <- append(emeta_sample_coln, "tmt16_channel")
if(verbose) message(" + (+) All required columns present (tmt16 experiment)")
df <- subset(df, select = emeta_sample_coln)
}else if("tmt18_channel" %in% colnames(df)){
emeta_sample_coln <- append(emeta_sample_coln, "tmt18_channel")
if(verbose) message(" + (+) All required columns present (tmt18 experiment)")
df <- subset(df, select = emeta_sample_coln)
}else{
if(verbose) message(" - (-) Expected COLUMN NAMES are missed: FAIL")
}
Expand Down
35 changes: 24 additions & 11 deletions R/proteomics_qc.R
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,11 @@ check_vial_metadata_proteomics <- function(df_vm,
}else if("tmt16_channel" %in% colnames(df_vm)){
required_columns <- c("vial_label", "tmt_plex", "tmt16_channel")
tmt_channel <- "tmt16_channel"
}else if("tmt18_channel" %in% colnames(df_vm)){
required_columns <- c("vial_label", "tmt_plex", "tmt18_channel")
tmt_channel <- "tmt18_channel"
}else{
if(verbose) message(" - (-) `tmt[11|16]_channel` column not found")
if(verbose) message(" - (-) `tmt[11|16|18]_channel` column not found")
ic_vm <- 3
return(ic_vm)
}
Expand All @@ -542,6 +545,9 @@ check_vial_metadata_proteomics <- function(df_vm,
}else if("tmt16_channel" %in% colnames(df_vm)){
df_vm$vial_label <- gsub(" ", "", df_vm$vial_label)
valid_channels <- c("126C", "127N", "127C", "128N", "128C", "129N", "129C", "130N", "130C", "131N", "131C", "132N", "132C", "133N", "133C", "134N")
}else if("tmt18_channel" %in% colnames(df_vm)){
df_vm$vial_label <- gsub(" ", "", df_vm$vial_label)
valid_channels <- c("126C", "127N", "127C", "128N", "128C", "129N", "129C", "130N", "130C", "131N", "131C", "132N", "132C", "133N", "133C", "134N")
}

ic_vm <- 0
Expand All @@ -550,7 +556,7 @@ check_vial_metadata_proteomics <- function(df_vm,

for(p in plexes){
temp_plex <- df_vm[which(df_vm$tmt_plex == p),]
if(all(valid_channels %in% temp_plex[[tmt_channel]])){
if( all(valid_channels %in% temp_plex[[tmt_channel]]) ){
if(verbose) message(" + (+) All ", tmt_channel," channels are valid in plex ", paste(p))
}else{
if(tmt_channel == "tmt11_channel"){
Expand All @@ -566,15 +572,22 @@ check_vial_metadata_proteomics <- function(df_vm,
}
}
}

all_samples <- df_vm$vial_label
all_vial_labels <- NA

if( any( grepl("Ref", df_vm$vial_label) ) ){
all_vial_labels <- all_samples[!grepl('^Ref', all_samples)]
}else{
if(verbose) message(" - (-) Ref channels not found in vial_metadata")
ic_vm <- ic_vm + 1

# Check that all plexes have one channel
for(p in plexes){
temp_plex <- df_vm[which(df_vm$tmt_plex == p),]
if( sum(grepl("Ref", temp_plex$vial_label)) == 1 ){
if(verbose) message(" + (+) Ref channel found in plex ", paste(p))
}else if(sum(grepl("Ref", temp_plex$vial_label)) == 0) {
if(verbose) message(" - (-) Ref channel missed in plex ", paste(p))
ic_vm <- ic_vm + 1
}else if(sum(grepl("Ref", temp_plex$vial_label)) > 1) {
if(verbose) message(" - (-) Too many reference channels in plex ", paste(p))
if(verbose){
print(temp_plex[grepl("Ref", temp_plex$vial_label), ])
}
ic_vm <- ic_vm + 1
}
}

if( any(duplicated(df_vm$vial_label)) ){
Expand Down

0 comments on commit 9f234c7

Please sign in to comment.