comparison combineAnnotations.R @ 5:3de08f3c4fb6 draft

planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 75d13d0237560528a1c6596a3ea5e327bed3e3a0
author tomnl
date Tue, 18 Jun 2019 10:44:54 -0400
parents 13985cdcf0ba
children 5dd61e94d70d
comparison
equal deleted inserted replaced
4:13985cdcf0ba 5:3de08f3c4fb6
45 opt$probmetab_resultPth, 45 opt$probmetab_resultPth,
46 weights = weights) 46 weights = weights)
47 47
48 write.table(summary_output, file.path(opt$outdir, 'combined_annotations.tsv'), sep = '\t', row.names = FALSE) 48 write.table(summary_output, file.path(opt$outdir, 'combined_annotations.tsv'), sep = '\t', row.names = FALSE)
49 49
50 if (!is.null(opt$eic)){
51
52 if (is.null(xset)){
53 xset <- xa@xcmsSet
54 }
55 # previous check should have matched filelists together
56 xset@filepaths <- unname(pa@fileList)
57
58 convert2Raw <- function(x, xset){
59 sid <- unique(x$sample)
60 # for each file get list of peaks
61 x$rt_raw <- xset@rt$raw[[sid]][match(x$rt, xset@rt$corrected[[sid]])]
62 x$rtmin_raw <- xset@rt$raw[[sid]][match(x$rtmin, xset@rt$corrected[[sid]])]
63 x$rtmax_raw <- xset@rt$raw[[sid]][match(x$rtmax, xset@rt$corrected[[sid]])]
64 return(x)
65
66 }
67
68 xset@peaks <- as.matrix(plyr::ddply(data.frame(xset@peaks), ~ sample, convert2Raw, xset=xset))
69
70 # Saves the EICS into the previously created database
71 px <- msPurity::purityX(xset, saveEIC = TRUE,
72 cores=1, sqlitePth=db_pth,
73 rtrawColumns = TRUE)
74
75 }
76 50
77 closeAllConnections() 51 closeAllConnections()
78 52