From 391a6ed8d46630c5a7f31c4e0409223bbfd61222 Mon Sep 17 00:00:00 2001 From: dpryan79 Date: Fri, 2 Dec 2016 15:19:40 +0100 Subject: [PATCH] Update error messages and parsing of --colorList --- deeptools/deepBlue.py | 2 +- deeptools/parserCommon.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/deeptools/deepBlue.py b/deeptools/deepBlue.py index a372645ad3..fca0fb7332 100644 --- a/deeptools/deepBlue.py +++ b/deeptools/deepBlue.py @@ -137,7 +137,7 @@ def __init__(self, sample, url="http://deepblue.mpi-inf.mpg.de/xmlrpc", userKey= # Set self.experimentID experimentID = self.getEID() if not experimentID: - raise RuntimeError("The requested sample({}) has no associated experiment!".format(sample)) + raise RuntimeError("The requested sample({}) has no associated experiment! If you did not intend to use samples on deepBlue, then it appears either you misspelled a file name or one of your BAM files is lacking a valid index.".format(sample)) # Set self.info (status, resp) = self.server.info(self.experimentID, userKey) diff --git a/deeptools/parserCommon.py b/deeptools/parserCommon.py index 9d3db5ae8e..14a607dc0e 100644 --- a/deeptools/parserCommon.py +++ b/deeptools/parserCommon.py @@ -11,6 +11,16 @@ def check_float_0_1(value): return v +def check_list_of_comma_values(value): + if value is None: + return None + for foo in value: + foo = value.split(",") + if len(foo) < 2: + raise argparse.ArgumentTypeError("%s is an invalid element of a list of comma separated values. Only argument elements of the following form are accepted: 'foo,bar'" % foo) + return value + + def output(args=None): parser = argparse.ArgumentParser(add_help=False) group = parser.add_argument_group('Output') @@ -610,7 +620,7 @@ def heatmapperOptionalArgs(mode=['heatmap', 'profile'][0]): 'As for --colorMap, the color lists are recycled if their number is smaller thatn the number of' 'plotted heatmaps. ' 'The number of transitions is defined by the --colorNumber option.', - + type=check_list_of_comma_values, nargs='+') optional.add_argument(