diff --git a/Snakefile b/Snakefile index 9fbc4b84ea0c8e64e77f99a17f1e995da94b79ef..a2ccc49ef0ee8baf5cbaea4ca5d5869ac6587d0c 100644 --- a/Snakefile +++ b/Snakefile @@ -68,22 +68,47 @@ except: configfile: configfile_path print("... Configuration file: {}".format(configfile_path), file=sys.stderr) finally: - print("Configuration of MetaSnk:", file=sys.stderr) + print("Provided configuration for MetaSnk:", file=sys.stderr) my_temp=[print(" {}:{}\n".format(key,value), file=sys.stderr) for key,value in config.items()] ##----------------------------------------------------------------------------## ## Define paths and local variables ##----------------------------------------------------------------------------## -PWD = os.environ["PWD"] -RAW_FASTQ_DIR = eval(config['RAW_DIR']) -OUT_DIR = eval(config['OUT_DIR']) +print("MetaSnk is setting local variables ...") + +try: + print("Setting RAW_DIR") + if os.path.exists(config['RAW_DIR'])==False: + raise FileNotFoundError + else: + RAW_FASTQ_DIR = config['RAW_DIR'] + print("RAW_DIR: {}".format(RAW_FASTQ_DIR), file=sys.stderr) +except FileNotFoundError: + print(" Provided path does not exist!\n"+\ + " Please provide an absolute path for RAW_DIR in your configuration file!") + exit(1) + +try: + print("Setting OUT_DIR") + if os.path.exists(config['OUT_DIR'])==False: + raise FileNotFoundError + else: + OUT_DIR = config['OUT_DIR'] + print("OUT_DIR: {}".format(OUT_DIR), file=sys.stderr) +except FileNotFoundError: + print(" Provided path does not exist!\n"+\ + " Please provide absolute path for OUT_DIR in your configuration file!") + exit(1) +OUT_DIR = config['OUT_DIR'] + METASNK_DB_DIR = os.environ["METASNK_DBS"] SHUB_PREQC_SIF = 'shub://mticlla/MetagenomicSnake:preqc_v0_1' SHUB_METAPROF_SIF = 'shub://mticlla/OmicSingularities:metaprof' PREQC_SIF = METASNK_DB_DIR+'/singularity/MetagenomicSnake_preqc_v0_1.sif' METAPROF_SIF = METASNK_DB_DIR+'/singularity/OmicSingularities_metaprof.sif' -HUMAN_REF = eval(config['preprocess']['filter_human']['bbmap_reference']) +HUMAN_REF = eval(config['preprocess']['filter_human']['bbmap_reference']) +print("HUMAN_REF: {}".format(HUMAN_REF), file=sys.stderr) ##----------------------------------------------------------------------------## ## Fastq files to be processed ##----------------------------------------------------------------------------## diff --git a/config.yaml b/config.yaml index 5a2d55cc142864be763aae445dd4b9a9b5ba6bac..4262c87404e74bcf7eea1d3182e525ed31cf9cf9 100644 --- a/config.yaml +++ b/config.yaml @@ -10,10 +10,21 @@ # or a comma-delimited string of bind path specifications can be used. # -# Absolute PATH to folder where to find fastq files -RAW_DIR: "PWD+'/data/raw'" -# Absolute PATH to folder where to place output files -OUT_DIR: "PWD+'/data/interim/MetaSnk'" +# Always provide an ABSOLUTE PATH to the folder where to find fastq files +# MetaSnk expects to find the raw fastq files in a directory where +# they are grouped into datasets (one or multiple). +# Inside the RAW_DIR folder, each dataset directory (named at the user's discretion) +# must contain a directory named 'fastq', where fastq files are placed, +# accompanied by a sample_metatada.tsv file: +# $RAW_DIR +# ├── dataset_test_1 +# ├── fastq +# | ├── sampleID-RUN_LANE-R1.fastq.gz +# | ├── sampleID-RUN_LANE-R2.fastq.gz +# └── sample_metadata.tsv +RAW_DIR: '' +# Always provide ABSOLUTE PATH to folder where to place output files +OUT_DIR: '' # SAMPLE_UNITS: