Skip to content

Commit

Permalink
update validation
Browse files Browse the repository at this point in the history
check for required locations, but only verify optional locations
  • Loading branch information
alexg9010 committed Jul 19, 2024
1 parent e61e75d commit 6a7a819
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions scripts/validate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,20 @@ def parse_samples(lines):
# check for common input/configuration errors:
def validate_config(config):
# Check that all locations exist
for loc in config['locations']:
required_locations = ['input-dir', 'output-dir', 'genome-fasta']
for loc in required_locations:
if ( (not loc == 'output-dir') and (not (os.path.isdir(config['locations'][loc]) or os.path.isfile(config['locations'][loc])))):
bail("ERROR: The following necessary directory/file does not exist: {} ({})".format(
config['locations'][loc], loc))
optional_locations = ['cpgIsland-bedfile', 'refGenes-bedfile']
for loc in optional_locations:
if ( config['locations'][loc] and ( not os.path.isfile(config['locations'][loc]))):
bail("ERROR: The following optional file does not exist: {} ({})".format(
config['locations'][loc], loc))



# Load parameters specific to samples
# Load parameters specific to samples
with open(config['locations']['sample-sheet'], 'r') as f:
lines = f.read().splitlines()
sample_params = parse_samples(lines)
Expand All @@ -142,6 +149,14 @@ def validate_config(config):
bail("ERROR: The specification of treatment groups and differential analysis has changed.\n"+
"Please retrieve the new default settings layout with 'pigx-bsseq --init settings'.\n")


# check for new annotation layout
if 'annotation' in config['general']['differential-methylation']:
bail("ERROR: The specification of annotation files has changed.\n"+
"Please retrieve the new default settings layout with 'pigx-bsseq --init settings'.\n")



# Check for a any Assembly string
if not config['general']['assembly']:
bail("ERROR: Please set a genome assembly string in the settings file at general::assembly.")
Expand Down

0 comments on commit 6a7a819

Please sign in to comment.