[med-svn] [Git][med-team/python-biopython][master] Replace mkdssp4.patch by dssp-v4-support.patch.
Étienne Mollier (@emollier)
gitlab at salsa.debian.org
Sat Nov 5 17:14:55 GMT 2022
Étienne Mollier pushed to branch master at Debian Med / python-biopython
Commits:
405336d3 by Étienne Mollier at 2022-11-05T18:13:30+01:00
Replace mkdssp4.patch by dssp-v4-support.patch.
Upstream came up with the necessary changes to support mkdssp 4.
- - - - -
3 changed files:
- + debian/patches/dssp-v4-support.patch
- − debian/patches/mkdssp4.patch
- debian/patches/series
Changes:
=====================================
debian/patches/dssp-v4-support.patch
=====================================
@@ -0,0 +1,245 @@
+Description: Add Support for DSSP v4.0
+Author: Christian Balbin
+Bug: https://github.com/biopython/biopython/issues/3763
+Applied-Upstream: https://github.com/biopython/biopython/pull/3775
+Reviewed-by: Étienne Mollier <emollier at debian.org>
+Last-Update: 2022-11-02
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- python-biopython.orig/Bio/PDB/DSSP.py
++++ python-biopython/Bio/PDB/DSSP.py
+@@ -179,6 +179,9 @@
+ },
+ }
+
++def version(version_string):
++ """Parse semantic version scheme for easy comparison."""
++ return tuple(map(int, (version_string.split("."))))
+
+ def ss_to_index(ss):
+ """Secondary structure symbol to index.
+@@ -196,7 +199,7 @@
+ assert 0
+
+
+-def dssp_dict_from_pdb_file(in_file, DSSP="dssp"):
++def dssp_dict_from_pdb_file(in_file, DSSP="dssp", dssp_version="3.9.9"):
+ """Create a DSSP dictionary from a PDB file.
+
+ Parameters
+@@ -207,6 +210,9 @@
+ DSSP : string
+ DSSP executable (argument to subprocess)
+
++ dssp_version : string
++ Version of DSSP excutable
++
+ Returns
+ -------
+ (out_dict, keys) : tuple
+@@ -216,7 +222,7 @@
+
+ Examples
+ --------
+- How dssp_dict_frompdb_file could be used::
++ How dssp_dict_from_pdb_file could be used::
+
+ from Bio.PDB.DSSP import dssp_dict_from_pdb_file
+ dssp_tuple = dssp_dict_from_pdb_file("/local-pdb/1fat.pdb")
+@@ -230,8 +236,12 @@
+ # and calling 'dssp' will hence not work in some operating systems
+ # (Debian distribution of DSSP includes a symlink for 'dssp' argument)
+ try:
++ if version(dssp_version) < version("4.0.0"):
++ DSSP_cmd = [DSSP, in_file]
++ else:
++ DSSP_cmd = [DSSP, "--output-format=dssp", in_file]
+ p = subprocess.Popen(
+- [DSSP, in_file],
++ DSSP_cmd,
+ universal_newlines=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+@@ -239,8 +249,12 @@
+ except FileNotFoundError:
+ if DSSP == "mkdssp":
+ raise
++ if version(dssp_version) < version("4.0.0"):
++ DSSP_cmd = ["mkdssp", in_file]
++ else:
++ DSSP_cmd = ["mkdssp", "--output-format=dssp", in_file]
+ p = subprocess.Popen(
+- ["mkdssp", in_file],
++ DSSP_cmd,
+ universal_newlines=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+@@ -435,7 +449,13 @@
+ # calling 'dssp' will not work in some operating systems
+ # (Debian distribution of DSSP includes a symlink for 'dssp' argument)
+ try:
+- dssp_dict, dssp_keys = dssp_dict_from_pdb_file(in_file, dssp)
++ version_string = subprocess.check_output(
++ [dssp, "--version"], universal_newlines=True
++ )
++ dssp_version = re.search(r"\s*([\d.]+)", version_string).group(1)
++ dssp_dict, dssp_keys = dssp_dict_from_pdb_file(
++ in_file, dssp, dssp_version
++ )
+ except FileNotFoundError:
+ if dssp == "dssp":
+ dssp = "mkdssp"
+@@ -443,7 +463,13 @@
+ dssp = "dssp"
+ else:
+ raise
+- dssp_dict, dssp_keys = dssp_dict_from_pdb_file(in_file, dssp)
++ version_string = subprocess.check_output(
++ [dssp, "--version"], universal_newlines=True
++ )
++ dssp_version = re.search(r"\s*([\d.]+)", version_string).group(1)
++ dssp_dict, dssp_keys = dssp_dict_from_pdb_file(
++ in_file, dssp, dssp_version
++ )
+ # If the input file is a DSSP file just parse it directly:
+ elif file_type == "DSSP":
+ dssp_dict, dssp_keys = make_dssp_dict(in_file)
+@@ -459,7 +485,7 @@
+ # But MMCIFParser reads in the auth_asym_id
+ # Here we create a dictionary to map label_asym_id to auth_asym_id
+ # using the mmCIF file
+- if file_type == "MMCIF":
++ if file_type == "MMCIF" and version(dssp_version) < version("4.0.0"):
+ mmcif_dict = MMCIF2Dict(in_file)
+ mmcif_chain_dict = {}
+ for i, c in enumerate(mmcif_dict["_atom_site.label_asym_id"]):
+@@ -472,7 +498,7 @@
+ # (residue, (secondary structure, accessibility)) tuples
+ for key in dssp_keys:
+ chain_id, res_id = key
+- if file_type == "MMCIF":
++ if file_type == "MMCIF" and version(dssp_version) < version("4.0.0"):
+ chain_id = mmcif_chain_dict[chain_id]
+ dssp_mapped_keys.append((chain_id, res_id))
+ chain = model[chain_id]
+@@ -615,6 +641,6 @@
+ dssp_map[(chain_id, res_id)] = dssp_vals
+ dssp_list.append(dssp_vals)
+
+- if file_type == "MMCIF":
++ if file_type == "MMCIF" and version(dssp_version) < version("4.0.0"):
+ dssp_keys = dssp_mapped_keys
+ AbstractResiduePropertyMap.__init__(self, dssp_map, dssp_keys, dssp_list)
+--- python-biopython.orig/Tests/test_PDB_DSSP.py
++++ python-biopython/Tests/test_PDB_DSSP.py
+@@ -15,14 +15,13 @@
+
+ """Unit tests for the Bio.PDB.DSSP submodule."""
+
+-from distutils.version import StrictVersion
+ import re
+ import subprocess
+ import unittest
+ import warnings
+
+ try:
+- import numpy
++ import numpy # noqa: F401
+ except ImportError:
+ from Bio import MissingPythonDependencyError
+
+@@ -31,10 +30,17 @@
+ ) from None
+
+
+-from Bio import MissingExternalDependencyError
+ from Bio.PDB import PDBParser, MMCIFParser
+ from Bio.PDB import DSSP, make_dssp_dict
+
++VERSION_2_2_0 = (2, 2, 0)
++
++def parse_dssp_version(version_string):
++ """Parse the DSSP version into a tuple from the tool output."""
++ match = re.search(r"\s*([\d.]+)", version_string)
++ if match:
++ version = match.group(1)
++ return tuple(map(int, version.split(".")))
+
+ def will_it_float(s): # well played, whoever this was :)
+ """Convert the input into a float if it is a number.
+@@ -53,7 +59,7 @@
+ @classmethod
+ def setUpClass(cls):
+
+- cls.dssp_version = "0.0.0"
++ cls.dssp_version = (0, 0, 0)
+ is_dssp_available = False
+ # Check if DSSP is installed
+ quiet_kwargs = {"stdout": subprocess.PIPE, "stderr": subprocess.STDOUT}
+@@ -63,7 +69,7 @@
+ version_string = subprocess.check_output(
+ ["dssp", "--version"], universal_newlines=True
+ )
+- cls.dssp_version = re.search(r"\s*([\d.]+)", version_string).group(1)
++ cls.dssp_version = parse_dssp_version(version_string)
+ is_dssp_available = True
+ except subprocess.CalledProcessError:
+ # Older versions of DSSP
+@@ -74,7 +80,7 @@
+ version_string = subprocess.check_output(
+ ["mkdssp", "--version"], universal_newlines=True
+ )
+- cls.dssp_version = re.search(r"\s*([\d.]+)", version_string).group(1)
++ cls.dssp_version = parse_dssp_version(version_string)
+ is_dssp_available = True
+ except OSError:
+ pass
+@@ -91,33 +97,39 @@
+ """Test DSSP generation from PDB."""
+ pdbfile = "PDB/2BEG.pdb"
+ model = self.pdbparser.get_structure("2BEG", pdbfile)[0]
+- dssp = DSSP(model, pdbfile)
++ with warnings.catch_warnings():
++ warnings.simplefilter("ignore") # silence DSSP warnings
++ dssp = DSSP(model, pdbfile)
+ self.assertEqual(len(dssp), 130)
+
+ # Only run mmCIF tests if DSSP version installed supports mmcif
+ def test_dssp_with_mmcif_file(self):
+ """Test DSSP generation from MMCIF."""
+- if self.dssp_version < StrictVersion("2.2.0"):
++ if self.dssp_version < VERSION_2_2_0:
+ self.skipTest("Test requires DSSP version 2.2.0 or greater")
+
+- pdbfile = "PDB/2BEG.cif"
+- model = self.cifparser.get_structure("2BEG", pdbfile)[0]
+- dssp = DSSP(model, pdbfile)
+- self.assertEqual(len(dssp), 130)
++ pdbfile = "PDB/4ZHL.cif"
++ with warnings.catch_warnings():
++ warnings.simplefilter("ignore") # silence all warnings
++ model = self.cifparser.get_structure("4ZHL", pdbfile)[0]
++ dssp = DSSP(model, pdbfile)
++ self.assertEqual(len(dssp), 257)
+
+ def test_dssp_with_mmcif_file_and_nonstandard_residues(self):
+ """Test DSSP generation from MMCIF with non-standard residues."""
+- if self.dssp_version < StrictVersion("2.2.0"):
++ if self.dssp_version < VERSION_2_2_0:
+ self.skipTest("Test requires DSSP version 2.2.0 or greater")
+
+ pdbfile = "PDB/1AS5.cif"
+ model = self.cifparser.get_structure("1AS5", pdbfile)[0]
+- dssp = DSSP(model, pdbfile)
++ with warnings.catch_warnings():
++ warnings.simplefilter("ignore") # silence DSSP warnings
++ dssp = DSSP(model, pdbfile)
+ self.assertEqual(len(dssp), 24)
+
+ def test_dssp_with_mmcif_file_and_different_chain_ids(self):
+ """Test DSSP generation from MMCIF which has different label and author chain IDs."""
+- if self.dssp_version < StrictVersion("2.2.0"):
++ if self.dssp_version < VERSION_2_2_0:
+ self.skipTest("Test requires DSSP version 2.2.0 or greater")
+
+ pdbfile = "PDB/1A7G.cif"
=====================================
debian/patches/mkdssp4.patch deleted
=====================================
@@ -1,49 +0,0 @@
-Description: port PDB DSSP module to use dssp version 4
- Upstream Biopython does not support mkdssp 4 yet, but Debian now ships with
- such mkdssp version.
- .
- Note that starting with Biopython 1.79, one new item of the test suite now
- fails in the specific case of running mkdssp version too high, so let's just
- skip this test for now. Upstream is aware of the issue and confirmed it is
- Debian specific [1].
- .
- [1]: https://github.com/biopython/biopython/issues/3763
-Author: Étienne Mollier <emollier at debian.org>
-Bug: https://github.com/biopython/biopython/issues/3433
-Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=976542
-Last-Update: 2021-10-15
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- python-biopython.orig/Bio/PDB/DSSP.py
-+++ python-biopython/Bio/PDB/DSSP.py
-@@ -231,7 +231,7 @@
- # (Debian distribution of DSSP includes a symlink for 'dssp' argument)
- try:
- p = subprocess.Popen(
-- [DSSP, in_file],
-+ [DSSP, "--output-format=dssp", in_file],
- universal_newlines=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
-@@ -240,7 +240,7 @@
- if DSSP == "mkdssp":
- raise
- p = subprocess.Popen(
-- ["mkdssp", in_file],
-+ ["mkdssp", "--output-format=dssp", in_file],
- universal_newlines=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
---- python-biopython.orig/Tests/test_PDB_DSSP.py
-+++ python-biopython/Tests/test_PDB_DSSP.py
-@@ -117,8 +117,8 @@
-
- def test_dssp_with_mmcif_file_and_different_chain_ids(self):
- """Test DSSP generation from MMCIF which has different label and author chain IDs."""
-- if self.dssp_version < StrictVersion("2.2.0"):
-- self.skipTest("Test requires DSSP version 2.2.0 or greater")
-+ if self.dssp_version < StrictVersion("2.2.0") or self.dssp_version >= StrictVersion("4.0.0"):
-+ self.skipTest("Test requires DSSP version between 2.2.0 and 4.0.0.")
-
- pdbfile = "PDB/1A7G.cif"
- model = self.cifparser.get_structure("1A7G", pdbfile)[0]
=====================================
debian/patches/series
=====================================
@@ -3,6 +3,6 @@ privacy_breach.patch
privacy_breach_ie9.patch
fix-use-of-unversioned-python.patch
reproduciblebuild.patch
-mkdssp4.patch
adjust-test_GraphicsBitmaps.patch
spelling.patch
+dssp-v4-support.patch
View it on GitLab: https://salsa.debian.org/med-team/python-biopython/-/commit/405336d39b00d896b8f496bb4601e4ff712c5eba
--
View it on GitLab: https://salsa.debian.org/med-team/python-biopython/-/commit/405336d39b00d896b8f496bb4601e4ff712c5eba
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/20221105/a05a70b5/attachment-0001.htm>
More information about the debian-med-commit
mailing list