From 6d015ac3c8bbcecfd9e02aa59cd79facf30617b2 Mon Sep 17 00:00:00 2001 From: Xiao Chen Date: Mon, 1 May 2023 12:52:48 -0700 Subject: [PATCH] fix low depth error, add version (#6) --- paraphase/__init__.py | 2 +- paraphase/paraphase.py | 11 +++++++++++ paraphase/prepare_bam_and_vcf.py | 2 -- setup.py | 3 ++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/paraphase/__init__.py b/paraphase/__init__.py index b19ee4b..ba51ced 100755 --- a/paraphase/__init__.py +++ b/paraphase/__init__.py @@ -1 +1 @@ -__version__ = "2.2.1" +__version__ = "2.2.2" diff --git a/paraphase/paraphase.py b/paraphase/paraphase.py index c480ab2..010f950 100755 --- a/paraphase/paraphase.py +++ b/paraphase/paraphase.py @@ -33,6 +33,14 @@ def __init__(self): self.samtools = None self.minimap2 = None + @staticmethod + def get_version(): + with open(os.path.join(os.path.dirname(__file__), "__init__.py")) as f: + for line in f: + if "version" in line: + return line.split('"')[1] + return None + def parse_configs(self, region_config=None): """ Parse config files @@ -365,6 +373,9 @@ def load_parameters(self): help="Optional path to minimap2", required=False, ) + parser.add_argument( + "-v", "--version", action="version", version=f"{self.get_version()}" + ) return parser def run(self): diff --git a/paraphase/prepare_bam_and_vcf.py b/paraphase/prepare_bam_and_vcf.py index 02c8975..fbbb81e 100755 --- a/paraphase/prepare_bam_and_vcf.py +++ b/paraphase/prepare_bam_and_vcf.py @@ -283,8 +283,6 @@ def set_parameter(self, config, tmpdir=None): self.bam = os.path.join( tmpdir, self.sample_id + f"_{self.gene}_realigned_tagged.bam" ) - if os.path.exists(self.bam) is False: - raise Exception(f"{self.bam} does not exist. VCFs are not generated...") self.vcf_dir = os.path.join(self.outdir, f"{self.sample_id}_vcfs") if os.path.exists(self.vcf_dir) is False: os.makedirs(self.vcf_dir) diff --git a/setup.py b/setup.py index fe5a099..8f57d6b 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ from setuptools import setup +import paraphase def readme(): @@ -8,7 +9,7 @@ def readme(): setup( name="paraphase", - version="2.2.1", + version=paraphase.__version__, description="paraphase: HiFi-based caller for highly homologous genes", long_description=readme(), url="https://github.com/PacificBiosciences/paraphase",