comparison flagRemove.R @ 3:59c1f9077c3b draft

planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 7c8cb8294e711ca45f19de7bd9564157527f98db
author tomnl
date Fri, 14 Jun 2019 08:55:15 -0400
parents ca0ac330f1a4
children 64374e7beba1
comparison
equal deleted inserted replaced
2:054189c06bb1 3:59c1f9077c3b
69 69
70 make_option("--temp_save", action="store_true", 70 make_option("--temp_save", action="store_true",
71 help="Assign True if files for each step saved (for testing purposes) [default = %default]" 71 help="Assign True if files for each step saved (for testing purposes) [default = %default]"
72 ), 72 ),
73 73
74 make_option("--samplelist", type="character", help="Sample list to determine the blank class"), 74 make_option("--samplelist", type="character", help="Sample list to determine the blank class")
75 75
76 make_option("--xset_name", default="xset", 76
77 help="Name of the xcmsSet object within the RData file [default = %default]"
78 )
79 77
80 78
81 79
82 ) 80 )
83 81
106 } 104 }
107 105
108 106
109 print(opt) 107 print(opt)
110 108
111 loadRData <- function(rdata_path, xset_name){ 109 getxcmsSetObject <- function(xobject) {
110 # XCMS 1.x
111 if (class(xobject) == "xcmsSet")
112 return (xobject)
113 # XCMS 3.x
114 if (class(xobject) == "XCMSnExp") {
115 # Get the legacy xcmsSet object
116 suppressWarnings(xset <- as(xobject, 'xcmsSet'))
117 sampclass(xset) <- xset@phenoData$sample_group
118 return (xset)
119 }
120 }
121
122
123 loadRData <- function(rdata_path, name){
112 #loads an RData file, and returns the named xset object if it is there 124 #loads an RData file, and returns the named xset object if it is there
113 load(rdata_path) 125 load(rdata_path)
114 return(get(ls()[ls() == xset_name])) 126 return(get(ls()[ls() %in% name]))
115 } 127 }
116 128
117 xset<-loadRData(opt$xset_path, opt$xset_name) 129 xset <- loadRData(opt$xset_path, c('xset','xdata'))
130
118 print(xset) 131 print(xset)
119 if (is.null(opt$samplelist)){ 132 if (is.null(opt$samplelist)){
120 blank_class <- opt$blank_class 133 blank_class <- opt$blank_class
121 }else{ 134 }else{
122 samplelist <- read.table(opt$samplelist, sep='\t', header=TRUE) 135 samplelist <- read.table(opt$samplelist, sep='\t', header=TRUE)