Mercurial > repos > computational-metabolomics > mspurity_filterfragspectra
diff createMSP.R @ 3:cad0376c0b66 draft
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 89bf304d12233004031de3c3e703a472b0ba5459"
author | computational-metabolomics |
---|---|
date | Thu, 09 Apr 2020 14:28:45 -0400 |
parents | 96af79da0cc6 |
children | cc0f8ddad4a8 |
line wrap: on
line diff
--- a/createMSP.R Wed Apr 01 11:19:15 2020 -0400 +++ b/createMSP.R Thu Apr 09 14:28:45 2020 -0400 @@ -15,6 +15,7 @@ make_option("--intensity_ra",type="character"), make_option("--include_adducts",type="character"), make_option("--msp_schema",type="character"), + make_option("--include_adducts_custom",type="character", default=""), make_option("--out_dir",type="character", default=".") ) opt <- parse_args(OptionParser(option_list=option_list)) @@ -66,17 +67,33 @@ xcms_groupids <- trimws(strsplit(opt$xcms_groupids, ',')[[1]]) } + + + + +if (is.null(opt$include_adducts_custom)){ + include_adducts_custom <- '' +}else{ + include_adducts_custom <- opt$include_adducts_custom +} + + if (opt$include_adducts=='None'){ include_adducts <- '' }else{ include_adducts <- opt$include_adducts - include_adducts <- gsub("__ob__", "[", include_adducts) - include_adducts <- gsub("__cb__", "]", include_adducts) - include_adducts <- trimws(include_adducts) +} + +include_adducts_all <- paste(include_adducts_custom, ',', include_adducts, sep="") - include_adducts <- gsub(",", " ", include_adducts) +include_adducts_all <- gsub("^,", "", include_adducts_all) +include_adducts_all <- gsub(",$", "", include_adducts_all) -} +include_adducts_all <- gsub("__ob__", "[", include_adducts_all) +include_adducts_all <- gsub("__cb__", "]", include_adducts_all) +include_adducts_all <- trimws(include_adducts_all) +include_adducts_all <- gsub(",", " ", include_adducts_all) + if(is.null(opt$filter)){ @@ -96,7 +113,7 @@ xcms_groupids = xcms_groupids, filter = filter, intensity_ra=opt$intensity_ra, - include_adducts=include_adducts, + include_adducts=include_adducts_all, msp_schema=opt$msp_schema) print('msp created')