Skip to content

Commit

Permalink
allow annotation section in settings for backwards compatibility
Browse files Browse the repository at this point in the history
-  issue warning instead of error
- propagete old annotation paths to locations dict

if paths are given, this still requires that annotation files exist and for old annotation specification does not allow relative paths
  • Loading branch information
alexg9010 committed Jul 23, 2024
1 parent b3ff021 commit 29688ff
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions scripts/validate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import os
import csv
from glob import glob
from func_defs import bail
from func_defs import bail, warn

# ==============================================================================
#
Expand Down Expand Up @@ -102,11 +102,29 @@ def parse_samples(lines):
return { 'SAMPLES': outputdict }


def update_config_layout(config):
# check for new annotation layout
if 'annotation' in config['general']['differential-methylation']:
warn("The specification of annotation files has changed in version 0.1.9 \n"+
"For now updating configuration file with the new default settings layout.\n"+
"In the future, please retrieve the new default settings layout with 'pigx-bsseq --init settings'.")

## move cpgisland and refgene files to location dict
if 'cpgIsland-bedfile' in config['general']['differential-methylation']['annotation']:
config['locations']['cpgIsland-bedfile'] = config['general']['differential-methylation']['annotation']['cpgIsland-bedfile']
if 'refGenes-bedfile' in config['general']['differential-methylation']['annotation']:
config['locations']['refGenes-bedfile'] = config['general']['differential-methylation']['annotation']['refGenes-bedfile']

## remove annotation section
config['general']['differential-methylation'].pop('annotation')

return config



# --------------------------------------
# validation of Config
# --------------------------------------


# check for common input/configuration errors:
def validate_config(config):
# Check that all locations exist
Expand Down Expand Up @@ -150,10 +168,6 @@ def validate_config(config):
"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")



Expand Down

0 comments on commit 29688ff

Please sign in to comment.