diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 93402b4..8229600 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 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 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..caa36cf 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.' )