Package schrodinger :: Package protein :: Module getpdb
[hide private]
[frames] | no frames]

Module getpdb

Functions [hide private]
 
_temporarize_path(filename)
This function returns a path to a file in a temporary directory that is based on the specified file name.
 
set_opener(opener)
Public function to set an opener, this allows calling code to use a custom URL opener, for example one that will prompt for a password
 
import_pdb(pdb_code, biological_unit=False)
Import the PDB file into the Project Table, using download_pdb() to get the file if it doesn't already exist in the cwd.
 
download_sf(pdb_code)
Download the ENT file for the given PDB ID, converts it to CNS format, and returns the CNS file name.
 
download_fasta(pdb_code, chain=None)
Attemps to download the fasta file for the given PDB ID and chain.
 
get_pdb(pdbid, source=AUTO, caps_asis=False)
Attempts to get the specified PDB file from either the database or the web, depending on the source option.
 
retrieve_pdb(pdbid, local_repos=None, verbose=False, caps_asis=False)
Attempt to retrieve the PDB from the local repository
list of str
find_local_repository(verbose=False)
Determine a directory list for local repositories.
 
find_local_pdb(pdbid, local_repos=None, verbose=False, caps_asis=False)
Check a series of local directories and filenames for the PDB files.
 
download_pdb(pdb_code, biological_unit=False)
Download the pdb record from www.rcsb.org into the cwd.
 
download_file(pdb_code, pdb_file, url, biological_unit=False)
Download a file from a given url into the working directory.
 
get_entryimport_opts()
Returns a dictionary that describes the Maestro Import panel state.
 
set_entryimport_opts(entryimport_opts)
Assigns 'entryimport' option dictionary values.
 
import_file(file, format)
Imports a PDB format structure file into maestro, including all entries in the file into the workspace, then resets the entryimport options to the previous settings.
 
retrieve_ent(pdbid)
Retrieves the ENT file for the specified PDB ID from the third-party database and copies it to the CWD.
 
download_ent(pdbid)
Downloads the ENT file for the specified PDB ID from the RCSB web site, and saves it to the CWD.
 
get_ent(pdbid, source=AUTO)
Attempts to get the specified ENT file from either the database or the web, depending on the source option.
Variables [hide private]
  __doc__ = ...
  maestro = None
hash(x)
  _url_opener = None
hash(x)
Function Details [hide private]

import_pdb(pdb_code, biological_unit=False)

 

Import the PDB file into the Project Table, using download_pdb() to get the file if it doesn't already exist in the cwd.

Parameters:
  • pdb_code (string) - Four character alphanumeric string for the PDB id.
  • biological_unit (boolean) - If True, and the file needs to be downloaded, then download the file at the biological unit URL, otherwise use the typical record URL. Default is False, get the typical record.

download_sf(pdb_code)

 

Download the ENT file for the given PDB ID, converts it to CNS format, and returns the CNS file name. Will raise a RuntimeError exception if either download or conversion fails.

Not every pdb has structure factor files deposited, and not every structure factor file will convert perfectly.

download_fasta(pdb_code, chain=None)

 

Attemps to download the fasta file for the given PDB ID and chain.

Parameters:
  • pdb_code (str) - PDB ID of the file to download
  • chain (str or None) - The chain name to download. If None, the file will contain all chains

get_pdb(pdbid, source=AUTO, caps_asis=False)

 

Attempts to get the specified PDB file from either the database or the web, depending on the source option. Default is AUTO, which attempts the database first, and then the web.

pdbid - string of 4 characters source - one of: AUTO, DATABASE, WEB.

Parameters:
  • caps_asis (bool) - True if the capitalization of pdbid should be preserved, False (default) if it should be converted to lowercase.

    Raises RuntimeError if file could not be retrieved.

retrieve_pdb(pdbid, local_repos=None, verbose=False, caps_asis=False)

 

Attempt to retrieve the PDB from the local repository

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

@type pdbid: str
@param pdbid: the PDB code of the desired file

@type local_repos: list of str
@param local_repos: the paths to the parent directories of each local
repository.

@type caps_asis: bool
@param caps_asis: True if the capitalization of pdbid should be preserved,
False (default) if it should be converted to lowercase.

@rtype: str
@return: the name of the pdb file or None if a failure occurs

find_local_repository(verbose=False)

 

Determine a directory list for local repositories.

Note: the location of the PDB directory can be specified via environment variables; the order of precedence is: * SCHRODINGER_PDB * SCHRODINGER_THIRDPARTY/database/pdb * SCHRODINGER/thirdparty/database/pdb (the default)

Parameters:
  • verbose (bool) - True if debugging messages should be printed to the screen
Returns: list of str
the paths to the parent directories of each local repository. Returns an empty list if the local repository cannot be determined.

find_local_pdb(pdbid, local_repos=None, verbose=False, caps_asis=False)

 

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

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)

@type pdbid: str
@param pdbid: the PDB code of the desired file

@type local_repos: list of str
@param local_repos: the paths to the parent directories of each local
repository.

@type verbose: bool
@param verbose: True if debug messages should be printed out

@type caps_asis: bool
@param caps_asis: True if the capitalization of pdbid should be preserved,
False (default) if it should be converted to lowercase.

@rtype: str
@return: the path to an existing file ith the desired PDB code

download_pdb(pdb_code, biological_unit=False)

 

Download the pdb record from www.rcsb.org into the cwd.

Parameters:
  • pdb_code (str) - Four character alphanumeric string for the PDB id.
  • biological_unit (bool

    Raises RuntimeError if the PDB could not be downloaded.

    ) - If True, and the file needs to be downloaded, then download the file at the biological unit URL, otherwise use the typical record URL. Default is False, get the typical record.

download_file(pdb_code, pdb_file, url, biological_unit=False)

 

Download a file from a given url into the working directory.

Parameters:
  • pdb_code (str) - Four character alphanumeric string for the PDB id.
  • pdb_file (str) - The file name to create
  • url (str) - The url to get the file from
  • biological_unit (bool) - If True, and the file needs to be downloaded, then download the file at the biological unit URL, otherwise use the typical record URL. Default is False, get the typical record.
Raises:
  • RuntimeError - if the PDB could not be downloaded.

get_entryimport_opts()

 

Returns a dictionary that describes the Maestro Import panel state. 'entryimport' option keys for value

set_entryimport_opts(entryimport_opts)

 

Assigns 'entryimport' option dictionary values.

Parameters:
  • entryimport_opts (dictionary) - entryimport option keywords and values.

retrieve_ent(pdbid)

 

Retrieves the ENT file for the specified PDB ID from the third-party database and copies it to the CWD. File path is returned.

Raises RuntimeError on error.

download_ent(pdbid)

 

Downloads the ENT file for the specified PDB ID from the RCSB web site, and saves it to the CWD. File path is returned.

Raises RuntimeError on error.

get_ent(pdbid, source=AUTO)

 

Attempts to get the specified ENT file from either the database or the web, depending on the source option. Default is AUTO, which attempts the database first, and then the web.

pdbid - string of 4 characters source - one of: AUTO, DATABASE, WEB.

Raises RuntimeError if file could not be retrieved.


Variables Details [hide private]

__doc__

Value:
"""
Module for downloading PDB files from the web.

The data is retrieved from the following website:
http://www.rcsb.org/pdb/files/

Running this module is no different from using a web-browser to access
the site - it's just a different type of web client. Therefore this sh\
...