From 60a8645486d6dc1abead575044041d89e2ea3eef Mon Sep 17 00:00:00 2001 From: James Krieger Date: Sun, 5 Feb 2023 18:07:22 +0100 Subject: [PATCH 01/19] remove np alias types --- prody/compounds/pdbligands.py | 6 +++--- prody/dynamics/signature.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/prody/compounds/pdbligands.py b/prody/compounds/pdbligands.py index c01e77987..8d2e795c1 100644 --- a/prody/compounds/pdbligands.py +++ b/prody/compounds/pdbligands.py @@ -158,9 +158,9 @@ def fetchPDBLigand(cci, filename=None): resnums = np.ones(n_atoms, dtype=ATOMIC_FIELDS['charge'].dtype) alternate_atomnames = np.zeros(n_atoms, dtype=ATOMIC_FIELDS['name'].dtype) - leaving_atom_flags = np.zeros(n_atoms, np.bool) - aromatic_flags = np.zeros(n_atoms, np.bool) - stereo_configs = np.zeros(n_atoms, np.bool) + leaving_atom_flags = np.zeros(n_atoms, bool) + aromatic_flags = np.zeros(n_atoms, bool) + stereo_configs = np.zeros(n_atoms, bool) ordinals = np.zeros(n_atoms, int) name2index = {} diff --git a/prody/dynamics/signature.py b/prody/dynamics/signature.py index 76c85e149..c59b069e2 100644 --- a/prody/dynamics/signature.py +++ b/prody/dynamics/signature.py @@ -1648,7 +1648,7 @@ def showSignatureDistribution(signature, **kwargs): bins = kwargs.pop('bins', 'auto') if bins == 'auto': _, bins = np.histogram(W.flatten(), bins='auto') - elif np.isscalar(bins) and isinstance(bins, (int, np.integer)): + elif np.isscalar(bins) and isinstance(bins, int): step = (W.max() - W.min())/bins bins = np.arange(W.min(), W.max(), step) From 4cb4d0954acec7b3e9d14d8e49e9e8de6fa6e95f Mon Sep 17 00:00:00 2001 From: James Krieger Date: Sun, 5 Feb 2023 18:09:29 +0100 Subject: [PATCH 02/19] remove numpy restriction --- pyproject.toml | 2 +- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9b6fb8603..033eb9b1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,2 @@ [build-system] -requires = ["setuptools", "wheel", "numpy>=1.10,<1.24", "pyparsing", "scipy"] \ No newline at end of file +requires = ["setuptools", "wheel", "numpy>=1.10", "pyparsing", "scipy"] \ No newline at end of file diff --git a/setup.py b/setup.py index f8a3b4541..99e03a3bb 100644 --- a/setup.py +++ b/setup.py @@ -12,9 +12,9 @@ sys.exit() if sys.version_info[:2] == (2, 7) or sys.version_info[:2] <= (3, 5): - INSTALL_REQUIRES=['numpy>=1.10,<1.24', 'biopython<=1.76', 'pyparsing', 'scipy'] + INSTALL_REQUIRES=['numpy>=1.10', 'biopython<=1.76', 'pyparsing', 'scipy'] else: - INSTALL_REQUIRES=['numpy>=1.10,<1.24', 'biopython<=1.79', 'pyparsing', 'scipy', 'setuptools'] + INSTALL_REQUIRES=['numpy>=1.10', 'biopython<=1.79', 'pyparsing', 'scipy', 'setuptools'] if sys.version_info[0] == 3: if sys.version_info[1] < 6: From c891359a8589ec77527f07d605f3bfcfca88881e Mon Sep 17 00:00:00 2001 From: James Krieger Date: Sun, 5 Feb 2023 18:12:25 +0100 Subject: [PATCH 03/19] add back py 3.11 to actions --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index adc8efaf0..d72b9f224 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["2.7", "3.7", "3.8", "3.9", "3.10"] + python-version: ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v2 From c4e537c03791527d4edaa594e262c829b67870ae Mon Sep 17 00:00:00 2001 From: James Krieger Date: Tue, 7 Feb 2023 14:12:59 +0100 Subject: [PATCH 04/19] compare arrays not msas --- prody/tests/sequence/test_analysis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prody/tests/sequence/test_analysis.py b/prody/tests/sequence/test_analysis.py index b5e0b581f..f54f9f4ee 100644 --- a/prody/tests/sequence/test_analysis.py +++ b/prody/tests/sequence/test_analysis.py @@ -1205,7 +1205,7 @@ def testBuildMSAlocal(self): sequences = [ags[0].protein["A"].getSequence(), ags[1].protein["A"].getSequence()] - expect = parseMSA(pathDatafile('msa_3hsyA_3o21A.fasta')) - result = buildMSA(sequences, method="local", labels=["A2", "A3"]) + expect = parseMSA(pathDatafile('msa_3hsyA_3o21A.fasta')).getArray() + result = buildMSA(sequences, method="local", labels=["A2", "A3"]).getArray() assert_array_equal(expect, result) \ No newline at end of file From 0e12f6c3301ed66ec56c11060b00781a97cf72ba Mon Sep 17 00:00:00 2001 From: James Krieger Date: Tue, 7 Feb 2023 19:17:45 +0100 Subject: [PATCH 05/19] dev install --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d72b9f224..3da9b6a12 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: source activate test conda install --yes numpy scipy nose pyparsing requests if [[ ${{ matrix.python-version }} == "2.7" ]]; then conda install --yes unittest2; fi - pip install . + pip install -e . python setup.py build_ext --inplace --force - name: Test with pytest run: | From 4aba661ae070b97f58e842878af46d1435507dc0 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 9 Mar 2023 14:48:20 +0100 Subject: [PATCH 06/19] remove pfam tests --- prody/tests/database/test_pfam.py | 274 ------------------------------ 1 file changed, 274 deletions(-) delete mode 100644 prody/tests/database/test_pfam.py diff --git a/prody/tests/database/test_pfam.py b/prody/tests/database/test_pfam.py deleted file mode 100644 index 06d8bb95a..000000000 --- a/prody/tests/database/test_pfam.py +++ /dev/null @@ -1,274 +0,0 @@ -"""This module contains unit tests for :mod:`prody.database.pfam` module.""" - -from numpy import tile, array, arange, ones -from numpy.testing import assert_allclose - -from prody.tests import unittest -from prody.database.pfam import searchPfam -from prody.database.pfam import fetchPfamMSA -from prody.database.pfam import parsePfamPDBs - -from prody.atomic.selection import Selection - -import os -import shutil - -from prody import LOGGER -LOGGER.verbosity = 'none' - -class TestSearchPfam(unittest.TestCase): - def setUp(self): - self.queries = ['P19491', 'GRIA2_RAT', '6qkcB', '6qkcI', - 'VQVLLTTIGAFAAFGLMTIAISTDYWLYTRGLTHSGLWRICCLEGLK'\ - 'RGVCVKINHFAEYLLRVVRASSIFPILSAILLLLGGVCVAASR'\ - 'VYKSKRNIILGAGILFVAAGLSNIIGVIVYISANAGKNHYSYG'\ - 'WSFYFGGLSFILAEVIGVLAVNIYIERSR'] - - def testUniprotAccMulti(self): - """Test the outcome of a simple search scenario using a Uniprot Accession - for a multi-domain protein, AMPAR GluA2.""" - - a = searchPfam(self.queries[0]) - - self.assertIsInstance(a, dict, - 'searchPfam failed to return a dict instance') - - self.assertEqual(sorted(list(a.keys())), - ['PF00060', 'PF01094', 'PF10613'], - 'searchPfam failed to return the right domain family IDs') - - def testUniprotIdMulti(self): - """Test the outcome of a simple search scenario using a Uniprot ID - for a multi-domain protein, AMPAR GluA2.""" - - a = searchPfam(self.queries[1]) - - self.assertIsInstance(a, dict, - 'searchPfam failed to return a dict instance') - - self.assertEqual(sorted(list(a.keys())), - ['PF00060', 'PF01094', 'PF10613'], - 'searchPfam failed to return the right domain family IDs') - - def testPdbIdChMulti(self): - """Test the outcome of a simple search scenario using a PDB ID - and chain ID for the same multi-domain protein from specifying chain B.""" - - a = searchPfam(self.queries[2]) - - self.assertIsInstance(a, dict, - 'searchPfam failed to return a dict instance') - - self.assertEqual(sorted(list(a.keys())), - ['PF00060', 'PF01094', 'PF10613'], - 'searchPfam failed to return the right domain family IDs for AMPAR') - - def testPdbIdChSingle(self): - """Test the outcome of a simple search scenario using a PDB ID - and chain ID to get the single domain protein TARP g8 from chain I.""" - - a = searchPfam(self.queries[3]) - - self.assertIsInstance(a, dict, - 'searchPfam failed to return a dict instance') - - self.assertEqual(sorted(list(a.keys())), - ['PF00822'], - 'searchPfam failed to return the right domain family IDs for TARP') - - def testSeqSingle(self): - """Test the outcome of a simple search scenario using the sequence - of the single domain protein TARP g8 from 6qkc chain I.""" - - a = searchPfam(self.queries[4]) - - self.assertIsInstance(a, dict, - 'searchPfam failed to return a dict instance') - - self.assertEqual(sorted(list(a.keys())), - ['PF00822'], - 'searchPfam failed to return the right domain family IDs for TARP') - - -class TestFetchPfamMSA(unittest.TestCase): - - @classmethod - def setUpClass(self): - self.query = 'PF00822' - - self.workdir = 'pfam_msa_tests' - if not os.path.exists(self.workdir): - os.mkdir(self.workdir) - os.chdir(self.workdir) - - def testDefault(self): - """Test the outcome of fetching the domain MSA for claudins - with default parameters.""" - - b = fetchPfamMSA(self.query) - - self.assertIsInstance(b, str, - 'fetchPfamMSA failed to return a str instance') - - self.assertEqual(b, 'PF00822_full.sth') - - self.assertTrue(os.path.exists(b)) - - - def testSeed(self): - """Test the outcome of fetching the domain MSA for claudins - with the alignment type argument set to seed""" - - b = fetchPfamMSA(self.query, "seed") - - self.assertIsInstance(b, str, - 'fetchPfamMSA failed to return a str instance') - - self.assertEqual(b, 'PF00822_seed.sth') - - self.assertTrue(os.path.exists(b)) - - - def testFormat(self): - """Test the outcome of fetching the domain MSA for claudins - with keyword argument format set to fasta.""" - - b = fetchPfamMSA(self.query, format="fasta") - - self.assertIsInstance(b, str, - 'fetchPfamMSA failed to return a str instance') - - self.assertEqual(b, 'PF00822_full.fasta') - - self.assertTrue(os.path.exists(b)) - - - def testFolder(self): - """Test the outcome of fetching the domain MSA for claudins - with keyword folder set to a folder that is made especially.""" - - folder = "new_folder" - os.mkdir(folder) - b = fetchPfamMSA(self.query, folder=folder) - - self.assertIsInstance(b, str, - 'fetchPfamMSA failed to return a str instance') - - self.assertEqual(b, 'new_folder/PF00822_full.slx') - - self.assertTrue(os.path.exists(b)) - - @classmethod - def tearDownClass(self): - os.chdir('..') - shutil.rmtree(self.workdir) - - -class TestParsePfamPDBs(unittest.TestCase): - - @classmethod - def setUpClass(self): - self.queries = ['PF20446', 'Q57ZF2_TRYB2', 'VAS1_BOVIN'] - - self.workdir = 'pfam_pdb_tests' - if not os.path.exists(self.workdir): - os.mkdir(self.workdir) - os.chdir(self.workdir) - - def testPfamIdDefault(self): - """Test the outcome of parsing PDBs for a tiny family - of ABC class ATPase N-terminal domains (5 members) - with the Pfam ID and default parameters.""" - - b = parsePfamPDBs(self.queries[0]) - - self.assertIsInstance(b, list, - 'fetchPfamMSA failed to return a list instance') - - self.assertIsInstance(b[0], Selection, - 'fetchPfamMSA failed to return a list of Selection instances') - - self.assertEqual(len(b), 5, - 'fetchPfamMSA failed to return a list of length 5') - - - def testUniprotDefault(self): - """Test the outcome of parsing PDBs for a tiny family - of ABC class ATPase N-terminal domains (5 members) - with the Uniprot long ID and default parameters.""" - - b = parsePfamPDBs(self.queries[1]) - - self.assertIsInstance(b, list, - 'fetchPfamMSA failed to return a list instance') - - self.assertIsInstance(b[0], Selection, - 'fetchPfamMSA failed to return a list of Selection instances') - - self.assertEqual(len(b), 5, - 'fetchPfamMSA failed to return a list of length 5') - - - def testMultiDomainDefault(self): - """Test the outcome of parsing PDBs using a V-type proton ATPase subunit S1, - which has two domains but few relatives. Default parameters should - return Selection objects containing the first domain.""" - - b = parsePfamPDBs(self.queries[2]) - - self.assertIsInstance(b, list, - 'fetchPfamMSA failed to return a list instance') - - self.assertIsInstance(b[0], Selection, - 'fetchPfamMSA failed to return a list of Selection instances') - - self.assertEqual(len(b), 7, - 'fetchPfamMSA failed to return a list of length 7') - - self.assertEqual(b[0].getResnums()[0], 262, - 'fetchPfamMSA failed to return a first Selection with first resnum 262') - - def testMultiDomainStart1(self): - """Test the outcome of parsing PDBs using a V-type proton ATPase subunit S1, - which has two domains but few relatives. Using start=1 should be like default and - return Selection objects containing the first domain.""" - - b = parsePfamPDBs(self.queries[2], start=1) - - self.assertIsInstance(b, list, - 'fetchPfamMSA failed to return a list instance') - - self.assertIsInstance(b[0], Selection, - 'fetchPfamMSA failed to return a list of Selection instances') - - self.assertEqual(len(b), 7, - 'fetchPfamMSA failed to return a list of length 7') - - self.assertEqual(b[0].getResnums()[0], 262, - 'fetchPfamMSA failed to return a first Selection with first resnum 262') - - def testMultiDomainStart2(self): - """Test the outcome of parsing PDBs using a V-type proton ATPase subunit S1, - which has two domains but few relatives. Setting start to 418 should - return Selection objects containing the second domain.""" - - b = parsePfamPDBs(self.queries[2], start=418) - - self.assertIsInstance(b, list, - 'fetchPfamMSA failed to return a list instance') - - self.assertIsInstance(b[0], Selection, - 'fetchPfamMSA failed to return a list of Selection instances') - - self.assertEqual(len(b), 23, - 'fetchPfamMSA failed to return a list of length 23') - - self.assertEqual(b[0].getResnums()[0], 418, - 'fetchPfamMSA failed to return a first Selection with first resnum 418') - - @classmethod - def tearDownClass(self): - os.chdir('..') - shutil.rmtree(self.workdir) - - From ec66ce1c96298c06fe7daf9bf2c046795c6a3b25 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 5 Oct 2023 11:58:00 +0200 Subject: [PATCH 07/19] update tests to use pytest mark as dec --- prody/tests/apps/test_prody_anm.py | 5 ++++- prody/tests/apps/test_prody_catdcd.py | 5 ++++- prody/tests/apps/test_prody_examples.py | 5 ++++- prody/tests/apps/test_prody_gnm.py | 5 ++++- prody/tests/apps/test_prody_pca.py | 5 ++++- prody/tests/atomic/test_select.py | 5 ++++- prody/tests/dynamics/test_enms.py | 5 ++++- prody/tests/dynamics/test_pca.py | 5 ++++- prody/tests/proteins/test_ciffile.py | 5 ++++- prody/tests/proteins/test_dssp.py | 5 ++++- prody/tests/proteins/test_localpdb.py | 5 ++++- prody/tests/proteins/test_pdbfile.py | 5 ++++- prody/tests/proteins/test_wwpdb.py | 5 ++++- 13 files changed, 52 insertions(+), 13 deletions(-) diff --git a/prody/tests/apps/test_prody_anm.py b/prody/tests/apps/test_prody_anm.py index d49556f5b..99ed75b9f 100644 --- a/prody/tests/apps/test_prody_anm.py +++ b/prody/tests/apps/test_prody_anm.py @@ -8,7 +8,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody.tests.datafiles import TEMPDIR, pathDatafile diff --git a/prody/tests/apps/test_prody_catdcd.py b/prody/tests/apps/test_prody_catdcd.py index 92e53d85f..b62462c27 100644 --- a/prody/tests/apps/test_prody_catdcd.py +++ b/prody/tests/apps/test_prody_catdcd.py @@ -7,7 +7,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody import parsePDB, DCDFile, parseDCD diff --git a/prody/tests/apps/test_prody_examples.py b/prody/tests/apps/test_prody_examples.py index b12d275b7..5a122b144 100644 --- a/prody/tests/apps/test_prody_examples.py +++ b/prody/tests/apps/test_prody_examples.py @@ -9,7 +9,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody import LOGGER LOGGER.verbosity = None diff --git a/prody/tests/apps/test_prody_gnm.py b/prody/tests/apps/test_prody_gnm.py index a084d84d2..26fe005b9 100644 --- a/prody/tests/apps/test_prody_gnm.py +++ b/prody/tests/apps/test_prody_gnm.py @@ -7,7 +7,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody.tests.datafiles import TEMPDIR, pathDatafile diff --git a/prody/tests/apps/test_prody_pca.py b/prody/tests/apps/test_prody_pca.py index b186eb72f..bdd28611c 100644 --- a/prody/tests/apps/test_prody_pca.py +++ b/prody/tests/apps/test_prody_pca.py @@ -7,7 +7,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody.tests.datafiles import TEMPDIR, pathDatafile diff --git a/prody/tests/atomic/test_select.py b/prody/tests/atomic/test_select.py index dc7797179..f76239105 100644 --- a/prody/tests/atomic/test_select.py +++ b/prody/tests/atomic/test_select.py @@ -8,7 +8,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody import * from prody import LOGGER diff --git a/prody/tests/dynamics/test_enms.py b/prody/tests/dynamics/test_enms.py index aaf932f12..2e72636da 100644 --- a/prody/tests/dynamics/test_enms.py +++ b/prody/tests/dynamics/test_enms.py @@ -6,7 +6,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody import * from prody import LOGGER diff --git a/prody/tests/dynamics/test_pca.py b/prody/tests/dynamics/test_pca.py index 7720e3274..9a3fc5822 100644 --- a/prody/tests/dynamics/test_pca.py +++ b/prody/tests/dynamics/test_pca.py @@ -6,7 +6,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody import * from prody import LOGGER diff --git a/prody/tests/proteins/test_ciffile.py b/prody/tests/proteins/test_ciffile.py index 1c768c117..2f168dd99 100644 --- a/prody/tests/proteins/test_ciffile.py +++ b/prody/tests/proteins/test_ciffile.py @@ -7,7 +7,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody import * from prody import LOGGER diff --git a/prody/tests/proteins/test_dssp.py b/prody/tests/proteins/test_dssp.py index 08700131c..11cf7bc4a 100644 --- a/prody/tests/proteins/test_dssp.py +++ b/prody/tests/proteins/test_dssp.py @@ -4,7 +4,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody import * from prody import LOGGER diff --git a/prody/tests/proteins/test_localpdb.py b/prody/tests/proteins/test_localpdb.py index 1d70f3dcd..9e8d4ec27 100644 --- a/prody/tests/proteins/test_localpdb.py +++ b/prody/tests/proteins/test_localpdb.py @@ -7,7 +7,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody import * from prody import LOGGER diff --git a/prody/tests/proteins/test_pdbfile.py b/prody/tests/proteins/test_pdbfile.py index 3f34f453a..dd9a8730b 100644 --- a/prody/tests/proteins/test_pdbfile.py +++ b/prody/tests/proteins/test_pdbfile.py @@ -7,7 +7,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody import * from prody import LOGGER diff --git a/prody/tests/proteins/test_wwpdb.py b/prody/tests/proteins/test_wwpdb.py index 8dd63fdb2..2b6c7df10 100644 --- a/prody/tests/proteins/test_wwpdb.py +++ b/prody/tests/proteins/test_wwpdb.py @@ -6,7 +6,10 @@ try: import numpy.testing.decorators as dec except ImportError: - from numpy.testing import dec + try: + from numpy.testing import dec + except ImportError: + from pytest import mark as dec from prody import * from prody import LOGGER From 41df3d4c4d709e162a5cce36d02981b0dd338f7b Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 5 Oct 2023 12:17:52 +0200 Subject: [PATCH 08/19] actually fix import dec and put it once in utilities function --- prody/tests/apps/test_prody_anm.py | 9 ++------- prody/tests/apps/test_prody_catdcd.py | 10 +++------- prody/tests/apps/test_prody_examples.py | 10 +++------- prody/tests/apps/test_prody_gnm.py | 10 +++------- prody/tests/apps/test_prody_pca.py | 10 +++------- prody/tests/atomic/test_select.py | 10 +++------- prody/tests/dynamics/test_enms.py | 10 +++------- prody/tests/dynamics/test_pca.py | 10 +++------- prody/tests/proteins/test_ciffile.py | 10 +++------- prody/tests/proteins/test_dssp.py | 10 +++------- prody/tests/proteins/test_localpdb.py | 10 +++------- prody/tests/proteins/test_pdbfile.py | 10 +++------- prody/tests/proteins/test_wwpdb.py | 10 +++------- prody/utilities/misctools.py | 17 ++++++++++++++++- 14 files changed, 54 insertions(+), 92 deletions(-) diff --git a/prody/tests/apps/test_prody_anm.py b/prody/tests/apps/test_prody_anm.py index 99ed75b9f..54011f913 100644 --- a/prody/tests/apps/test_prody_anm.py +++ b/prody/tests/apps/test_prody_anm.py @@ -5,13 +5,8 @@ from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec +from prody.utilities import importDec +dec = importDec() from prody.tests.datafiles import TEMPDIR, pathDatafile diff --git a/prody/tests/apps/test_prody_catdcd.py b/prody/tests/apps/test_prody_catdcd.py index b62462c27..c6ae93178 100644 --- a/prody/tests/apps/test_prody_catdcd.py +++ b/prody/tests/apps/test_prody_catdcd.py @@ -4,13 +4,9 @@ from prody.tests import TestCase, skipIf, skipUnless from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec + +from prody.utilities import importDec +dec = importDec() from prody import parsePDB, DCDFile, parseDCD diff --git a/prody/tests/apps/test_prody_examples.py b/prody/tests/apps/test_prody_examples.py index 5a122b144..6b669d7be 100644 --- a/prody/tests/apps/test_prody_examples.py +++ b/prody/tests/apps/test_prody_examples.py @@ -6,13 +6,9 @@ from subprocess import Popen, PIPE from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec + +from prody.utilities import importDec +dec = importDec() from prody import LOGGER LOGGER.verbosity = None diff --git a/prody/tests/apps/test_prody_gnm.py b/prody/tests/apps/test_prody_gnm.py index 26fe005b9..ba50fce9d 100644 --- a/prody/tests/apps/test_prody_gnm.py +++ b/prody/tests/apps/test_prody_gnm.py @@ -4,13 +4,9 @@ from prody.tests import TestCase, skipIf, skipUnless from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec + +from prody.utilities import importDec +dec = importDec() from prody.tests.datafiles import TEMPDIR, pathDatafile diff --git a/prody/tests/apps/test_prody_pca.py b/prody/tests/apps/test_prody_pca.py index bdd28611c..5b1bddffb 100644 --- a/prody/tests/apps/test_prody_pca.py +++ b/prody/tests/apps/test_prody_pca.py @@ -4,13 +4,9 @@ from prody.tests import TestCase, skipIf, skipUnless from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec + +from prody.utilities import importDec +dec = importDec() from prody.tests.datafiles import TEMPDIR, pathDatafile diff --git a/prody/tests/atomic/test_select.py b/prody/tests/atomic/test_select.py index f76239105..70c685003 100644 --- a/prody/tests/atomic/test_select.py +++ b/prody/tests/atomic/test_select.py @@ -5,13 +5,6 @@ import inspect import numpy as np from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec from prody import * from prody import LOGGER @@ -19,6 +12,9 @@ from prody.tests.datafiles import * from prody.atomic.atommap import DUMMY +from prody.utilities import importDec +dec = importDec() + prody.atomic.select.DEBUG = False LOGGER.verbosity = 'none' diff --git a/prody/tests/dynamics/test_enms.py b/prody/tests/dynamics/test_enms.py index 2e72636da..cb9a602b9 100644 --- a/prody/tests/dynamics/test_enms.py +++ b/prody/tests/dynamics/test_enms.py @@ -3,13 +3,9 @@ import numpy as np from numpy import arange from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec + +from prody.utilities import importDec +dec = importDec() from prody import * from prody import LOGGER diff --git a/prody/tests/dynamics/test_pca.py b/prody/tests/dynamics/test_pca.py index 9a3fc5822..d58e0fc19 100644 --- a/prody/tests/dynamics/test_pca.py +++ b/prody/tests/dynamics/test_pca.py @@ -3,13 +3,9 @@ import numpy as np from numpy import arange from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec + +from prody.utilities import importDec +dec = importDec() from prody import * from prody import LOGGER diff --git a/prody/tests/proteins/test_ciffile.py b/prody/tests/proteins/test_ciffile.py index 2f168dd99..15b020c57 100644 --- a/prody/tests/proteins/test_ciffile.py +++ b/prody/tests/proteins/test_ciffile.py @@ -4,13 +4,9 @@ import numpy as np from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec + +from prody.utilities import importDec +dec = importDec() from prody import * from prody import LOGGER diff --git a/prody/tests/proteins/test_dssp.py b/prody/tests/proteins/test_dssp.py index 11cf7bc4a..6fd30b332 100644 --- a/prody/tests/proteins/test_dssp.py +++ b/prody/tests/proteins/test_dssp.py @@ -1,13 +1,9 @@ """This module contains unit tests for :mod:`~prody.proteins`.""" from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec + +from prody.utilities import importDec +dec = importDec() from prody import * from prody import LOGGER diff --git a/prody/tests/proteins/test_localpdb.py b/prody/tests/proteins/test_localpdb.py index 9e8d4ec27..7b087d572 100644 --- a/prody/tests/proteins/test_localpdb.py +++ b/prody/tests/proteins/test_localpdb.py @@ -4,13 +4,9 @@ import numpy as np from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec + +from prody.utilities import importDec +dec = importDec() from prody import * from prody import LOGGER diff --git a/prody/tests/proteins/test_pdbfile.py b/prody/tests/proteins/test_pdbfile.py index dd9a8730b..c7e5ea9fa 100644 --- a/prody/tests/proteins/test_pdbfile.py +++ b/prody/tests/proteins/test_pdbfile.py @@ -4,13 +4,9 @@ import numpy as np from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec + +from prody.utilities import importDec +dec = importDec() from prody import * from prody import LOGGER diff --git a/prody/tests/proteins/test_wwpdb.py b/prody/tests/proteins/test_wwpdb.py index 2b6c7df10..a6657f635 100644 --- a/prody/tests/proteins/test_wwpdb.py +++ b/prody/tests/proteins/test_wwpdb.py @@ -3,13 +3,9 @@ import os from numpy.testing import * -try: - import numpy.testing.decorators as dec -except ImportError: - try: - from numpy.testing import dec - except ImportError: - from pytest import mark as dec + +from prody.utilities import importDec +dec = importDec() from prody import * from prody import LOGGER diff --git a/prody/utilities/misctools.py b/prody/utilities/misctools.py index 20b7ef6fa..e72484771 100644 --- a/prody/utilities/misctools.py +++ b/prody/utilities/misctools.py @@ -21,7 +21,8 @@ 'getDataPath', 'openData', 'chr2', 'toChararray', 'interpY', 'cmp', 'pystr', 'getValue', 'indentElement', 'isPDB', 'isURL', 'isListLike', 'isSymmetric', 'makeSymmetric', 'getDistance', 'fastin', 'createStringIO', 'div0', 'wmean', 'bin2dec', 'wrapModes', - 'fixArraySize', 'decToHybrid36', 'hybrid36ToDec', 'DTYPE', 'checkIdentifiers', 'split', 'mad'] + 'fixArraySize', 'decToHybrid36', 'hybrid36ToDec', 'DTYPE', 'checkIdentifiers', 'split', 'mad', + 'importDec'] DTYPE = array(['a']).dtype.char # 'S' for PY2K and 'U' for PY3K CURSORS = [] @@ -784,3 +785,17 @@ def _mad(x): return median(abs(x - med)) return _mad(x) + + +def importDec(): + """Returns one of :mod:`scipy.linalg` or :mod:`numpy.linalg`.""" + + try: + import numpy.testing.decorators as dec + except ImportError: + try: + from numpy.testing import dec + except ImportError: + import numpy.testing._private.decorators as dec + + return dec From 47c1fefaf29f3d09d251acf316d785340ee0d960 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 5 Oct 2023 12:23:55 +0200 Subject: [PATCH 09/19] fix missed dec in test_msafile --- prody/tests/sequence/test_msafile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/prody/tests/sequence/test_msafile.py b/prody/tests/sequence/test_msafile.py index cc80b9764..aae1015d8 100644 --- a/prody/tests/sequence/test_msafile.py +++ b/prody/tests/sequence/test_msafile.py @@ -5,12 +5,13 @@ from os.path import join from numpy import array, log, zeros, char -from numpy.testing import assert_array_equal, dec +from numpy.testing import assert_array_equal from prody.tests.datafiles import * from prody.tests import TEMPDIR from prody import MSA, MSAFile, parseMSA, LOGGER, writeMSA -from prody.utilities import createStringIO +from prody.utilities import createStringIO, importDec +dec = importDec() LOGGER.verbosity = None From 3b6092ec07cc626f6f501cde82a87dc506ba8885 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 5 Oct 2023 12:47:49 +0200 Subject: [PATCH 10/19] restrict numpy <1.26 --- pyproject.toml | 2 +- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3140fa577..477ad58b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,2 @@ [build-system] -requires = ["setuptools", "wheel", "numpy>=1.10", "pyparsing", "scipy"] +requires = ["setuptools", "wheel", "numpy>=1.10,<1.26", "pyparsing", "scipy"] diff --git a/setup.py b/setup.py index 99e03a3bb..a118e6ab8 100644 --- a/setup.py +++ b/setup.py @@ -12,9 +12,9 @@ sys.exit() if sys.version_info[:2] == (2, 7) or sys.version_info[:2] <= (3, 5): - INSTALL_REQUIRES=['numpy>=1.10', 'biopython<=1.76', 'pyparsing', 'scipy'] + INSTALL_REQUIRES=['numpy>=1.10,<1.26', 'biopython<=1.76', 'pyparsing', 'scipy'] else: - INSTALL_REQUIRES=['numpy>=1.10', 'biopython<=1.79', 'pyparsing', 'scipy', 'setuptools'] + INSTALL_REQUIRES=['numpy>=1.10,<1.26', 'biopython<=1.79', 'pyparsing', 'scipy', 'setuptools'] if sys.version_info[0] == 3: if sys.version_info[1] < 6: From fc181e1a7cacc4f13f7f2214751000de15d48f2a Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 5 Oct 2023 13:05:06 +0200 Subject: [PATCH 11/19] restrict numpy <1.25 --- pyproject.toml | 2 +- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 477ad58b3..853b7bc35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,2 @@ [build-system] -requires = ["setuptools", "wheel", "numpy>=1.10,<1.26", "pyparsing", "scipy"] +requires = ["setuptools", "wheel", "numpy>=1.10,<1.25", "pyparsing", "scipy"] diff --git a/setup.py b/setup.py index a118e6ab8..b9d566854 100644 --- a/setup.py +++ b/setup.py @@ -12,9 +12,9 @@ sys.exit() if sys.version_info[:2] == (2, 7) or sys.version_info[:2] <= (3, 5): - INSTALL_REQUIRES=['numpy>=1.10,<1.26', 'biopython<=1.76', 'pyparsing', 'scipy'] + INSTALL_REQUIRES=['numpy>=1.10,<1.25', 'biopython<=1.76', 'pyparsing', 'scipy'] else: - INSTALL_REQUIRES=['numpy>=1.10,<1.26', 'biopython<=1.79', 'pyparsing', 'scipy', 'setuptools'] + INSTALL_REQUIRES=['numpy>=1.10,<1.25', 'biopython<=1.79', 'pyparsing', 'scipy', 'setuptools'] if sys.version_info[0] == 3: if sys.version_info[1] < 6: From 407f755aef83a27e1c7ad8fefb699aef8fa7eb61 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 5 Oct 2023 13:17:02 +0200 Subject: [PATCH 12/19] include pytest mark as option for dec --- prody/utilities/misctools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/prody/utilities/misctools.py b/prody/utilities/misctools.py index e72484771..47a399717 100644 --- a/prody/utilities/misctools.py +++ b/prody/utilities/misctools.py @@ -796,6 +796,9 @@ def importDec(): try: from numpy.testing import dec except ImportError: - import numpy.testing._private.decorators as dec + try: + import numpy.testing._private.decorators as dec + except ImportError: + from pytest import mark as dec return dec From 1e52400a6bc761a253d7805ee43118ca9854cd7e Mon Sep 17 00:00:00 2001 From: James Krieger Date: Wed, 14 Feb 2024 12:40:07 -0500 Subject: [PATCH 13/19] fix insty test saving --- prody/tests/proteins/test_insty.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index 50648abec..0fd6a47ac 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -35,25 +35,25 @@ def setUp(self): np.save('test_2k39_all.npy', self.data_all, allow_pickle=True) self.data_hbs = calcHydrogenBondsTrajectory(self.ATOMS) - np.save('test_2k39_hbs.npy', self.data_hbs, allow_pickle=True) + np.save('test_2k39_hbs.npy', np.array(self.data_hbs, dtype=object), allow_pickle=True) self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS) - np.save('test_2k39_sbs.npy', self.data_sbs, allow_pickle=True) + np.save('test_2k39_sbs.npy', np.array(self.data_sbs, dtype=object), allow_pickle=True) self.data_rib = calcRepulsiveIonicBondingTrajectory(self.ATOMS) - np.save('test_2k39_rib.npy', self.data_rib, allow_pickle=True) + np.save('test_2k39_rib.npy', np.array(self.data_rib, dtype=object), allow_pickle=True) self.data_PiStack = calcPiStackingTrajectory(self.ATOMS) - np.save('test_2k39_PiStack.npy', self.data_PiStack, allow_pickle=True) + np.save('test_2k39_PiStack.npy', np.array(self.data_PiStack, dtype=object), allow_pickle=True) self.data_PiCat = calcPiCationTrajectory(self.ATOMS) - np.save('test_2k39_PiCat.npy', self.data_PiCat, allow_pickle=True) + np.save('test_2k39_PiCat.npy', np.array(self.data_PiCat, dtype=object), allow_pickle=True) self.data_hph = calcHydrophobicTrajectory(self.ATOMS) - np.save('test_2k39_hph.npy', self.data_hph, allow_pickle=True) + np.save('test_2k39_hph.npy', np.array(self.data_hph, dtype=object), allow_pickle=True) self.data_disu = calcDisulfideBondsTrajectory(self.ATOMS) - np.save('test_2k39_disu.npy', self.data_disu, allow_pickle=True) + np.save('test_2k39_disu.npy', np.array(self.data_disu, dtype=object), allow_pickle=True) def testAllInsteractions(self): """Test for all types of interactions.""" From 82529e90f8a43a7bedbaa0327b050c11610f745b Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 15 Mar 2024 10:39:20 +0100 Subject: [PATCH 14/19] limit pyparsing<=3.1.1 --- .github/workflows/main.yml | 2 +- PKG-INFO | 4 ++-- pyproject.toml | 2 +- setup.py | 9 ++++----- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e5dbe065f..5a2924165 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,7 @@ jobs: if [[ ${{ matrix.python-version }} != "2.7" ]]; then conda config --add channels conda-forge; fi conda create --yes -n test python=${{ matrix.python-version }} source activate test - conda install --yes numpy scipy nose pyparsing requests + conda install --yes numpy scipy nose pyparsing<=3.1.1 requests if [[ ${{ matrix.python-version }} == "2.7" ]]; then conda install --yes unittest2; else conda install --yes pdbfixer; fi pip install mmtf-python scikit-learn pip install . diff --git a/PKG-INFO b/PKG-INFO index 6e9b73d1f..5f1719fe6 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -92,7 +92,7 @@ Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Scientific/Engineering :: Bio-Informatics Classifier: Topic :: Scientific/Engineering :: Chemistry Requires: numpy (>=1.10) -Requires: pyparsing +Requires: pyparsing (<=3.1.1) Requires: biopython Requires: scipy -Provides: prody (2.1.2) +Provides: prody diff --git a/pyproject.toml b/pyproject.toml index 23456bfd3..146e85d9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,2 @@ [build-system] -requires = ["setuptools", "wheel", "numpy>=1.10,<1.24", "pyparsing", "scipy"] +requires = ["setuptools", "wheel", "numpy>=1.10,<1.24", "pyparsing<=3.1.1", "scipy"] diff --git a/setup.py b/setup.py index 47f62d6b8..0c457f33f 100644 --- a/setup.py +++ b/setup.py @@ -14,12 +14,11 @@ if sys.version_info[:2] == (2, 7) or sys.version_info[:2] <= (3, 5): INSTALL_REQUIRES=['numpy>=1.10,<1.24', 'biopython<=1.76', 'pyparsing', 'scipy'] else: - INSTALL_REQUIRES=['numpy>=1.10,<1.24', 'biopython', 'pyparsing', 'scipy', 'setuptools'] + INSTALL_REQUIRES=['numpy>=1.10,<1.24', 'biopython', 'pyparsing<=3.1.1', 'scipy', 'setuptools'] -if sys.version_info[0] == 3: - if sys.version_info[1] < 6: - sys.stderr.write('Python 3.5 and older is not supported\n') - sys.exit() +if sys.version_info[0] == 3 and sys.version_info[1] < 6: + sys.stderr.write('Python 3.5 and older is not supported\n') + sys.exit() if os.name == 'java': sys.stderr.write('JavaOS is not supported\n') From aef076474193fb17b98b9fbef4848463b26abc77 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 15 Mar 2024 10:41:37 +0100 Subject: [PATCH 15/19] add py311 to actions --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a2924165..a528a6a7a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["2.7", "3.8", "3.9", "3.10"] + python-version: ["2.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v2 From 4efaff6f5fa2708eb1edd8ddde901d20428cb8a5 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 15 Mar 2024 10:45:00 +0100 Subject: [PATCH 16/19] Revert "fix pfam test for pfam changes" This reverts commit 052b291b1b0738172fcf3302400aebde4c4bc95d. --- prody/tests/database/test_pfam.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/prody/tests/database/test_pfam.py b/prody/tests/database/test_pfam.py index 46adbf1f5..128473154 100644 --- a/prody/tests/database/test_pfam.py +++ b/prody/tests/database/test_pfam.py @@ -36,8 +36,9 @@ def testUniprotAccMulti(self): self.assertIsInstance(a, dict, 'searchPfam failed to return a dict instance') - self.assertEqual(sorted(list(a.keys()))[:2], ['PF00060', 'PF00497'], - 'searchPfam failed to return the right domain family IDs') + self.assertEqual(sorted(list(a.keys())), + ['PF00060', 'PF00497', 'PF01094', 'PF10613'], + 'searchPfam failed to return the right domain family IDs') def testPdbIdChMulti(self): """Test the outcome of a simple search scenario using a PDB ID @@ -48,7 +49,7 @@ def testPdbIdChMulti(self): self.assertIsInstance(a, dict, 'searchPfam failed to return a dict instance') - self.assertEqual(sorted(list(a.keys()))[:2], ['PF00060', 'PF00497'], + self.assertEqual(sorted(list(a.keys())), ['PF00060', 'PF00497', 'PF01094', 'PF10613'], 'searchPfam failed to return the right domain family IDs for AMPAR') def testPdbIdChSingle(self): From 2c73eaef0272deee019ed2f1637ef708649e4724 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 15 Mar 2024 10:49:01 +0100 Subject: [PATCH 17/19] remove pyparsing from actions conda install --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a528a6a7a..0a6b4f051 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,7 @@ jobs: if [[ ${{ matrix.python-version }} != "2.7" ]]; then conda config --add channels conda-forge; fi conda create --yes -n test python=${{ matrix.python-version }} source activate test - conda install --yes numpy scipy nose pyparsing<=3.1.1 requests + conda install --yes numpy scipy nose requests if [[ ${{ matrix.python-version }} == "2.7" ]]; then conda install --yes unittest2; else conda install --yes pdbfixer; fi pip install mmtf-python scikit-learn pip install . From 7ab6a06c4deb137a1e17cdbbaa679d208372af61 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 15 Mar 2024 12:03:15 +0100 Subject: [PATCH 18/19] no pfam test revert --- prody/tests/database/test_pfam.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/prody/tests/database/test_pfam.py b/prody/tests/database/test_pfam.py index 128473154..a255aaf16 100644 --- a/prody/tests/database/test_pfam.py +++ b/prody/tests/database/test_pfam.py @@ -36,8 +36,7 @@ def testUniprotAccMulti(self): self.assertIsInstance(a, dict, 'searchPfam failed to return a dict instance') - self.assertEqual(sorted(list(a.keys())), - ['PF00060', 'PF00497', 'PF01094', 'PF10613'], + self.assertEqual(sorted(list(a.keys()))[:2], ['PF00060', 'PF00497'], 'searchPfam failed to return the right domain family IDs') def testPdbIdChMulti(self): @@ -49,7 +48,7 @@ def testPdbIdChMulti(self): self.assertIsInstance(a, dict, 'searchPfam failed to return a dict instance') - self.assertEqual(sorted(list(a.keys())), ['PF00060', 'PF00497', 'PF01094', 'PF10613'], + self.assertEqual(sorted(list(a.keys()))[:2], ['PF00060', 'PF00497'], 'searchPfam failed to return the right domain family IDs for AMPAR') def testPdbIdChSingle(self): From afadd25bb634a5465f65daf0c2d938d6f27a8a09 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 15 Mar 2024 18:04:57 +0100 Subject: [PATCH 19/19] tostring to tobytes --- prody/sequence/msa.py | 6 +++--- prody/sequence/msafile.py | 2 +- prody/sequence/sequence.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/prody/sequence/msa.py b/prody/sequence/msa.py index f4bc3d5c6..5de2eb85d 100644 --- a/prody/sequence/msa.py +++ b/prody/sequence/msa.py @@ -154,7 +154,7 @@ def __getitem__(self, index): if isinstance(rows, list): rows = self.getIndex(rows) or rows elif isinstance(rows, int): - return Sequence(self._msa[rows, cols].tostring(), + return Sequence(self._msa[rows, cols].tobytes(), self._labels[rows]) elif isinstance(rows, str): try: @@ -164,7 +164,7 @@ def __getitem__(self, index): .format(index)) else: if isinstance(rows, int): - return Sequence(self._msa[rows, cols].tostring(), + return Sequence(self._msa[rows, cols].tobytes(), self._labels[rows]) if cols is None: @@ -546,7 +546,7 @@ def refineMSA(msa, index=None, label=None, rowocc=None, seqid=None, colocc=None, from prody.utilities import GAP_PENALTY, GAP_EXT_PENALTY, ALIGNMENT_METHOD chseq = chain.getSequence() - algn = alignBioPairwise(pystr(arr[index].tostring().upper()), pystr(chseq), + algn = alignBioPairwise(pystr(arr[index].tobytes().upper()), pystr(chseq), "local", MATCH_SCORE, MISMATCH_SCORE, GAP_PENALTY, GAP_EXT_PENALTY, diff --git a/prody/sequence/msafile.py b/prody/sequence/msafile.py index c665b9146..8719e6bad 100644 --- a/prody/sequence/msafile.py +++ b/prody/sequence/msafile.py @@ -433,7 +433,7 @@ def setSlice(self, slice): else: self._slice = slice self._slicer = lambda seq, slc=slice: fromstring(seq, - '|S1')[slc].tostring() + '|S1')[slc].tobytes() else: self._slice = slice self._slicer = lambda seq, slc=slice: seq[slc] diff --git a/prody/sequence/sequence.py b/prody/sequence/sequence.py index c8477313b..6cc78b206 100644 --- a/prody/sequence/sequence.py +++ b/prody/sequence/sequence.py @@ -49,9 +49,9 @@ def _array(self): def __str__(self): if PY3K: - return self._array.tostring().decode() + return self._array.tobytes().decode() else: - return self._array.tostring() + return self._array.tobytes() def __len__(self):