From 4ce52b58fd09505d0917bb9d1616245c6aabcf5c Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Wed, 23 Oct 2019 19:14:49 +0200 Subject: [PATCH] Allow to choose remote repository if remote=True in io.LoadPDB --- modules/io/pymod/__init__.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/modules/io/pymod/__init__.py b/modules/io/pymod/__init__.py index 98d952269..2a8232118 100644 --- a/modules/io/pymod/__init__.py +++ b/modules/io/pymod/__init__.py @@ -65,8 +65,8 @@ def _override(val1, val2): def LoadPDB(filename, restrict_chains="", no_hetatms=None, fault_tolerant=None, load_multi=False, quack_mode=None, join_spread_atom_records=None, calpha_only=None, - profile='DEFAULT', remote=False, dialect=None, - seqres=False, bond_feasibility_check=None): + profile='DEFAULT', remote=False, remote_repo='pdb', + dialect=None, seqres=False, bond_feasibility_check=None): """ Load PDB file from disk and return one or more entities. Several options allow to customize the exact behaviour of the PDB import. For more information @@ -90,8 +90,16 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=None, :attr:`IOProfile.join_spread_atom_records`. :param remote: If set to True, the method tries to load the pdb from the - remote pdb repository www.pdb.org. The filename is then interpreted as the - pdb id. + remote repository given as *remote_repo*. The filename is then + interpreted as the entry id as further specified for the *remote_repo* + parameter. + + :param remote_repo: Remote repository to fetch structure if *remote* is True. + Must be one in ['pdb', 'smtl', 'pdb_redo']. In case of + 'pdb' and 'pdb_redo', the entry must be given as lower + case pdb id, which loads the deposited assymetric unit + (e.g. '1ake'). In case of 'smtl', the entry must also + specify the desired biounit (e.g. '1ake.1'). :rtype: :class:`~ost.mol.EntityHandle` or a list thereof if `load_multi` is True. @@ -135,8 +143,10 @@ def LoadPDB(filename, restrict_chains="", no_hetatms=None, tmp_file = None # avoid getting out of scope if remote: + if remote_repo not in ['pdb', 'smtl', 'pdb_redo']: + raise IOError("remote_repo must be in ['pdb', 'smtl', 'pdb_redo']") from ost.io.remote import RemoteGet - tmp_file =RemoteGet(filename) + tmp_file =RemoteGet(filename, from_repo=remote_repo) filename = tmp_file.name conop_inst=conop.Conopology.Instance() -- GitLab