Mercurial > repos > computational-metabolomics > mspurity_createmsp
diff combineAnnotations.R @ 2:54593159627d draft
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 242de155f13acd6cb88946e89b5196ac55578aa8"
author | computational-metabolomics |
---|---|
date | Wed, 01 Apr 2020 11:07:26 -0400 |
parents | 35898942bfbb |
children | d25273689e04 |
line wrap: on
line diff
--- a/combineAnnotations.R Thu Dec 05 07:39:41 2019 -0500 +++ b/combineAnnotations.R Wed Apr 01 11:07:26 2020 -0400 @@ -20,7 +20,9 @@ make_option("--probmetab_weight", type="numeric"), make_option("--ms1_lookup_weight", type="numeric"), make_option("--biosim_weight", type="numeric"), - + + make_option("--summaryOutput", action="store_true"), + make_option("--create_new_database", action="store_true"), make_option("--outdir", type="character", default="."), @@ -56,11 +58,21 @@ 'biosim'=opt$biosim_weight ) print(weights) -if (round(!sum(unlist(weights),0)==1)){ + +if (is.null(opt$probmetab_resultPth)){ + opt$probmetab_resultPth = NA +} +if (round(!sum(unlist(weights),0)==1)){ stop(paste0('The weights should sum to 1 not ', sum(unlist(weights)))) } +if (is.null(opt$summaryOutput)){ + summaryOutput = FALSE +}else{ + summaryOutput = TRUE +} + if (opt$compoundDbType=='local_config'){ # load in compound config # Soure local function taken from workflow4metabolomics @@ -76,8 +88,6 @@ compoundDbPass = NA } - - summary_output <- msPurity::combineAnnotations( sm_resultPth = sm_resultPth, compoundDbPth = compoundDbPth, @@ -94,7 +104,12 @@ compoundDbPort = compoundDbPort, compoundDbUser = compoundDbUser, compoundDbPass = compoundDbPass, - weights = weights) + weights = weights, + summaryOutput = summaryOutput) +if (summaryOutput){ + write.table(summary_output, file.path(opt$outdir, 'combined_annotations.tsv'), sep = '\t', row.names = FALSE) +} + write.table(summary_output, file.path(opt$outdir, 'combined_annotations.tsv'), sep = '\t', row.names = FALSE)