Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate task name error when using Spyder IDE #70

Open
msdayton opened this issue Apr 27, 2016 · 1 comment
Open

Duplicate task name error when using Spyder IDE #70

msdayton opened this issue Apr 27, 2016 · 1 comment

Comments

@msdayton
Copy link

First execution of example code appears to work using Spyder 2.3.8 and Python 2.7.11 64bits, however it fails on subsequent tries. The only way to clear the error is to restart the Console. It's not clear if this is a Spyder issue or if it could be resolved within ruffus. Nonetheless, It has been off-putting to see the example code fail right out of the box using a popular IDE.

Code

starting_files = ["a.fasta", "b.fasta", "c.fasta"]

for ff in starting_files:
    open(ff, "w")


from ruffus import *

#
#   STAGE 1 fasta->sam
#
@transform(starting_files,                     # Input = starting files
            suffix(".fasta"),                  #         suffix = .fasta
            ".sam")                            # Output  suffix = .sam
def map_dna_sequence(input_file,
                    output_file):
    ii = open(input_file)
    oo = open(output_file, "w")

#
#   STAGE 2 sam->bam
#
@transform(map_dna_sequence,                   # Input = previous stage
            suffix(".sam"),                    #         suffix = .sam
            ".bam")                            # Output  suffix = .bam
def compress_sam_file(input_file,
                      output_file):
    ii = open(input_file)
    oo = open(output_file, "w")

#
#   STAGE 3 bam->statistics
#
@transform(compress_sam_file,                  # Input = previous stage
            suffix(".bam"),                    #         suffix = .bam
            ".statistics",                     # Output  suffix = .statistics
            "use_linear_model")                # Extra statistics parameter
def summarise_bam_file(input_file,
                       output_file,
                       extra_stats_parameter):
    """
    Sketch of real analysis function
    """
    ii = open(input_file)
    oo = open(output_file, "w")

# On Windows you have to use the main module for "freeze_support()    
if __name__ == '__main__':
    pipeline_run()

produces error:

 >>> runfile('C:/Users/dayton5/Documents/pipeline/my_first_pipline.py', wdir='C:/Users/dayton5/Documents/pipeline')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "C:\Users\dayton5\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile
>     execfile(filename, namespace)
>   File "C:\Users\dayton5\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile
>     exec(compile(scripttext, filename, 'exec'), glob, loc)
>   File "C:/Users/dayton5/Documents/pipeline/my_first_pipline.py", line 18, in <module>
>     ".sam")                            # Output  suffix = .sam
>   File "C:\Users\dayton5\AppData\Local\Continuum\Anaconda2\lib\site-packages\ruffus\task.py", line 321, in __call__
>     task = main_pipeline._create_task(task_func)
>   File "C:\Users\dayton5\AppData\Local\Continuum\Anaconda2\lib\site-packages\ruffus\task.py", line 962, in _create_task
>     return Task(task_func, task_name, self)
>   File "C:\Users\dayton5\AppData\Local\Continuum\Anaconda2\lib\site-packages\ruffus\task.py", line 1961, in __init__
>     "same pipeline (%s)" % (task_name, self.pipeline.name))
> ruffus.ruffus_exceptions.error_duplicate_task_name:     
>     
>     
>     Same task name map_dna_sequence specified multiple times in the same pipeline (main)
@msdayton
Copy link
Author

msdayton commented Apr 27, 2016

Changing the Run Settings in Spyder to execute my_pipeline.py in a new dedicated python console every time it was run resolved the annoyance of restarting the python console manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant