Back to index

python-biopython  1.60
Classes | Functions | Variables
Bio.PDB.DSSP Namespace Reference

Classes

class  DSSP

Functions

def ss_to_index
def dssp_dict_from_pdb_file
def make_dssp_dict

Variables

tuple _dssp_cys = re.compile('[a-z]')
dictionary MAX_ACC = {}
tuple p = PDBParser()
tuple s = p.get_structure('X', sys.argv[1])
list model = s[0]
tuple d = DSSP(model, sys.argv[1])

Function Documentation

def Bio.PDB.DSSP.dssp_dict_from_pdb_file (   in_file,
  DSSP = "dssp" 
)
Create a DSSP dictionary from a PDB file.

Example:
    >>> dssp_dict=dssp_dict_from_pdb_file("1fat.pdb")
    >>> aa, ss, acc=dssp_dict[('A', 1)]

@param in_file: pdb file
@type in_file: string

@param DSSP: DSSP executable (argument to os.system)
@type DSSP: string

@return: a dictionary that maps (chainid, resid) to 
    amino acid type, secondary structure code and 
    accessibility.
@rtype: {}

Definition at line 79 of file DSSP.py.

00079 
00080 def dssp_dict_from_pdb_file(in_file, DSSP="dssp"):
00081     """
00082     Create a DSSP dictionary from a PDB file.
00083 
00084     Example:
00085         >>> dssp_dict=dssp_dict_from_pdb_file("1fat.pdb")
00086         >>> aa, ss, acc=dssp_dict[('A', 1)]
00087 
00088     @param in_file: pdb file
00089     @type in_file: string
00090 
00091     @param DSSP: DSSP executable (argument to os.system)
00092     @type DSSP: string
00093 
00094     @return: a dictionary that maps (chainid, resid) to 
00095         amino acid type, secondary structure code and 
00096         accessibility.
00097     @rtype: {}
00098     """
00099     out_file = tempfile.NamedTemporaryFile(suffix='.dssp')
00100     out_file.flush()    # needed?
00101     os.system("%s %s > %s" % (DSSP, in_file, out_file.name))
00102     out_dict, keys = make_dssp_dict(out_file.name)
00103     out_file.close()
00104     return out_dict, keys
00105 

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.PDB.DSSP.make_dssp_dict (   filename)
Return a DSSP dictionary that maps (chainid, resid) to
aa, ss and accessibility, from a DSSP file.

@param filename: the DSSP output file
@type filename: string

Definition at line 106 of file DSSP.py.

00106 
00107 def make_dssp_dict(filename):
00108     """
00109     Return a DSSP dictionary that maps (chainid, resid) to
00110     aa, ss and accessibility, from a DSSP file.
00111 
00112     @param filename: the DSSP output file
00113     @type filename: string
00114     """
00115     dssp = {}
00116     handle = open(filename, "r")
00117     try:
00118         start = 0
00119         keys = []
00120         for l in handle.readlines():
00121             sl = l.split()
00122             if sl[1] == "RESIDUE":
00123                 # Start parsing from here
00124                 start = 1
00125                 continue
00126             if not start:
00127                 continue
00128             if l[9] == " ":
00129                 # Skip -- missing residue
00130                 continue
00131             resseq = int(l[5:10])
00132             icode = l[10]
00133             chainid = l[11]
00134             aa = l[13]
00135             ss = l[16]
00136             if ss == " ":
00137                 ss = "-"
00138             try:
00139                 acc = int(l[34:38]) 
00140                 phi = float(l[103:109])
00141                 psi = float(l[109:115])
00142             except ValueError, exc:
00143                 # DSSP output breaks its own format when there are >9999
00144                 # residues, since only 4 digits are allocated to the seq num
00145                 # field.  See 3kic chain T res 321, 1vsy chain T res 6077.
00146                 # Here, look for whitespace to figure out the number of extra
00147                 # digits, and shift parsing the rest of the line by that amount.
00148                 if l[34] != ' ':
00149                     shift = l[34:].find(' ')
00150                     acc = int((l[34+shift:38+shift]))
00151                     phi = float(l[103+shift:109+shift])
00152                     psi = float(l[109+shift:115+shift])
00153                 else:
00154                     raise ValueError, exc
00155             res_id = (" ", resseq, icode)
00156             dssp[(chainid, res_id)] = (aa, ss, acc, phi, psi)
00157             keys.append((chainid, res_id))
00158     finally:
00159         handle.close()
00160     return dssp, keys
00161 

Here is the call graph for this function:

Here is the caller graph for this function:

Secondary structure symbol to index.
H=0
E=1
C=2

Definition at line 63 of file DSSP.py.

00063 
00064 def ss_to_index(ss):
00065     """
00066     Secondary structure symbol to index.
00067     H=0
00068     E=1
00069     C=2
00070     """
00071     if ss=='H':
00072         return 0
00073     if ss=='E':
00074         return 1
00075     if ss=='C':
00076         return 2
00077     assert 0
00078 


Variable Documentation

tuple Bio.PDB.DSSP._dssp_cys = re.compile('[a-z]')

Definition at line 35 of file DSSP.py.

tuple Bio.PDB.DSSP.d = DSSP(model, sys.argv[1])

Definition at line 315 of file DSSP.py.

dictionary Bio.PDB.DSSP.MAX_ACC = {}

Definition at line 40 of file DSSP.py.

list Bio.PDB.DSSP.model = s[0]

Definition at line 314 of file DSSP.py.

Definition at line 312 of file DSSP.py.

tuple Bio.PDB.DSSP.s = p.get_structure('X', sys.argv[1])

Definition at line 313 of file DSSP.py.