cgat-developers / ruffus

CGAT-ruffus is a lightweight python module for running computational pipelines
MIT License
173 stars 34 forks source link

Argument parsing error messages are unhelpful #66

Open bunbun opened 8 years ago

bunbun commented 8 years ago
        make_calling_task = sub_pipeline.transform(    task_func    = make_calling,
                                                                             name          = "Calling step "+str(step),
                                                                             input           = None,
                                                                             filter            = regex(r"INDELS_realigned.bam$| rq.bam$"),
                                                                             output         = "indels.snps.g_step_"+str(step)+".vcf",
                                                                             output_dir    = join(call_folder,"step_"+str(step)),
                                                                             extras         = [    self.JAVA, self.GATK, 
                                                                                                       self.ref_genome_project, self.logger,
                                                                                                       self.logger_mutex, self.args.nct]
       )

results in the following error:

 Duplicate, conflicting or unrecognised arguments:

    pipeline.transform(name = 'pipeline_b_step_0::Calling step 0', task_func = make_calling, input=None, filter=regex('INDELS_realigned.bam$| rq.bam$',), output='indels.snps.g_step_0.vcf', extras=['/usr/local/java/jdk1.8.0_45/bin/java', '/home/diego/Programs/GATK/GenomeAnalysisTK.jar', 'VariantDiscovery_pipeline/reference/reference_genome.fasta', LoggerProxy(), <AcquirerProxy object, typeid 'Lock' at 0x7f41c5e6eb90>, 1], ...

The error is due to the fact that transform(..., filter = regex()) does not take the "output_dir" parameter

bunbun commented 8 years ago

1) Add specific error message for output_dir Inside parse_argument()

    if "filter" in results and "output_dir" in named_arguments:

2) Rearrange error message so that the named arguments come first Inside parse_argument()

    if len(named_arguments):
        err_msg = ("Duplicate, conflicting or unrecognised arguments:\n%s" %
                    get_parsed_arguments_str_for_errors(task_description,       # bad arg in context of parsed
                                                        ", ".join("%s=%r" %(k, v) for k,v in named_arguments.items()),
                                                        unnamed_result_strs, named_result_strs))