Beispiel #1
0
def generate_analysis_tasks_and_snakefile(dataSet: dataset.MERFISHDataSet,
                                          parametersFile: TextIO) -> str:
    print('Generating analysis tasks from %s' % parametersFile.name)
    analysisParameters = json.load(parametersFile)
    snakeGenerator = snakewriter.SnakefileGenerator(analysisParameters,
                                                    dataSet, sys.executable)
    snakefilePath = snakeGenerator.generate_workflow()
    print('Snakefile generated at %s' % snakefilePath)
    return snakefilePath
Beispiel #2
0
def test_snakemake_generator_one_task(simple_merfish_data):
    taskDict = {
        'analysis_tasks': [{
            'task': 'SimpleAnalysisTask',
            'module': 'merlin.analysis.testtask',
            'parameters': {}
        }]
    }

    generator = snakewriter.SnakefileGenerator(taskDict, simple_merfish_data)
    workflow = generator.generate_workflow()
    outputTask = simple_merfish_data.load_analysis_task('SimpleAnalysisTask')
    assert not outputTask.is_complete()
    snakemake.snakemake(workflow)
    assert outputTask.is_complete()

    shutil.rmtree('.snakemake')
Beispiel #3
0
def test_snakemake_generator_task_chain(simple_merfish_data):
    taskDict = {
        'analysis_tasks': [{
            'task': 'SimpleAnalysisTask',
            'module': 'merlin.analysis.testtask',
            'analysis_name': 'Task1',
            'parameters': {}
        }, {
            'task': 'SimpleParallelAnalysisTask',
            'module': 'merlin.analysis.testtask',
            'analysis_name': 'Task2',
            'parameters': {
                'dependencies': ['Task1']
            }
        }, {
            'task': 'SimpleParallelAnalysisTask',
            'module': 'merlin.analysis.testtask',
            'analysis_name': 'Task3',
            'parameters': {
                'dependencies': ['Task2']
            }
        }]
    }

    generator = snakewriter.SnakefileGenerator(taskDict, simple_merfish_data)
    workflow = generator.generate_workflow()
    outputTask1 = simple_merfish_data.load_analysis_task('Task1')
    outputTask2 = simple_merfish_data.load_analysis_task('Task2')
    outputTask3 = simple_merfish_data.load_analysis_task('Task3')
    assert not outputTask1.is_complete()
    assert not outputTask2.is_complete()
    assert not outputTask3.is_complete()
    snakemake.snakemake(workflow)
    assert outputTask1.is_complete()
    assert outputTask2.is_complete()
    assert outputTask3.is_complete()

    shutil.rmtree('.snakemake')