[med-svn] [Git][med-team/plip][upstream] New upstream version 2.1.7+dfsg
Nilesh Patra
gitlab at salsa.debian.org
Fri Dec 18 21:25:59 GMT 2020
Nilesh Patra pushed to branch upstream at Debian Med / plip
Commits:
393877e4 by Nilesh Patra at 2020-12-19T02:53:32+05:30
New upstream version 2.1.7+dfsg
- - - - -
6 changed files:
- plip/basic/supplemental.py
- plip/plipcmd.py
- plip/structure/preparation.py
- plip/test/test_structure_processing.py
- + plip/test/test_visualization.py
- plip/visualization/visualize.py
Changes:
=====================================
plip/basic/supplemental.py
=====================================
@@ -1,7 +1,6 @@
import gzip
import itertools
import os
-import platform
import re
import subprocess
import sys
@@ -17,14 +16,6 @@ from plip.basic import config, logger
logger = logger.get_logger()
-# Windows and MacOS
-if os.name != 'nt' and platform.system() != 'Darwin': # Resource module not available for Windows
- import resource
-
-# Settings
-np.seterr(all='ignore') # No runtime warnings
-
-
def tmpfile(prefix, direc):
"""Returns the path to a newly created temporary file."""
return tempfile.mktemp(prefix=prefix, suffix='.pdb', dir=direc)
@@ -378,10 +369,6 @@ def int32_to_negative(int32):
def read_pdb(pdbfname, as_string=False):
"""Reads a given PDB file and returns a Pybel Molecule."""
pybel.ob.obErrorLog.StopLogging() # Suppress all OpenBabel warnings
- if os.name != 'nt': # Resource module not available for Windows
- maxsize = resource.getrlimit(resource.RLIMIT_STACK)[-1]
- resource.setrlimit(resource.RLIMIT_STACK, (min(2 ** 28, maxsize), maxsize))
- sys.setrecursionlimit(10 ** 5) # increase Python recursion limit
return readmol(pdbfname, as_string=as_string)
=====================================
plip/plipcmd.py
=====================================
@@ -225,9 +225,8 @@ def main():
parser.add_argument("--nohydro", dest="nohydro", default=False,
help="Do not add polar hydrogens in case your structure already contains hydrogens.",
action="store_true")
- parser.add_argument("--model", dest="model", default=1,
- help="Model number to be used for multi-model structures.",
- action="store_true")
+ parser.add_argument("--model", dest="model", default=1, type=int,
+ help="Model number to be used for multi-model structures.")
# Optional threshold arguments, not shown in help
thr = namedtuple('threshold', 'name type')
thresholds = [thr(name='aromatic_planarity', type='angle'),
=====================================
plip/structure/preparation.py
=====================================
@@ -63,6 +63,8 @@ class PDBParser:
corrected_line, newnum = self.fix_pdbline(line, lastnum)
if corrected_line is not None:
if corrected_line.startswith('MODEL'):
+ # reset atom number when new model is encountered
+ lastnum = 0
try: # Get number of MODEL (1,2,3)
model_num = int(corrected_line[10:14])
# initialize storage for new model
@@ -72,7 +74,8 @@ class PDBParser:
other_models = True
except ValueError:
logger.debug(f'ignoring invalid MODEL entry: {corrected_line}')
- lastnum = newnum
+ else:
+ lastnum = newnum
model_dict[current_model].append(corrected_line)
# select model
try:
=====================================
plip/test/test_structure_processing.py
=====================================
@@ -22,10 +22,10 @@ class StructureProcessingTestCase(unittest.TestCase):
all_hbonds = interactions.hbonds_ldon + interactions.hbonds_pdon
all_hydrogen_bonds.add(len(all_hbonds))
# models contain from 0-2 hydrogen bonds
- self.assertEquals(all_hydrogen_bonds, {0, 1, 2})
+ self.assertEqual(all_hydrogen_bonds, {0, 1, 2})
def test_nmr_invalid_model(self):
config.MODEL = 11
interactions = characterize_complex('./pdb/2ndo.pdb', 'SFQ:A:201')
all_hbonds = interactions.hbonds_ldon + interactions.hbonds_pdon
- self.assertEquals(len(all_hbonds), 1)
+ self.assertEqual(len(all_hbonds), 1)
=====================================
plip/test/test_visualization.py
=====================================
@@ -0,0 +1,31 @@
+import os
+import tempfile
+import unittest
+
+from plip.basic import config
+from plip.basic.remote import VisualizerData
+from plip.structure.preparation import PDBComplex
+from plip.visualization.visualize import visualize_in_pymol
+
+
+class VisualizationTest(unittest.TestCase):
+
+ def setUp(self) -> None:
+ self.tmp_dir = tempfile.mkdtemp()
+
+ def test_visualization(self) -> None:
+
+ pdb_file = './pdb/2ndo.pdb'
+ binding_site_id = 'SFQ:A:201'
+ config.PYMOL = True
+ config.MODEL = 2
+ config.OUTPATH = str(self.tmp_dir)
+ pdb_complex = PDBComplex()
+ pdb_complex.load_pdb(pdb_file)
+ for ligand in pdb_complex.ligands:
+ if ':'.join([ligand.hetid, ligand.chain, str(ligand.position)]) == binding_site_id:
+ pdb_complex.characterize_complex(ligand)
+ visualizer_complexes = [VisualizerData(pdb_complex, site) for site in sorted(pdb_complex.interaction_sets) if
+ not len(pdb_complex.interaction_sets[site].interacting_res) == 0]
+ visualize_in_pymol(visualizer_complexes[0])
+ self.assertEqual(1, len(os.listdir(self.tmp_dir)))
=====================================
plip/visualization/visualize.py
=====================================
@@ -8,7 +8,7 @@ logger = logger.get_logger()
def visualize_in_pymol(plcomplex):
- """Visualizes the protein-ligand pliprofiler at one site in PyMOL."""
+ """Visualizes the given Protein-Ligand complex at one site in PyMOL."""
vis = PyMOLVisualizer(plcomplex)
@@ -39,7 +39,8 @@ def visualize_in_pymol(plcomplex):
cmd.load(plcomplex.sourcefile)
current_name = cmd.get_object_list(selection='(all)')[0]
- logger.debug(f'setting current_name to {current_name} and pdbid to {pdbid}')
+
+ logger.debug(f'setting current_name to {current_name} and PDB-ID to {pdbid}')
cmd.set_name(current_name, pdbid)
cmd.hide('everything', 'all')
if config.PEPTIDES:
View it on GitLab: https://salsa.debian.org/med-team/plip/-/commit/393877e4a916749d393f71c0b38cd402d1990976
--
View it on GitLab: https://salsa.debian.org/med-team/plip/-/commit/393877e4a916749d393f71c0b38cd402d1990976
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/20201218/3d58d4bf/attachment-0001.html>
More information about the debian-med-commit
mailing list