schrodinger.protein.getpdb_utility module

Copy a PDB file out of the PDB directory, or, if not found, download it from the rcsb repository: https://rcsb.org/.

Note: the location of the PDB directory can be specified via environment variables; the order of precedence is:

  • SCHRODINGER_PDB
  • SCHRODINGER_THIRDPARTY
  • SCHRODINGER/thirdparty (the default)

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.protein.getpdb_utility.parse_arguments(args)
class schrodinger.protein.getpdb_utility.WholePDB(code)

Bases: object

Class to take care of the file work for entire PDB files.

__init__(code)

Create a WholePDB object.

Parameters:code (str) – the PDB code for this file
openFile(web)
write(line)

If we are writing a file, add this line to it.

Parameters:line (str) – The line to add to the file
closeFile()

Close the file if it is open

checkOK()

This is just a stub routine for compatibility with the Chain class

Return type:bool
Returns:True
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.getpdb_utility', '__doc__': '\n Class to take care of the file work for entire PDB files.\n ', '__init__': <function WholePDB.__init__>, 'openFile': <function WholePDB.openFile>, 'write': <function WholePDB.write>, 'closeFile': <function WholePDB.closeFile>, 'checkOK': <function WholePDB.checkOK>, '__dict__': <attribute '__dict__' of 'WholePDB' objects>, '__weakref__': <attribute '__weakref__' of 'WholePDB' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.protein.getpdb_utility'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.protein.getpdb_utility.Chain(name, code, debug=False)

Bases: object

Class to handle splitting a chain out of a PDB file.

__init__(name, code, debug=False)

Create a Chain object.

Parameters:
  • code (str) – The PDB code of the parent PDB file
  • name (1 character string) – the Chain ID to extract
openFile(web)
write(line)

Write a line to the chain file if it applies to this chain.

Parameters:line (str) – the current line of the PDB file.
checkOK()

Check to see if everything went OK writing the file.

Return type:bool
Returns:True if everything checks out OK, false if not
closeFile()

Add the END tag and close the chain file

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.getpdb_utility', '__doc__': '\n Class to handle splitting a chain out of a PDB file.\n ', '__init__': <function Chain.__init__>, 'openFile': <function Chain.openFile>, 'write': <function Chain.write>, 'checkOK': <function Chain.checkOK>, 'closeFile': <function Chain.closeFile>, '__dict__': <attribute '__dict__' of 'Chain' objects>, '__weakref__': <attribute '__weakref__' of 'Chain' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.protein.getpdb_utility'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

class schrodinger.protein.getpdb_utility.Code(code, debug=False)

Bases: object

Class to handle all the various files for each PDB code.

__init__(code, debug=False)

Create a Code object.

Parameters:code (str) – the 4-letter PDB code
addChain(chain)

Add another Chain ID to be extracted from the parent file.

Parameters:chain (1 character string or None) – The Chain ID to be extracted. If chain is None, then the whole PDB file is desired.
sidechains()

Check if any chains are to be extracted.

Return type:bool
Returns:True if any chains are to be extracted, False if not
wholePDB()

Returns True if the whole PDB file should be kept

findLocally(local_dirs)

Check a series of local directories and filenames for the PDB files.

First we look for current files ending in .gz or .Z, then obsolete files with the same endings. The file name we search for is:

pdbXXXX.ent.Y where XXXX is the PDB code and Y is either gz or Z

handleObsolete()

Print a warning if we are using a file from the obsolete directory

openFiles(web=False)

Prepare all the chain and whole PDB files for writing.

Parameters:web (bool) – True if the source file is from the web, False if not. In this case “from the web” means uncompressed and in the destination directory with the correct name.
write(line)

Write line to each of the appropriate files

Parameters:line (str) – the current line from the source PDB file.
checkOK()

Check to make sure all the files were written properly.

Return type:bool
Returns:True if all the files were written properly, False if there were any problems.
closeFiles()

Close all the files

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.protein.getpdb_utility', '__doc__': '\n Class to handle all the various files for each PDB code.\n ', '__init__': <function Code.__init__>, 'addChain': <function Code.addChain>, 'sidechains': <function Code.sidechains>, 'wholePDB': <function Code.wholePDB>, 'findLocally': <function Code.findLocally>, 'handleObsolete': <function Code.handleObsolete>, 'openFiles': <function Code.openFiles>, 'write': <function Code.write>, 'checkOK': <function Code.checkOK>, 'closeFiles': <function Code.closeFiles>, '__dict__': <attribute '__dict__' of 'Code' objects>, '__weakref__': <attribute '__weakref__' of 'Code' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.protein.getpdb_utility'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)

schrodinger.protein.getpdb_utility.invalid_code(acode)

Print a warning that a given code is invalid

schrodinger.protein.getpdb_utility.download_format(pdb_code, file_format, chain=None)

Attemps to download the file of requested format for the given given PDB ID and (optinally) chain.

Parameters:
  • pdb_code (str) – PDB ID of the file to download
  • file_format (str) – Format extention. One of: pdb, cif, xml, sf, fasta.
  • chain (str or None) – The chain name to download. If None, the file will contain all chains
schrodinger.protein.getpdb_utility.from_maestro(*args)
schrodinger.protein.getpdb_utility.main(args)