From 7f77571e7258163579d48bf68691dd39ef2f953f Mon Sep 17 00:00:00 2001 From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr> Date: Wed, 27 Jan 2021 16:41:15 +0100 Subject: [PATCH] src/visu/__main__.py: add parameter ylim --- src/visu/__main__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/visu/__main__.py b/src/visu/__main__.py index bc53640..a72845d 100644 --- a/src/visu/__main__.py +++ b/src/visu/__main__.py @@ -10,7 +10,7 @@ gene regions from ChIP-seq experiment. from .figure_maker import create_figure import lazyparser as lp from pathlib import Path -from typing import List +from typing import List, Optional @lp.parse(design='file', region_beds='file', @@ -21,7 +21,7 @@ def launcher(design: str, bw_folder: str, region_beds: List[str], figure_type: str = 'metagene', norm: str = 'None', show_replicate: str = 'y', environment: List[int] = (0, 0), border_names: List[str] = ('', ''), - output: str = '.') -> None: + output: str = '.', ylim: List[float] = (None, None)) -> None: """ Create A metagene or a barplot figure from bigwig file on regions defined \ in the bed file provided with 'region_bed' parameter. @@ -47,7 +47,11 @@ def launcher(design: str, bw_folder: str, region_beds: List[str], the number of bin used to represent those surrounding regions. :param border_names: The name of the borders :param output: Folder where the results will be created + :param ylim: The y-axis range (default None) """ + if ylim[0] is not None and (len(ylim) != 2 or ylim[0] >= ylim[1]): + raise ValueError("The ylim must have two values and the first value " + "must be lower to the second value") if environment[0] < 0 or environment[1] < 0 or \ environment[0] < environment[1]: raise ValueError(f"The two values given with --environment must " @@ -62,7 +66,7 @@ def launcher(design: str, bw_folder: str, region_beds: List[str], reg_beds = [Path(p) for p in region_beds] create_figure(Path(design), Path(bw_folder), reg_beds, region_names, nb_bin, figure_type, norm, show_rep, - environment, border_names, Path(output)) + environment, border_names, Path(output), ylim) launcher() -- GitLab