# HG changeset patch # User tomnl # Date 1574857931 0 # Node ID 8f4685455caf5afe7d8baa2a41235fb61711ec1e # Parent f078bb1b7da6369619f4a1faf7508270b77644f0 planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc diff -r f078bb1b7da6 -r 8f4685455caf averageFragSpectra.R --- a/averageFragSpectra.R Fri Sep 27 09:14:47 2019 -0400 +++ b/averageFragSpectra.R Wed Nov 27 12:32:11 2019 +0000 @@ -144,14 +144,18 @@ } else{ colnames(av_spectra)[1] <- 'grpid' av_spectra$grpid <- names(pa@av_spectra)[av_spectra$grpid] - - colnames(av_spectra)[2] <- 'fileid' - av_spectra$avid <- 1:nrow(av_spectra) + + if((length(pa@av_intra_params)>0) || (length(pa@av_inter_params)>0) ){ + # Add some extra info (only required if av_intra or av_inter performed) + colnames(av_spectra)[2] <- 'fileid' + av_spectra$avid <- 1:nrow(av_spectra) + + filenames <- sapply(av_spectra$fileid, function(x) names(pa@fileList)[as.integer(x)]) + # filenames_galaxy <- sapply(av_spectra$fileid, function(x) basename(pa@fileList[as.integer(x)])) + + av_spectra = as.data.frame(append(av_spectra, list(filename = filenames), after=2)) + } - filenames <- sapply(av_spectra$fileid, function(x) names(pa@fileList)[as.integer(x)]) - # filenames_galaxy <- sapply(av_spectra$fileid, function(x) basename(pa@fileList[as.integer(x)])) - - av_spectra = as.data.frame(append(av_spectra, list(filename = filenames), after=2)) print(head(av_spectra)) write.table(av_spectra, opt$out_peaklist, row.names=FALSE, sep='\t') diff -r f078bb1b7da6 -r 8f4685455caf combineAnnotations.R --- a/combineAnnotations.R Fri Sep 27 09:14:47 2019 -0400 +++ b/combineAnnotations.R Wed Nov 27 12:32:11 2019 +0000 @@ -14,15 +14,15 @@ make_option("--ms1_lookup_keepAdducts", type="character", default=NA), make_option("--ms1_lookup_dbSource", type="character", default="hmdb"), - make_option(c("-sw","--sm_weight"),type="numeric"), - make_option(c("-mw","--metfrag_weight"),type="numeric"), - make_option(c("-cw","--sirius_csi_weight"),type="numeric"), - make_option(c("-pw","--probmetab_weight"),type="numeric"), - make_option(c("-lw","--ms1_lookup_weight"),type="numeric"), - make_option(c("-bw","--biosim_weight"),type="numeric"), + make_option("--sm_weight", type="numeric"), + make_option("--metfrag_weight", type="numeric"), + make_option("--sirius_csi_weight", type="numeric"), + make_option("--probmetab_weight", type="numeric"), + make_option("--ms1_lookup_weight", type="numeric"), + make_option("--biosim_weight", type="numeric"), make_option("--create_new_database", action="store_true"), - make_option(c("-o","--outdir"),type="character", default="."), + make_option("--outdir", type="character", default="."), make_option("--compoundDbType", type="character", default="sqlite"), make_option("--compoundDbPth", type="character", default=NA), @@ -67,7 +67,8 @@ source_local <- function(fname){ argv <- commandArgs(trailingOnly=FALSE); base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)); source(paste(base_dir, fname, sep="/")) } source_local("dbconfig.R") }else{ - compoundDbType = compoundDbType + compoundDbPth = opt$compoundDbPth + compoundDbType = opt$compoundDbType compoundDbName = NA compoundDbHost = NA compoundDbPort = NA diff -r f078bb1b7da6 -r 8f4685455caf dimsPredictPuritySingle.R --- a/dimsPredictPuritySingle.R Fri Sep 27 09:14:47 2019 -0400 +++ b/dimsPredictPuritySingle.R Wed Nov 27 12:32:11 2019 +0000 @@ -4,10 +4,13 @@ option_list <- list( make_option(c("--mzML_file"), type="character"), + make_option(c("--mzML_files"), type="character"), + make_option(c("--mzML_filename"), type="character", default=''), + make_option(c("--mzML_galaxy_names"), type="character", default=''), make_option(c("--peaks_file"), type="character"), make_option(c("-o", "--out_dir"), type="character"), - make_option("--minOffset", default=0.5), - make_option("--maxOffset", default=0.5), + make_option("--minoffset", default=0.5), + make_option("--maxoffset", default=0.5), make_option("--ilim", default=0.05), make_option("--ppm", default=4), make_option("--dimspy", action="store_true"), @@ -25,48 +28,71 @@ print(sessionInfo()) print(opt) -if (is.null(opt$dimspy)){ +print(opt$mzML_files) +print(opt$mzML_galaxy_names) - df <- read.table(opt$peaks_file, header = TRUE, sep='\t') - filename = NA - mzml_file <- opt$mzML_file -}else{ - indf <- read.table(opt$peaks_file, - header = TRUE, sep='\t', stringsAsFactors = FALSE) - +str_to_vec <- function(x){ + print(x) + x <- trimws(strsplit(x, ',')[[1]]) + return(x[x != ""]) +} - if (file.exists(opt$mzML_file)){ - mzml_file <- opt$mzML_file - }else{ - - filename = colnames(indf)[8:ncol(indf)][opt$file_num_dimspy] - print(filename) - # check if the data file is mzML or RAW (can only use mzML currently) so - # we expect an mzML file of the same name in the same folder - indf$i <- indf[,colnames(indf)==filename] - indf[,colnames(indf)==filename] <- as.numeric(indf[,colnames(indf)==filename]) - - filename = sub("raw", "mzML", filename, ignore.case = TRUE) - print(filename) - - mzml_file <- file.path(opt$mzML_file, filename) - - } - - df <- indf[4:nrow(indf),] - if ('blank_flag' %in% colnames(df)){ - df <- df[df$blank_flag==1,] - } - colnames(df)[colnames(df)=='m.z'] <- 'mz' - - if ('nan' %in% df$mz){ - df[df$mz=='nan',]$mz <- NA - } - df$mz <- as.numeric(df$mz) - +find_mzml_file <- function(mzML_files, galaxy_names, mzML_filename){ + mzML_filename <- trimws(mzML_filename) + mzML_files <- str_to_vec(mzML_files) + galaxy_names <- str_to_vec(galaxy_names) + if (mzML_filename %in% galaxy_names){ + return(mzML_files[galaxy_names==mzML_filename]) + }else{ + stop(paste("mzML file not found - ", mzML_filename)) + } +} - +if (is.null(opt$dimspy)){ + df <- read.table(opt$peaks_file, header = TRUE, sep='\t') + if (file.exists(opt$mzML_file)){ + mzML_file <- opt$mzML_file + }else if (!is.null(opt$mzML_files)){ + mzML_file <- find_mzml_file(opt$mzML_files, opt$mzML_galaxy_names, + opt$mzML_filename) + }else{ + mzML_file <- file.path(opt$mzML_file, filename) + } +}else{ + indf <- read.table(opt$peaks_file, + header = TRUE, sep='\t', stringsAsFactors = FALSE) + + filename <- colnames(indf)[8:ncol(indf)][opt$file_num_dimspy] + print(filename) + # check if the data file is mzML or RAW (can only use mzML currently) so + # we expect an mzML file of the same name in the same folder + indf$i <- indf[,colnames(indf)==filename] + indf[,colnames(indf)==filename] <- as.numeric(indf[,colnames(indf)==filename]) + + filename = sub("raw", "mzML", filename, ignore.case = TRUE) + print(filename) + + + if (file.exists(opt$mzML_file)){ + mzML_file <- opt$mzML_file + }else if (!is.null(opt$mzML_files)){ + mzML_file <- find_mzml_file(opt$mzML_files, opt$mzML_galaxy_names, filename) + }else{ + mzML_file <- file.path(opt$mzML_file, filename) + } + + # Update the dimspy output with the correct information + df <- indf[4:nrow(indf),] + if ('blank_flag' %in% colnames(df)){ + df <- df[df$blank_flag==1,] + } + colnames(df)[colnames(df)=='m.z'] <- 'mz' + + if ('nan' %in% df$mz){ + df[df$mz=='nan',]$mz <- NA + } + df$mz <- as.numeric(df$mz) } if (!is.null(opt$remove_nas)){ @@ -86,18 +112,14 @@ isotopes <- TRUE } - - if (is.null(opt$sim)){ sim=FALSE }else{ sim=TRUE } -minOffset = as.numeric(opt$minOffset) -maxOffset = as.numeric(opt$maxOffset) - - +minOffset = as.numeric(opt$minoffset) +maxOffset = as.numeric(opt$maxoffset) if (opt$iwNorm=='none'){ iwNorm = FALSE @@ -115,9 +137,9 @@ print('FIRST ROWS OF PEAK FILE') print(head(df)) -print(mzml_file) +print(mzML_file) predicted <- msPurity::dimsPredictPuritySingle(df$mz, - filepth=mzml_file, + filepth=mzML_file, minOffset=minOffset, maxOffset=maxOffset, ppm=opt$ppm, @@ -133,4 +155,9 @@ print(head(predicted)) print(file.path(opt$out_dir, 'dimsPredictPuritySingle_output.tsv')) -write.table(predicted, file.path(opt$out_dir, 'dimsPredictPuritySingle_output.tsv'), row.names=FALSE, sep='\t') + +write.table(predicted, + file.path(opt$out_dir, 'dimsPredictPuritySingle_output.tsv'), + row.names=FALSE, sep='\t') + + diff -r f078bb1b7da6 -r 8f4685455caf macros.xml --- a/macros.xml Fri Sep 27 09:14:47 2019 -0400 +++ b/macros.xml Wed Nov 27 12:32:11 2019 +0000 @@ -1,40 +1,46 @@ - 1.11.4 - 0.2.7 + 1.12.0 + 0 bioconductor-mspurity + bioconductor-camera + bioconductor-xcms + bioconductor-mspuritydata + r-optparse + r-rpostgres + r-rmysql - - - - + - + @@ -44,7 +50,7 @@ - - @@ -95,24 +101,23 @@ - - - + - + @@ -127,13 +132,13 @@
- - + + - + @@ -142,7 +147,7 @@ - + @@ -155,7 +160,7 @@ - @@ -165,7 +170,7 @@ - @@ -178,7 +183,7 @@ - @@ -193,9 +198,9 @@ label="Filter on retention time range?" help="Filter the spectra between two points of retention time range"/> - - @@ -209,7 +214,7 @@ label="Filter on accessions?" help="Filter on unique accessions IDs (e.g. from MassBank and MoNA)"/> - @@ -223,7 +228,7 @@ - - @@ -303,7 +308,7 @@ - @@ -313,7 +318,7 @@ - @@ -327,7 +332,7 @@ - + @@ -339,7 +344,7 @@ - diff -r f078bb1b7da6 -r 8f4685455caf purityX.xml --- a/purityX.xml Fri Sep 27 09:14:47 2019 -0400 +++ b/purityX.xml Wed Nov 27 12:32:11 2019 +0000 @@ -4,23 +4,18 @@ macros.xml - - - - - - - - @@ -82,9 +77,9 @@ - + @@ -96,7 +91,7 @@ - @@ -107,16 +102,15 @@ - + + - - - + - @@ -126,7 +120,7 @@ -