|
6 | 6 | rm( list = ls() ) |
7 | 7 |
|
8 | 8 | # comment below for csv input |
9 | | -# args = commandArgs(trailingOnly=TRUE) |
| 9 | +args = commandArgs(trailingOnly=TRUE) |
10 | 10 | # uncomment below for csv input |
11 | | -# args = c("C:/Users/Jeremy/Desktop/Desktop/Instrumentation/Software/MSms/LipidMatch_Workflow/LMQ/2018_05_08_LMQ_Software/LMQ_settings.csv") |
12 | | -# args = c("/Users/JasonCochran/Documents/research/LipidMatch-Normalizer/LMQ_settings.csv") |
13 | | -args = c("C:/Users/Jeremy/Desktop/Desktop/Instrumentation/Software/MSms/LipidMatch_Workflow/LipidMatch_Normalizer/2018_07_18_LMN_Software/LMN_settings.csv") |
| 11 | +# args = c("C:/Users/Jeremy/Desktop/Desktop/Instrumentation/Software/MSms/LipidMatch_Workflow/LipidMatch_Normalizer/2018_07_18_LMN_Software/LN_settings.csv") |
14 | 12 |
|
15 | 13 | numAdducts <- NULL |
16 | 14 | numValues <- NULL |
@@ -265,13 +263,13 @@ invisible( apply(InternalStandard, 1, FindStandards) ) |
265 | 263 |
|
266 | 264 | rm(mz_tolerance, row, rt_tolerance, titles, FindStandards) |
267 | 265 |
|
| 266 | +# Make a table of just our matched Intd Standards to make quantifying easier |
| 267 | +write.table(matches, file = paste(paste(substr(featureTable_loc,1,nchar(featureTable_loc)-4),"IS_Found.csv", sep = "_"), sep = "/"), sep = ",", col.names = TRUE, row.names = FALSE) |
| 268 | + |
268 | 269 | ############################################# |
269 | 270 | ############### PART 2 & 3 ################## |
270 | 271 | ############################################# |
271 | 272 |
|
272 | | -# Make a table of just our matched Intd Standards to make quantifying easier |
273 | | -write.table(matches, file = paste(paste(substr(featureTable_loc,1,nchar(featureTable_loc)-4),"IS_Found.csv", sep = "_"), sep = "/"), sep = ",", col.names = TRUE, row.names = FALSE) |
274 | | - |
275 | 273 | # Setup a dataframe to store all the classes we need |
276 | 274 | quantClasses <- as.list( strsplit( as.character( InternalStandard$Classes), split = " " ) ) |
277 | 275 | quantClasses <- sapply( quantClasses , '[', seq(max(sapply(quantClasses, length)))) |
@@ -486,21 +484,32 @@ comparator = function(sel_group) { |
486 | 484 | apply(subset_sm, 1, quantifier, sel_IS = avgIntStd, curStandard = curStandard, score = 2 ) |
487 | 485 | } |
488 | 486 | } else { |
489 | | - subset_classes <- classes |
490 | | - avgIntStd <- which( abs( as.numeric(subset_classes$RT)-avgRT) == min(abs( as.numeric(subset_classes$RT)-avgRT)) ) |
491 | | - avgIntStd <- subset_classes[avgIntStd,] |
| 487 | + avgIntStd <- which( abs( as.numeric(classes$RT)-avgRT) == min(abs( as.numeric(classes$RT)-avgRT)) ) |
| 488 | + avgIntStd <- classes[avgIntStd,] |
| 489 | + if (grepl("].+",sel_group[2])) { |
| 490 | + PosFeature<-TRUE |
| 491 | + } else { |
| 492 | + PosFeature<-FALSE |
| 493 | + } |
| 494 | + if (PosFeature==TRUE) { |
| 495 | + matches_subset<-matches[grep("].+",matches[,ncol(matches)]),] |
| 496 | + } |
| 497 | + if (PosFeature==FALSE) { |
| 498 | + matches_subset<-matches[grep("].-",matches[,ncol(matches)]),] |
| 499 | + } |
492 | 500 | curStandard <- which( matches$matchClass == avgIntStd[,1] ) |
493 | 501 | curStandard <- matches[curStandard,] |
494 | 502 | # Need to refine selection of curStandard to account for m/z average |
495 | 503 | mzAvg <- mean(subset_sm[,mzCol]) |
496 | 504 | mzAvgFeature <- which( abs( as.numeric(curStandard[,mzCol])-mzAvg) == min(abs( as.numeric(curStandard[,mzCol])-mzAvg)) ) |
497 | 505 | curStandard <- curStandard[mzAvgFeature,] |
| 506 | + #browser() |
498 | 507 | if( nrow(curStandard) != 0 ) { |
499 | 508 | apply(subset_sm, 1, quantifier, sel_IS = avgIntStd, curStandard = curStandard, score = 3 ) |
500 | 509 | } |
501 | 510 | } |
502 | 511 | } else { |
503 | | - # print("No matches identified lipids were found to quantify using our current standard.") |
| 512 | + #print("No matches identified lipids were found to quantify using our current standard.") |
504 | 513 | } |
505 | 514 | } |
506 | 515 |
|
|
0 commit comments