Skip to content

Commit b3a33ad

Browse files
committed
added function to check values of consensus peak filtering settings
1 parent 3c05002 commit b3a33ad

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

workflow/Snakefile

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ containerized: f"docker://niekwit/damid-seq:{VERSION}"
2323
# Load and validate config file
2424
configfile: "config/config.yaml"
2525
validate(config, "schemas/config.schema.yaml")
26+
check_consensus_peak_settings()
2627

2728
plasmid_name = plasmid_fasta_name(config["plasmid_fasta"])
2829

workflow/scripts/general_functions.smk

+12-1
Original file line numberDiff line numberDiff line change
@@ -465,4 +465,15 @@ def input_extension():
465465
if paired_end:
466466
return []
467467
else:
468-
return ".fastq.gz"
468+
return ".fastq.gz"
469+
470+
471+
def check_consensus_peak_settings():
472+
keep = config["consensus_peaks"]["keep"]
473+
474+
# Get number of subdirectories in reads/
475+
subdirs = glob.glob("reads/*")
476+
subdirs = len([d for d in subdirs if os.path.isdir(d)])
477+
478+
if keep > subdirs:
479+
raise ValueError(f"Number of overlapping peaks to keep consensus peaks (config > consensus_peak > keep) is greater than number of subdirectories in reads/...")

0 commit comments

Comments
 (0)