Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/qiita-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ jobs:
# derived from https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml
main:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["2.7", "3.5", "3.6", "3.9", "3.10", "3.11", "3.12"]
steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Check out repository code
Expand All @@ -19,21 +21,21 @@ jobs:
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.9
python-version: ${{ matrix.python-version }}

- name: Basic dependencies install
shell: bash -l {0}
run: |
conda create --yes -n qiita-files python=3.9 h5py pandas scipy numpy
conda create --yes -n qiita-files python=${{ matrix.python-version }} h5py pandas scipy numpy
conda activate qiita-files
pip install .
pip install sphinx sphinx-bootstrap-theme nose-timer codecov Click
pip install sphinx sphinx-bootstrap-theme pytest-cov codecov Click

- name: Main tests
shell: bash -l {0}
run: |
conda activate qiita-files
nosetests --with-doctest --with-coverage --cover-package=qiita_files
pytest --doctest-modules `if (( $(echo "${{ matrix.python-version }} > 3.6" | bc -l) )); then echo "--cov-report=lcov --cov=qiita_files"; else echo ""; fi`

lint:
runs-on: ubuntu-latest
Expand Down
5 changes: 4 additions & 1 deletion qiita_files/parse/fastq.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

import numpy as np
from qiita_files.util import open_file
from itertools import zip_longest
try:
from itertools import zip_longest
except ImportError:
from itertools import izip_longest as zip_longest


def _ascii_to_phred(s, offset):
Expand Down
12 changes: 6 additions & 6 deletions qiita_files/parse/tests/test_fastq.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class ParseFastqTestsInputIsFileNames(FileData, ParseFastqTests, TestCase):
}


FASTQ_EXAMPLE = rb"""@GAPC_0015:6:1:1259:10413#0/1
FASTQ_EXAMPLE = r"""@GAPC_0015:6:1:1259:10413#0/1
AACACCAAACTTCTCCACCACGTGAGCTACAAAAG
+GAPC_0015:6:1:1259:10413#0/1
````Y^T]`]c^cabcacc`^Lb^ccYT\T\Y\WF
Expand Down Expand Up @@ -194,26 +194,26 @@ class ParseFastqTestsInputIsFileNames(FileData, ParseFastqTests, TestCase):
@GAPC_0015:6:1:1317:3403#0/1
TTGTTTCCACTTGGTTGATTTCACCCCTGAGTTTG
+GAPC_0015:6:1:1317:3403#0/1
\\\ZTYTSaLbb``\_UZ_bbcc`cc^[ac\a\Tc"""
\\\ZTYTSaLbb``\_UZ_bbcc`cc^[ac\a\Tc""".encode("utf-8")


FASTQ_EXAMPLE_2 = rb"""@GAPC_0017:6:1:1259:10413#0/1
FASTQ_EXAMPLE_2 = r"""@GAPC_0017:6:1:1259:10413#0/1
AACACCAAACTTCTCCACCACGTGAGCTACAAAAG
+GAPC_0015:6:1:1259:10413#0/1
````Y^T]`]c^cabcacc`^Lb^ccYT\T\Y\WF
@GAPC_0015:6:1:1283:11957#0/1
TATGTATATATAACATATACATATATACATACATA
+GAPC_0015:6:1:1283:11957#0/1
]KZ[PY]_[YY^```ac^\\`bT``c`\aT``bbb
"""
""".encode("utf-8")


FASTQ_EXAMPLE_3 = rb"""@GAPC_0017:6:1:1259:10413#0/1
FASTQ_EXAMPLE_3 = r"""@GAPC_0017:6:1:1259:10413#0/1
AACACCAAACTTCTCCACCACGTGAGCTACAAAAG
+GAPC_0015:6:1:1259:10413#0/1
````Y^T]`]c^cabcacc`^Lb^ccYT\T\Y\WF
@GAPC_0015:6:1:1283:11957#0/1
"""
""".encode("utf-8")


if __name__ == "__main__":
Expand Down
40 changes: 20 additions & 20 deletions qiita_files/parse/tests/test_iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,61 +276,61 @@ def test_fastq_gen(self):
self.assertEqual(obs3, exp3)


fasta1 = rb""">1
fasta1 = r""">1
aattggcc
>2
aattaatt
"""
""".encode("utf-8")

fasta2 = rb""">3
fasta2 = r""">3
atat
"""
""".encode("utf-8")

fasta3 = rb""">4
fasta3 = r""">4
attatt
>5
ggccc
"""
""".encode("utf-8")

qual1 = rb""">1
qual1 = r""">1
1 2 3 4 5 6 7 8
>2
8 7 6 5 4 3 2 1
"""
""".encode("utf-8")

qual2 = rb""">3
qual2 = r""">3
1 2 3 4
"""
""".encode("utf-8")

qual3 = rb""">4
qual3 = r""">4
1 2 3 4 5 6
>5
1 2 3 4 5
"""
""".encode("utf-8")

qual_bad_val = rb""">3
qual_bad_val = r""">3
1 2
"""
""".encode("utf-8")

qual_bad_id = rb""">asdasd
qual_bad_id = r""">asdasd
1 2 3 4
"""
""".encode("utf-8")

fastq1 = rb"""@1
fastq1 = r"""@1
atat
+
ABCD
@2
atgc
+
BCDE
"""
""".encode("utf-8")

fastq2 = rb"""@3
fastq2 = r"""@3
taa
+
EFG
"""
""".encode("utf-8")


if __name__ == '__main__':
Expand Down
5 changes: 4 additions & 1 deletion qiita_files/parse/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
from copy import deepcopy
from time import time
from functools import update_wrapper
from collections import Iterable
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
from types import MethodType


Expand Down
9 changes: 7 additions & 2 deletions qiita_files/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@
# -----------------------------------------------------------------------------

import os
import sys
from unittest import TestCase, main
import tempfile

import h5py
from io import StringIO, BytesIO
if sys.version_info[0] == 2:
from StringIO import StringIO
else:
from io import StringIO
from io import BytesIO

from qiita_files.util import (open_file, _is_string_or_bytes)

Expand All @@ -25,7 +30,7 @@ class TestFilePathOpening(TestCase):
"""Tests adapted from scikit-bio's skbio.io.util tests"""
def test_is_string_or_bytes(self):
self.assertTrue(_is_string_or_bytes('foo'))
self.assertTrue(_is_string_or_bytes(u'foo'))
self.assertTrue(_is_string_or_bytes(u'foo'.encode("utf-8")))
self.assertTrue(_is_string_or_bytes(b'foo'))
self.assertFalse(_is_string_or_bytes(StringIO('bar')))
self.assertFalse(_is_string_or_bytes([1]))
Expand Down
11 changes: 7 additions & 4 deletions qiita_files/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@

import h5py


# not present in all 2.x series
if hasattr(h5py.get_config(), 'default_file_mode'):
h5py.get_config().default_file_mode = 'r'
# deprecated sind h5py 3.3,
# see https://docs.h5py.org/en/stable/whatsnew/3.6.html
h5py_version = list(map(int, h5py.__version__.split('.')))
if h5py_version < [3, 3, 0]:
# not present in all 2.x series
if hasattr(h5py.get_config(), 'default_file_mode'):
h5py.get_config().default_file_mode = 'r'


def _is_string_or_bytes(s):
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
Topic :: Software Development :: Libraries :: Application Frameworks
Topic :: Software Development :: Libraries :: Python Modules
Programming Language :: Python
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
Operating System :: POSIX :: Linux
Operating System :: MacOS :: MacOS X
Expand Down
Loading