Mercurial > repos > computational-metabolomics > mspurity_createdatabase
annotate purityA.R @ 6:2f71b3495221 draft
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
| author | computational-metabolomics | 
|---|---|
| date | Thu, 04 Mar 2021 12:27:21 +0000 | 
| parents | 600a866a510c | 
| children | efd14b326007 | 
| rev | line source | 
|---|---|
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 1 library(msPurity) | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 2 library(optparse) | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 3 print(sessionInfo()) | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 4 | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 5 option_list <- list( | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 6 make_option(c("-o", "--out_dir"), type = "character"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 7 make_option("--mzML_files", type = "character"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 8 make_option("--galaxy_names", type = "character"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 9 make_option("--minOffset", type = "numeric"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 10 make_option("--maxOffset", type = "numeric"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 11 make_option("--ilim", type = "numeric"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 12 make_option("--iwNorm", default = "none", type = "character"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 13 make_option("--exclude_isotopes", action = "store_true"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 14 make_option("--isotope_matrix", type = "character"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 15 make_option("--mostIntense", action = "store_true"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 16 make_option("--plotP", action = "store_true"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 17 make_option("--nearest", action = "store_true"), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 18 make_option("--cores", default = 4), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 19 make_option("--ppmInterp", default = 7) | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 20 ) | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 21 | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 22 opt <- parse_args(OptionParser(option_list = option_list)) | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 23 print(opt) | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 24 | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 25 if (opt$iwNorm == "none") { | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 26 iwNorm <- FALSE | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 27 iwNormFun <- NULL | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 28 }else if (opt$iwNorm == "gauss") { | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 29 iwNorm <- TRUE | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 30 if (is.null(opt$minOffset) || is.null(opt$maxOffset)) { | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 31 print("User has to define offsets if using Gaussian normalisation") | 
| 1 
600a866a510c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
 computational-metabolomics parents: 
0diff
changeset | 32 }else{ | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 33 iwNormFun <- msPurity::iwNormGauss(minOff = -as.numeric(opt$minOffset), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 34 maxOff = as.numeric(opt$maxOffset)) | 
| 1 
600a866a510c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
 computational-metabolomics parents: 
0diff
changeset | 35 } | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 36 }else if (opt$iwNorm == "rcosine") { | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 37 iwNorm <- TRUE | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 38 if (is.null(opt$minOffset) || is.null(opt$maxOffset)) { | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 39 print("User has to define offsets if using R-cosine normalisation") | 
| 1 
600a866a510c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
 computational-metabolomics parents: 
0diff
changeset | 40 }else{ | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 41 iwNormFun <- msPurity::iwNormRcosine(minOff = -as.numeric(opt$minOffset), | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 42 maxOff = as.numeric(opt$maxOffset)) | 
| 1 
600a866a510c
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 20d432cdc6326114d05c26fd51889b872513b57d"
 computational-metabolomics parents: 
0diff
changeset | 43 } | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 44 }else if (opt$iwNorm == "QE5") { | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 45 iwNorm <- TRUE | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 46 iwNormFun <- msPurity::iwNormQE.5() | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 47 } | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 48 | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 49 filepaths <- trimws(strsplit(opt$mzML_files, ",")[[1]]) | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 50 filepaths <- filepaths[filepaths != ""] | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 51 | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 52 | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 53 | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 54 if (is.null(opt$minOffset) || is.null(opt$maxOffset)) { | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 55 offsets <- NA | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 56 }else{ | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 57 offsets <- as.numeric(c(opt$minOffset, opt$maxOffset)) | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 58 } | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 59 | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 60 | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 61 if (is.null(opt$mostIntense)) { | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 62 mostIntense <- FALSE | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 63 }else{ | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 64 mostIntense <- TRUE | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 65 } | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 66 | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 67 if (is.null(opt$nearest)) { | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 68 nearest <- FALSE | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 69 }else{ | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 70 nearest <- TRUE | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 71 } | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 72 | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 73 if (is.null(opt$plotP)) { | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 74 plotP <- FALSE | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 75 plotdir <- NULL | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 76 }else{ | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 77 plotP <- TRUE | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 78 plotdir <- opt$out_dir | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 79 } | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 80 | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 81 | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 82 if (is.null(opt$isotope_matrix)) { | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 83 im <- NULL | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 84 }else{ | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 85 im <- read.table(opt$isotope_matrix, | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 86 header = TRUE, sep = "\t", stringsAsFactors = FALSE) | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 87 } | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 88 | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 89 if (is.null(opt$exclude_isotopes)) { | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 90 isotopes <- FALSE | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 91 }else{ | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 92 isotopes <- TRUE | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 93 } | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 94 | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 95 pa <- msPurity::purityA(filepaths, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 96 cores = opt$cores, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 97 mostIntense = mostIntense, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 98 nearest = nearest, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 99 offsets = offsets, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 100 plotP = plotP, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 101 plotdir = plotdir, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 102 interpol = "linear", | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 103 iwNorm = iwNorm, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 104 iwNormFun = iwNormFun, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 105 ilim = opt$ilim, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 106 mzRback = "pwiz", | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 107 isotopes = isotopes, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 108 im = im, | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 109 ppmInterp = opt$ppmInterp) | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 110 | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 111 | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 112 if (!is.null(opt$galaxy_names)) { | 
| 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 113 galaxy_names <- trimws(strsplit(opt$galaxy_names, ",")[[1]]) | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 114 galaxy_names <- galaxy_names[galaxy_names != ""] | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 115 names(pa@fileList) <- galaxy_names | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 116 } | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 117 | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 118 print(pa) | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 119 save(pa, file = file.path(opt$out_dir, "purityA_output.RData")) | 
| 0 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 120 | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 121 pa@puritydf$filename <- sapply(pa@puritydf$fileid, function(x) names(pa@fileList)[as.integer(x)]) | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 122 | 
| 
f52287a06c02
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit cb903cd93f9378cfb5eeb68512a54178dcea7bbc-dirty"
 computational-metabolomics parents: diff
changeset | 123 print(head(pa@puritydf)) | 
| 6 
2f71b3495221
"planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 2579c8746819670348c378f86116f83703c493eb"
 computational-metabolomics parents: 
1diff
changeset | 124 write.table(pa@puritydf, file.path(opt$out_dir, "purityA_output.tsv"), row.names = FALSE, sep = "\t") | 
