From 57c8cbfaef862823db1a168730ebdcf985b6c9c0 Mon Sep 17 00:00:00 2001 From: wernerkrampl Date: Mon, 15 Jul 2019 14:53:26 +0200 Subject: [PATCH] Sample location (#31) * Manually merged master and sample_location branch. * Fixed a bug causing pipelines without samples to fail. --- docs/conf.py | 2 +- snakelines.snake | 2 +- src/common.snake | 16 ++++++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ed438d89..a31337c4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,7 +26,7 @@ # The short X.Y version version = u'' # The full version, including alpha/beta/rc tags -release = u'0.9.1' +release = u'0.9.2' # -- General configuration --------------------------------------------------- diff --git a/snakelines.snake b/snakelines.snake index 0fb5566c..ef130837 100644 --- a/snakelines.snake +++ b/snakelines.snake @@ -1,4 +1,4 @@ -SNAKELINES_VERSION = '0.9.1' +SNAKELINES_VERSION = '0.9.2' import os import sys diff --git a/src/common.snake b/src/common.snake index 3006da5c..c8d34fb2 100644 --- a/src/common.snake +++ b/src/common.snake @@ -26,15 +26,19 @@ for sample_configuration in sample_configurations: # Filter samples according to the user configuration samples = [] if 'name' in sample_configuration: - wildcards = glob_wildcards('reads/original/{sample, %s}_R1.fastq.gz' % sample_configuration['name']) - assert len(wildcards.sample) > 0, 'No samples in reads/original/ match configured pattern {}'.format(sample_configuration['name']) + location = sample_configuration.get('location', DEFAULT_SAMPLE_LOCATION) + location = location.replace('{}', '{sample, %s}' % sample_configuration['name']) + wildcards = glob_wildcards(location) samples = wildcards.sample + assert len(wildcards.sample) > 0, 'No samples in {} match configured pattern {}'.format(location, sample_configuration['name']) + reference = sample_configuration.get('reference', None) - pipeline.add(samples, reference, - sample_configuration.get('panel', None), - sample_configuration.get('prebuilt', False), - bool(extract_from_config(config, ['reference', 'download', reference], []))) + pipeline.add(samples, + reference, + sample_configuration.get('panel', None), + sample_configuration.get('prebuilt', False), + bool(extract_from_config(config, ['reference', 'download', reference], []))) if pipeline.is_empty(): print('No samples to analyse', file=sys.stderr)