Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update develop #218

Merged
merged 80 commits into from
Apr 4, 2024
Merged

Update develop #218

merged 80 commits into from
Apr 4, 2024

Conversation

mdshw5
Copy link
Owner

@mdshw5 mdshw5 commented Apr 4, 2024

No description provided.

mdshw5 and others added 30 commits July 22, 2022 10:27
Merge changes from #184 to release
Add use case for indexing FASTA with suppressed output
Update python versions in CI
Starting with version 1.80, biopython does more stringent checks on
opening bgzf files.  This is causing a series of test failures in
pyfaidx 0.7.1:

	tests/test_Fasta_bgzip.py::test_build_issue_126 XFAIL                    [ 11%]
	tests/test_Fasta_bgzip.py::test_integer_slice FAILED                     [ 11%]
	tests/test_Fasta_bgzip.py::test_integer_index FAILED                     [ 12%]
	tests/test_Fasta_bgzip.py::test_fetch_whole_fasta FAILED                 [ 13%]
	tests/test_Fasta_bgzip.py::test_line_len FAILED                          [ 14%]
	tests/test_Fasta_bgzip.py::test_mutable_bgzf PASSED                      [ 14%]
	tests/test_Fasta_bgzip.py::test_long_names FAILED                        [ 15%]
	tests/test_Fasta_bgzip.py::test_fetch_whole_entry FAILED                 [ 16%]
	tests/test_Fasta_bgzip.py::test_fetch_middle FAILED                      [ 17%]
	tests/test_Fasta_bgzip.py::test_fetch_end FAILED                         [ 17%]
	tests/test_Fasta_bgzip.py::test_fetch_border FAILED                      [ 18%]
	tests/test_Fasta_bgzip.py::test_rev FAILED                               [ 19%]
	tests/test_Fasta_bgzip.py::test_fetch_past_bounds FAILED                 [ 20%]
	tests/test_Fasta_bgzip.py::test_fetch_negative FAILED                    [ 20%]
	tests/test_Fasta_bgzip.py::test_fetch_reversed_coordinates FAILED        [ 21%]
	tests/test_Fasta_bgzip.py::test_fetch_keyerror FAILED                    [ 22%]
	tests/test_Fasta_bgzip.py::test_blank_string FAILED                      [ 22%]
	tests/test_Fasta_bgzip.py::test_slice_from_beginning FAILED              [ 23%]
	tests/test_Fasta_bgzip.py::test_slice_from_end FAILED                    [ 24%]
	tests/test_Fasta_bgzip.py::test_issue_74_start FAILED                    [ 25%]
	tests/test_Fasta_bgzip.py::test_issue_74_consistency FAILED              [ 25%]
	tests/test_Fasta_bgzip.py::test_issue_74_end_faidx FAILED                [ 26%]
	tests/test_Fasta_bgzip.py::test_issue_74_end_fasta FAILED                [ 27%]
	tests/test_Fasta_bgzip.py::test_issue_79_fix FAILED                      [ 28%]
	tests/test_Fasta_bgzip.py::test_issue_79_fix_negate FAILED               [ 28%]
	tests/test_Fasta_bgzip.py::test_issue_79_fix_one_based_false FAILED      [ 29%]
	tests/test_Fasta_bgzip.py::test_issue_79_fix_one_based_false_negate FAILED [ 30%]
	tests/test_Fasta_bgzip.py::test_fetch_border_padded FAILED               [ 31%]
	[…]
	                try:
	                    # mutable mode is not supported for bzgf anyways
	>                   self.file = bgzf.BgzfReader(fileobj=self.file, mode="b")

	/tmp/autopkgtest-lxc.i9z1xpfv/downtmp/build.bvQ/src/pyfaidx/__init__.py:412:
	[…]
	        if mode.lower() not in ("r", "tr", "rt", "rb", "br"):
	>           raise ValueError(
	                "Must use a read mode like 'r' (default), 'rt', or 'rb' for binary"
	            )
	E           ValueError: Must use a read mode like 'r' (default), 'rt', or 'rb' for binary

	/usr/lib/python3/dist-packages/Bio/bgzf.py:597: ValueError
	[…]
	                try:
	                    # mutable mode is not supported for bzgf anyways
	                    self.file = bgzf.BgzfReader(fileobj=self.file, mode="b")
	                except (ValueError, IOError):
	>                   raise UnsupportedCompressionFormat(
	                        "Compressed FASTA is only supported in BGZF format. Use "
	                        "the samtools bgzip utility (instead of gzip) to "
	                        "compress your FASTA."
	E                       pyfaidx.UnsupportedCompressionFormat: Compressed FASTA is only supported in BGZF format. Use the samtools bgzip utility (instead of gzip) to compress your FASTA.

	/tmp/autopkgtest-lxc.i9z1xpfv/downtmp/build.bvQ/src/pyfaidx/__init__.py:414: UnsupportedCompressionFormat

A [full log] is available on Debian CI infrastructure, as I first
noticed this while attempting to upgrade biopython to version 1.80 in
Debian experimental.

[full log]: https://ci.debian.net/data/autopkgtest/unstable/amd64/p/python-pyfaidx/28663555/log.gz

Looking at the main development branch, I suspect this breakage might
still occur.  This patch makes opening bgzf files explicitly in
read-only mode, and thus does not trigger the error anymore, without
causing regression in the test suite.

Note the comment in BgzfReader constructor mentions that one would:

> typically use the top level ``bgzf.open(...)`` function
> which will call this class internally. Direct use is discouraged.

So maybe this commit is more of a workaround than the proper fix.

Signed-off-by: Étienne Mollier <emollier@debian.org>
Also, it would need to be a list, so as it was, it would be interpreted as
provides = ['p', 'y', 'f', 'a', 'i', 'd', 'x']
This is the "modern" way of setting metadata for Python projects
(see PEP 621: Storing project metadata in pyproject.toml).

setuptools has introduced support for this in version 61, and it appears to
be stable now.

Some helpful tutorials:
- https://packaging.python.org/en/latest/tutorials/packaging-projects/
- https://setuptools.pypa.io/en/latest/userguide/quickstart.html

Also, the setuptools-scm configuration needed to be converted from setup.py,
but this is documented well at <https://github.com/pypa/setuptools_scm/>.

Since setup.py is gone, the README was updated to no longer recommend
"python setup.py install". Similarly, "python setup.py sdist" no longer
works. Instead, the "build" tool should be used: "pip install build && python -m build"
(or "pipx run build" if pipx is available, as on the GitHub runners).

Closes #186
fix bgzf test failure with biopython 1.80
Add a finalizer method for Faidx class

- fix ResourceWarning: unclosed file
mdshw5 and others added 29 commits February 14, 2023 11:50
The Github Actions CI macOS job runners have some issue installing a proper pysam wheel, so for now we can just run tests requiring pysam under Linux.
'Sequence.gc' Method for IUPAC bases
Long-term solution once I stop supporting python < 3.8 should be to switch to https://docs.python.org/3/library/importlib.metadata.html#module-importlib.metadata
The script already imports __version__ from the package.
…-in-072

missing setuptools dependency in v0.7.2
Add importlib_metadata install dependency for python <3.8
Replace usage of pkg_resources API
remove old Python 2 hybridation
Added the command to convert gzip to bgzip.
@mdshw5 mdshw5 merged commit 2eb26b6 into develop Apr 4, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants