[med-svn] [Git][med-team/python-pyfaidx][master] 10 commits: routine-update: New upstream version

Étienne Mollier (@emollier) gitlab at salsa.debian.org
Tue Jul 18 17:20:49 BST 2023



Étienne Mollier pushed to branch master at Debian Med / python-pyfaidx


Commits:
d58aa742 by Étienne Mollier at 2023-07-18T17:51:23+02:00
routine-update: New upstream version

- - - - -
a372ba32 by Étienne Mollier at 2023-07-18T17:51:33+02:00
New upstream version 0.7.2.1
- - - - -
d028f5ea by Étienne Mollier at 2023-07-18T17:51:34+02:00
Update upstream source from tag 'upstream/0.7.2.1'

Update to upstream version '0.7.2.1'
with Debian dir 3bb4a595e8099f357aca239c4e414018bede4a2a
- - - - -
02f1174f by Étienne Mollier at 2023-07-18T17:51:34+02:00
routine-update: Standards-Version: 4.6.2

- - - - -
43c71784 by Étienne Mollier at 2023-07-18T17:54:16+02:00
test-locale-to-c.patch: refresh.

- - - - -
d527f066 by Étienne Mollier at 2023-07-18T17:56:09+02:00
no_setuptools-scm.patch: delete: file removed upstream.

- - - - -
660a63c4 by Étienne Mollier at 2023-07-18T17:58:18+02:00
biopython-1.80.patch: delete: applied upstream.

- - - - -
906cfab1 by Étienne Mollier at 2023-07-18T18:14:31+02:00
d/control: build depends on pybuild-plugin-pyproject.

This is because upstream removed setup.py and is now exclusively
relying on pyproject.toml.

- - - - -
d46b1194 by Étienne Mollier at 2023-07-18T18:15:18+02:00
manual-layout.patch: add: fix build failure.

The build failure is caught because the debian/ directory breaks the
expectation that the autodiscovery in flat-layout mode will work.

- - - - -
8b4fee7c by Étienne Mollier at 2023-07-18T18:20:02+02:00
ready to upload to unstable.

- - - - -


14 changed files:

- README.rst
- debian/changelog
- debian/control
- − debian/patches/biopython-1.80.patch
- + debian/patches/manual-layout.patch
- − debian/patches/no_setuptools-scm.patch
- debian/patches/series
- debian/patches/test-locale-to-c.patch
- dev-requirements.txt
- pyfaidx/__init__.py
- + pyproject.toml
- − setup.py
- tests/test_FastaVariant.py
- tests/test_feature_indexing.py


Changes:

=====================================
README.rst
=====================================
@@ -36,7 +36,7 @@ or download a `release <https://github.com/mdshw5/pyfaidx/releases>`_ and:
 
 ::
 
-    python setup.py install
+    pip install .
 
 If using ``pip install --user`` make sure to add ``/home/$USER/.local/bin`` to your ``$PATH`` (on linux) or ``/Users/$USER/Library/Python/{python version}/bin`` (on macOS) if you want to run the ``faidx`` script.
 
@@ -413,6 +413,9 @@ Examples:
 
 .. code:: bash
 
+    $ faidx -v tests/data/genes.fasta
+    ### Creates an .fai index, but supresses sequence output using --invert-match ###
+
     $ faidx tests/data/genes.fasta NM_001282543.1:201-210 NM_001282543.1:300-320
     >NM_001282543.1:201-210
     CTCGTTCCGC


=====================================
debian/changelog
=====================================
@@ -1,3 +1,19 @@
+python-pyfaidx (0.7.2.1-1) unstable; urgency=medium
+
+  * New upstream version
+  * Standards-Version: 4.6.2 (routine-update)
+  * test-locale-to-c.patch: refresh.
+  * no_setuptools-scm.patch: delete: file removed upstream.
+  * biopython-1.80.patch: delete: applied upstream.
+  * d/control: build depends on pybuild-plugin-pyproject.
+    This is because upstream removed setup.py and is now exclusively
+    relying on pyproject.toml.
+  * manual-layout.patch: add: fix build failure.
+    The build failure is caught because the debian/ directory breaks the
+    expectation that the autodiscovery in flat-layout mode will work.
+
+ -- Étienne Mollier <emollier at debian.org>  Tue, 18 Jul 2023 18:16:37 +0200
+
 python-pyfaidx (0.7.1-2) unstable; urgency=medium
 
   * biopython-1.80.patch: add; fix test failure with biopython 1.80.


=====================================
debian/control
=====================================
@@ -6,19 +6,20 @@ Section: python
 Testsuite: autopkgtest-pkg-python
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
-               dh-python,
+               dh-sequence-python3,
                python3-all,
                python3-coverage,
                python3-setuptools,
                python3-biopython,
                python3-numpy <!nocheck>,
                python3-pkg-resources <!nocheck>,
+               pybuild-plugin-pyproject,
                python3-pytest <!nocheck>,
                python3-six <!nocheck>,
                python3-mock <!nocheck>,
                samtools <!nocheck>,
                tabix <!nocheck>
-Standards-Version: 4.6.1
+Standards-Version: 4.6.2
 Vcs-Browser: https://salsa.debian.org/med-team/python-pyfaidx
 Vcs-Git: https://salsa.debian.org/med-team/python-pyfaidx.git
 Homepage: https://github.com/mdshw5/pyfaidx


=====================================
debian/patches/biopython-1.80.patch deleted
=====================================
@@ -1,17 +0,0 @@
-Description: fix bgzf test failure with biopython 1.80
-Author: Étienne Mollier <emollier at debian.org>
-Forwarded: https://github.com/mdshw5/pyfaidx/pull/199
-Last-Update: 2022-11-25
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- python-pyfaidx.orig/pyfaidx/__init__.py
-+++ python-pyfaidx/pyfaidx/__init__.py
-@@ -409,7 +409,7 @@
-                 self._bgzf = True
-                 try:
-                     # mutable mode is not supported for bzgf anyways
--                    self.file = bgzf.BgzfReader(fileobj=self.file, mode="b")
-+                    self.file = bgzf.BgzfReader(fileobj=self.file, mode="rb")
-                 except (ValueError, IOError):
-                     raise UnsupportedCompressionFormat(
-                         "Compressed FASTA is only supported in BGZF format. Use "


=====================================
debian/patches/manual-layout.patch
=====================================
@@ -0,0 +1,20 @@
+Description: fix flat layout choking on debian/ directory.
+ This patch will hint the pyproject.toml to search explicitly for the pyfaidx
+ package in the source tree.  Upstream counts on a flat layout, but this
+ expectation is broken as soon as in Debian context, the debian/ directory is
+ part of the equation.  This is thus a Debian specific fix.
+
+Author: Étienne Mollier <emollier at debian.org>
+Forwarded: not-needed
+Last-Update: 2023-07-18
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- python-pyfaidx.orig/pyproject.toml
++++ python-pyfaidx/pyproject.toml
+@@ -41,3 +41,6 @@
+ 
+ [tool.setuptools_scm]
+ local_scheme = "no-local-version"
++
++[tool.setuptools]
++packages = ["pyfaidx"]


=====================================
debian/patches/no_setuptools-scm.patch deleted
=====================================
@@ -1,15 +0,0 @@
-Description: Do not use setuptools-scm
-Author: Andreas Tille <tille at debian.org>
-Last-Update: Thu, 17 Feb 2022 15:12:33 +0100
-
---- a/setup.py
-+++ b/setup.py
-@@ -18,8 +18,6 @@ setup(
-     license='BSD',
-     packages=['pyfaidx'],
-     install_requires=install_requires,
--    use_scm_version={"local_scheme": "no-local-version"},
--    setup_requires=['setuptools_scm'],
-     entry_points={'console_scripts': ['faidx = pyfaidx.cli:main']},
-     classifiers=[
-             "Development Status :: 5 - Production/Stable",


=====================================
debian/patches/series
=====================================
@@ -1,5 +1,4 @@
 test-locale-to-c.patch
 remove-ignore-docstring.patch
-no_setuptools-scm.patch
 fix-pkg-resources.patch
-biopython-1.80.patch
+manual-layout.patch


=====================================
debian/patches/test-locale-to-c.patch
=====================================
@@ -5,9 +5,9 @@ Author: Sao I Kuan <saoikuan at gmail.com>
 Forwarded: not-needed
 Last-Update: 2020-09-30
 
---- a/tests/test_feature_indexing.py
-+++ b/tests/test_feature_indexing.py
-@@ -318,7 +318,7 @@ def test_read_back_index(remove_index):
+--- python-pyfaidx.orig/tests/test_feature_indexing.py
++++ python-pyfaidx/tests/test_feature_indexing.py
+@@ -322,7 +322,7 @@
      import platform
      
      if platform.system() == "Linux":
@@ -16,10 +16,3 @@ Last-Update: 2020-09-30
      elif platform.system() == "Darwin":
          new_locale = 'en_US.UTF-8'
      
-@@ -349,4 +349,4 @@ def test_issue_144_no_defline(remove_ind
-         with pytest.raises(FastaIndexingError):
-             faidx = Faidx(fasta_path)
-     finally:
--        shutil.rmtree(tmp_dir)
-\ No newline at end of file
-+        shutil.rmtree(tmp_dir)


=====================================
dev-requirements.txt
=====================================
@@ -4,7 +4,7 @@ pytest-cov
 setuptools
 mock
 cython 
-pysam 
+# pysam
 requests 
 coverage 
 pyfasta 


=====================================
pyfaidx/__init__.py
=====================================
@@ -304,6 +304,34 @@ class Sequence(object):
         c = self.seq.count('C')
         c += self.seq.count('c')
         return (g + c) / len(self.seq)
+    
+    @property
+    def gc_strict(self):
+        """ Return the GC content of seq as a float, ignoring non ACGT characters
+        >>> x = Sequence(name='chr1', seq='NMRATCGTA')
+        >>> y = round(x.gc, 2)
+        >>> y == 0.33
+        True
+        """
+        trimSeq = re.sub(r'[^ACGT]', '', self.seq.upper())
+        gc = sum(trimSeq.count(i) for i in ['G','C'])
+        return gc / len(trimSeq)
+
+    @property
+    def gc_iupac(self):
+        """ Return the GC content of seq as a float, accounting for IUPAC ambiguity 
+        >>> x = Sequence(name='chr1', seq='NMRATCGTA')
+        >>> y = round(x.gc, 2)
+        >>> y == 0.36
+        True
+        """
+        trimSeq = re.sub(r'[^ACGTMRWSYKVHDBN]', '', self.seq.upper())
+        gc =  sum(trimSeq.count(i) for i in ['S','C','G']) 
+        gc += sum(trimSeq.count(i) for i in ['B','V']) * 0.67
+        gc += sum(trimSeq.count(i) for i in ['M','R','Y','K']) * 0.5
+        gc += sum(trimSeq.count(i) for i in ['H','D']) * 0.33
+        gc += trimSeq.count('N') * 0.25
+        return gc / len(trimSeq)
 
 
 class IndexRecord(
@@ -405,7 +433,7 @@ class Faidx(object):
                 self._bgzf = True
                 try:
                     # mutable mode is not supported for bzgf anyways
-                    self.file = bgzf.BgzfReader(fileobj=self.file, mode="b")
+                    self.file = bgzf.BgzfReader(fileobj=self.file, mode="rb")
                 except (ValueError, IOError):
                     raise UnsupportedCompressionFormat(
                         "Compressed FASTA is only supported in BGZF format. Use "
@@ -857,6 +885,9 @@ class Faidx(object):
     def close(self):
         self.__exit__()
 
+    def __del__(self):
+        self.__exit__()
+
     def __enter__(self):
         return self
 


=====================================
pyproject.toml
=====================================
@@ -0,0 +1,43 @@
+[build-system]
+requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2", "wheel"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "pyfaidx"
+authors = [
+    { name="Matthew Shirley", email="mdshw5 at gmail.com"}
+]
+description = "pyfaidx: efficient pythonic random access to fasta subsequences"
+readme = "README.rst"
+requires-python = ">=3.7"
+license = {text = "BSD-3-Clause"}
+classifiers = [
+    "Development Status :: 5 - Production/Stable",
+    "License :: OSI Approved :: BSD License",
+    "Environment :: Console",
+    "Intended Audience :: Science/Research",
+    "Natural Language :: English",
+    "Operating System :: Unix",
+    "Programming Language :: Python :: 3.11",
+    "Programming Language :: Python :: 3.10",
+    "Programming Language :: Python :: 3.9",
+    "Programming Language :: Python :: 3.8",
+    "Programming Language :: Python :: 3.7",
+    "Programming Language :: Python :: Implementation :: PyPy",
+    "Topic :: Scientific/Engineering :: Bio-Informatics"
+]
+dependencies = [
+    "six",
+    "setuptools"
+]
+dynamic = ["version"]
+
+[project.urls]
+"Homepage" = "https://github.com/mdshw5/pyfaidx/"
+"Author homepage" = "http://mattshirley.com"
+
+[project.scripts]
+faidx = "pyfaidx.cli:main"
+
+[tool.setuptools_scm]
+local_scheme = "no-local-version"


=====================================
setup.py deleted
=====================================
@@ -1,39 +0,0 @@
-from setuptools import setup
-from io import open
-import sys
-
-install_requires = ['six', 'setuptools >= 0.7']
-if sys.version_info[0] == 2 and sys.version_info[1] == 6:
-    install_requires.extend(['ordereddict', 'argparse'])
-
-setup(
-    name='pyfaidx',
-    provides='pyfaidx',
-    author='Matthew Shirley',
-    author_email='mdshw5 at gmail.com',
-    url='http://mattshirley.com',
-    description='pyfaidx: efficient pythonic random '
-                'access to fasta subsequences',
-    long_description=open('README.rst', encoding='utf-8').read(),
-    license='BSD',
-    packages=['pyfaidx'],
-    install_requires=install_requires,
-    use_scm_version={"local_scheme": "no-local-version"},
-    setup_requires=['setuptools_scm'],
-    entry_points={'console_scripts': ['faidx = pyfaidx.cli:main']},
-    classifiers=[
-            "Development Status :: 5 - Production/Stable",
-            "License :: OSI Approved :: BSD License",
-            "Environment :: Console",
-            "Intended Audience :: Science/Research",
-            "Natural Language :: English",
-            "Operating System :: Unix",
-            "Programming Language :: Python :: 3.7",
-            "Programming Language :: Python :: 3.6",
-            "Programming Language :: Python :: 3.5",
-            "Programming Language :: Python :: 3.4",
-            "Programming Language :: Python :: 2.7",
-            "Programming Language :: Python :: Implementation :: PyPy",
-            "Topic :: Scientific/Engineering :: Bio-Informatics"
-    ]
-)


=====================================
tests/test_FastaVariant.py
=====================================
@@ -58,6 +58,7 @@ def test_all_pos(remove_index):
 
 def test_all_diff(remove_index):
     try:
+        import pysam
         fasta = FastaVariant('data/chr22.fasta', 'data/chr22.vcf.gz', hom=True, het=True, as_raw=True)
         ref = Fasta('data/chr22.fasta', as_raw=True)
         print([(ref['22'][pos-1], fasta['22'][pos-1]) for pos in fasta['22'].variant_sites])


=====================================
tests/test_feature_indexing.py
=====================================
@@ -24,6 +24,10 @@ def remove_index():
         os.remove('data/genes.fasta.fai')
     except EnvironmentError:
         pass  # some tests may delete this file
+    
+def test_version_issue_206():
+    import pyfaidx
+    assert isinstance(pyfaidx.__version__, str)    
 
 def test_build(remove_index):
     expect_index = ("gi|563317589|dbj|AB821309.1|	3510	114	70	71\n"
@@ -349,4 +353,4 @@ def test_issue_144_no_defline(remove_index):
         with pytest.raises(FastaIndexingError):
             faidx = Faidx(fasta_path)
     finally:
-        shutil.rmtree(tmp_dir)
\ No newline at end of file
+        shutil.rmtree(tmp_dir)



View it on GitLab: https://salsa.debian.org/med-team/python-pyfaidx/-/compare/adac4aa192e2f3356a73ba01c981b1ea98931ece...8b4fee7c8564cec69df9662e6ac3a45786212181

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-pyfaidx/-/compare/adac4aa192e2f3356a73ba01c981b1ea98931ece...8b4fee7c8564cec69df9662e6ac3a45786212181
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20230718/01b62050/attachment-0001.htm>


More information about the debian-med-commit mailing list