Back to index

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

Classes

class  NACCESS
class  NACCESS_atomic

Functions

def run_naccess
def process_rsa_data
def process_asa_data

Variables

tuple p = PDBParser()
tuple s = p.get_structure('X', sys.argv[1])
list model = s[0]
tuple n = NACCESS(model, sys.argv[1])

Function Documentation

Definition at line 95 of file NACCESS.py.

00095 
00096 def process_asa_data(rsa_data):
00097     # process the .asa output file: atomic level SASA data
00098     naccess_atom_dict = {}
00099     for line in rsa_data:
00100         atom_serial = line[6:11]
00101         full_atom_id = line[12:16]
00102         atom_id = full_atom_id.strip()
00103         altloc = line[16]
00104         resname = line[17:20]
00105         chainid = line[21]
00106         resseq = int(line[22:26])
00107         icode = line[26]
00108         res_id = (' ', resseq, icode)
00109         id = (chainid, res_id, atom_id)
00110         asa = line[54:62]               # solvent accessibility in Angstrom^2
00111         vdw = line[62:68]               # van der waal radius
00112         naccess_atom_dict[id] = asa
00113     return naccess_atom_dict
00114 

Definition at line 71 of file NACCESS.py.

00071 
00072 def process_rsa_data(rsa_data):
00073     # process the .rsa output file: residue level SASA data
00074     naccess_rel_dict = {}
00075     for line in rsa_data:
00076         if line.startswith('RES'):
00077             res_name = line[4:7]
00078             chain_id = line[8]
00079             resseq = int(line[9:13])
00080             icode = line[13]
00081             res_id = (' ', resseq, icode)
00082             naccess_rel_dict[(chain_id, res_id)] = { \
00083                 'res_name': res_name,
00084                 'all_atoms_abs': float(line[16:22]),
00085                 'all_atoms_rel': float(line[23:28]),
00086                 'side_chain_abs': float(line[29:35]),
00087                 'side_chain_rel': float(line[36:41]),
00088                 'main_chain_abs': float(line[42:48]),
00089                 'main_chain_rel': float(line[49:54]),
00090                 'non_polar_abs': float(line[55:61]),
00091                 'non_polar_rel': float(line[62:67]),
00092                 'all_polar_abs': float(line[68:74]),
00093                 'all_polar_rel': float(line[75:80]) } 
00094     return naccess_rel_dict

Here is the caller graph for this function:

def Bio.PDB.NACCESS.run_naccess (   model,
  pdb_file,
  probe_size = None,
  z_slice = None,
  naccess = 'naccess',
  temp_path = '/tmp/' 
)

Definition at line 24 of file NACCESS.py.

00024 
00025                 naccess = 'naccess', temp_path = '/tmp/'):
00026     
00027     # make temp directory; chdir to temp directory, 
00028     # as NACCESS writes to current working directory
00029     tmp_path = tempfile.mktemp(dir = temp_path)
00030     os.mkdir(tmp_path)
00031     old_dir = os.getcwd()
00032     os.chdir(tmp_path)
00033     
00034     # file name must end with '.pdb' to work with NACCESS
00035     # -> create temp file of existing pdb
00036     #    or write model to temp file
00037     tmp_pdb_file = tempfile.mktemp('.pdb', dir = tmp_path)
00038     if pdb_file:
00039         os.system('cp %s %s' % (pdb_file, tmp_pdb_file))
00040     else:
00041         writer = PDBIO()
00042         writer.set_structure(model.get_parent())
00043         writer.save(tmp_pdb_file)
00044 
00045     # create the command line and run
00046     # catch standard out & err
00047     command = '%s %s ' % (naccess, tmp_pdb_file)
00048     if probe_size:
00049         command += '-p %s ' % probe_size
00050     if z_slice:
00051         command += '-z %s ' % z_slice
00052     in_, out, err = os.popen3(command)
00053     in_.close()
00054     stdout = out.readlines()
00055     out.close()
00056     stderr = err.readlines()
00057     err.close()
00058 
00059     # get the output, then delete the temp directory
00060     rsa_file = tmp_pdb_file[:-4] + '.rsa'
00061     rf = open(rsa_file)
00062     rsa_data = rf.readlines()
00063     rf.close()
00064     asa_file = tmp_pdb_file[:-4] + '.asa'
00065     af = open(asa_file)
00066     asa_data = af.readlines()
00067     af.close()
00068     os.chdir(old_dir)
00069     os.system('rm -rf %s >& /dev/null' % tmp_path)
00070     return rsa_data, asa_data

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 180 of file NACCESS.py.

tuple Bio.PDB.NACCESS.n = NACCESS(model, sys.argv[1])

Definition at line 182 of file NACCESS.py.

tuple Bio.PDB.NACCESS.p = PDBParser()

Definition at line 178 of file NACCESS.py.

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

Definition at line 179 of file NACCESS.py.