Commit b1b4715f authored by Jerome Mariette's avatar Jerome Mariette
Browse files

No commit message

No commit message
parent 633a7c2f
......@@ -183,6 +183,35 @@ class Workflow(threading.Thread):
self.params_order.append(name)
self.__setattr__(name, new_param)
def add_exclusion_rule(self, *args2exclude):
# first of all, are this parameter exist
params2exclude = []
for arg2exclude in args2exclude:
try:
params2exclude.append(self.__getattribute__(arg2exclude))
except: pass
# everything is ok, let's go
if len(params2exclude) == len(args2exclude):
new_group = "exclude-"+uuid.uuid4().hex[:5]
for paramsexclude in params2exclude:
paramsexclude.group = new_group
# it might be a mutliple param rule
else:
for attribute_value in self.__dict__.values():
if issubclass(attribute_value.__class__, MultiParameter) or issubclass(attribute_value.__class__, MultiParameterList):
params2exclude = []
for sub_param in attribute_value.sub_parameters:
if sub_param.name in args2exclude:
params2exclude.append(sub_param)
if len(params2exclude) == len(args2exclude):
new_group = "exclude-"+uuid.uuid4().hex[:5]
flags2exclude = []
for paramsexclude in params2exclude:
paramsexclude.group = new_group
flags2exclude.append(paramsexclude.flag)
attribute_value.type.excludes[new_group] = flags2exclude
break
def _set_parameters(self, args):
parameters = self.get_parameters()
for param in parameters:
......
......@@ -31,24 +31,23 @@ class Alignment (Workflow):
self.add_input_file("read_2", "Which read2 files should be used (if single end, leave empty)", type="localfile", is_list=True)
self.add_input_file("reference_genome", "Which genome should the read being align on", required=True, type="localfile")
self.add_multiple_parameter("test", "toto est dnas le gazon")
self.add_multiple_parameter("test", "toto est dnas le gazon", required=True)
self.add_input_file("toto", "Whices should be used", required=True, is_list=True, add_to="test")
self.add_input_file("tot", "Whould be used", is_list=True, type="localfile", add_to="test")
#self.exclude_parameters("read_1", "read_2")
self.add_input_file("tot_2", "Whould be used", type="int", add_to="test")
self.add_exclusion_rule("read_1", "read_2")
self.add_exclusion_rule("toto", "tot_2")
# prochaine etape:
# - tester les types multiples
# - Ajouter les types InputFile, InputFileList, OutputFile, OutputFileList
# - trouver une methode pour ordonner les parameters (self.add_parameter ...)
# - prendre en compte les execludes
def process(self):
print ">>>>>>>>>>>>>>>>>>>> ", self.reference_genome
print ">>>>>>>>>>>>>>>>>>>> ", self.read_1
print ">>>>>>>>>>>>>>>>>>>> ", self.read_2
print ">>>>>>>>>>>>>>>>>>>> ", self.test
pass
#print self.read_1
#print self.read_2
#print self.reference_genome
#print self.test
print "gg ", self.test.help
# index the reference genome
#bwaindex = self.add_component("BWAIndex", [self.args["reference_genome"]])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment