From 14a03a7f2b7b1e33f6969d1a97c3f9e4bf032987 Mon Sep 17 00:00:00 2001 From: rob-p Date: Fri, 23 Jun 2023 16:34:13 -0400 Subject: [PATCH 1/4] fix: fix bug in format detection for id-to-name --- setup.cfg | 2 +- src/pyroe/__init__.py | 2 +- src/pyroe/id_to_name.py | 28 ++++++++++++++++------------ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/setup.cfg b/setup.cfg index 4fb7b95..8ee6b50 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = pyroe -version = 0.9.2 +version = 0.9.3 author = Dongze He, Rob Patro author_email = dhe17@umd.edu, rob@cs.umd.edu description = utilities of alevin-fry diff --git a/src/pyroe/__init__.py b/src/pyroe/__init__.py index ff79848..126c16c 100644 --- a/src/pyroe/__init__.py +++ b/src/pyroe/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.9.2" +__version__ = "0.9.3" from pyroe.load_fry import load_fry from pyroe.make_txome import make_splici_txome, make_spliceu_txome diff --git a/src/pyroe/id_to_name.py b/src/pyroe/id_to_name.py index c29de6a..14c5ad1 100644 --- a/src/pyroe/id_to_name.py +++ b/src/pyroe/id_to_name.py @@ -6,31 +6,35 @@ def id_to_name(params): format_map = { - ".gtf": pyranges.read_gtf, - ".gff": pyranges.read_gff3, - ".gff3": pyranges.read_gff3, + "gtf": pyranges.read_gtf, + "gff": pyranges.read_gff3, + "gff3": pyranges.read_gff3, } annot_reader = None if params.format is None: p = pathlib.Path(params.gtf_file) - suffs = [z.lower() for z in p.suffixes] + suffs = [z.lower().strip('.') for z in p.suffixes] z = None - if len(suffs) == 1: - z = suffs[0] - elif len(suffs) == 2 and suffs[-1] == ".gz": - z = suffs[-2] + if len(suffs) >= 1: + # look at the final suffix + z = suffs[-1] + # if the final suffix is gz and there are + # suffixes preceding it, check the penultimate + # one and use that + if z == "gz" and len(suffs) > 1: + z = suffs[-2] - if z in format_map.keys(): - annot_reader = format_map[z] - else: + if z is None or z not in format_map.keys(): logging.error( "Could not determine format of annotation file. Please provide it explicitly." ) sys.exit(1) + else: + annot_reader = format_map[z] else: fmt = params.format.lower() - if fmt not in ["gtf", "gff3"]: + if fmt not in format_map.keys(): logging.error( f'Format must be either "gtf" or "gff3", but {fmt} was provided.' ) From 66227f7069c072054297e078b600dcbbafa0f404 Mon Sep 17 00:00:00 2001 From: rob-p Date: Fri, 23 Jun 2023 16:35:45 -0400 Subject: [PATCH 2/4] make flake8 happy --- src/pyroe/id_to_name.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyroe/id_to_name.py b/src/pyroe/id_to_name.py index 14c5ad1..caa36cf 100644 --- a/src/pyroe/id_to_name.py +++ b/src/pyroe/id_to_name.py @@ -19,7 +19,7 @@ def id_to_name(params): if len(suffs) >= 1: # look at the final suffix z = suffs[-1] - # if the final suffix is gz and there are + # if the final suffix is gz and there are # suffixes preceding it, check the penultimate # one and use that if z == "gz" and len(suffs) > 1: From fa4838858b2d52e44f995bd8e13067a8f5250850 Mon Sep 17 00:00:00 2001 From: rob-p Date: Fri, 23 Jun 2023 16:43:19 -0400 Subject: [PATCH 3/4] pin the versions of dependencies in github actions --- .github/workflows/testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 93402b4..1d7c65b 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,9 +15,9 @@ jobs: echo $CONDA/bin >> $GITHUB_PATH - name: Install dependencies run: | - conda install -n base python=3.9 conda-forge::biopython bioconda::pyranges packaging bioconda::scanpy pytest -y + conda install -n base python=3.9 conda-forge::biopython bioconda::numpy==1.23 bioconda::pyranges==0.0.120 packaging bioconda::scanpy pytest -y - name: pytest run: | pip install . - pytest \ No newline at end of file + pytest From 8d4bb650f80e4a86b1b40c7c3f21106571295b8d Mon Sep 17 00:00:00 2001 From: rob-p Date: Fri, 23 Jun 2023 16:49:22 -0400 Subject: [PATCH 4/4] pin the versions of dependencies in github actions --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 1d7c65b..8229600 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,7 +15,7 @@ jobs: echo $CONDA/bin >> $GITHUB_PATH - name: Install dependencies run: | - conda install -n base python=3.9 conda-forge::biopython bioconda::numpy==1.23 bioconda::pyranges==0.0.120 packaging bioconda::scanpy pytest -y + conda install -n base python=3.9 conda-forge::biopython numpy==1.23 bioconda::pyranges==0.0.120 packaging bioconda::scanpy pytest -y - name: pytest run: |