1# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk) 2# This code is part of the Biopython distribution and governed by its 3# license. Please see the LICENSE file that should have been included 4# as part of this package. 5 6# NACCESS interface adapted from Bio/PDB/DSSP.py 7 8from__future__importprint_function 9 10importos 11importtempfile 12importshutil 13importsubprocess 14fromBio.PDB.PDBIOimportPDBIO 15fromBio.PDB.AbstractPropertyMapimportAbstractResiduePropertyMap,AbstractAtomPropertyMap 16 17"""Interface for the program NACCESS. 18 19See: http://wolf.bms.umist.ac.uk/naccess/ 20 21errors likely to occur with the binary: 22default values are often due to low default settings in accall.pars 23- e.g. max cubes error: change in accall.pars and recompile binary 24 25use naccess -y, naccess -h or naccess -w to include HETATM records 26""" 27 28

126res_data,atm_data=run_naccess(model,pdb_file,127naccess=naccess_binary,128temp_path=tmp_directory)129naccess_dict=process_rsa_data(res_data)130res_list=[]131property_dict={}132property_keys=[]133property_list=[]134# Now create a dictionary that maps Residue objects to accessibility135forchaininmodel:136chain_id=chain.get_id()137forresinchain:138res_id=res.get_id()139if(chain_id,res_id)innaccess_dict:140item=naccess_dict[(chain_id,res_id)]141res_name=item['res_name']142assert(res_name==res.get_resname())143property_dict[(chain_id,res_id)]=item144property_keys.append((chain_id,res_id))145property_list.append((res,item))146res.xtra["EXP_NACCESS"]=item147else:148pass149AbstractResiduePropertyMap.__init__(self,property_dict,property_keys,150property_list)

157res_data,atm_data=run_naccess(model,pdb_file,158naccess=naccess_binary,159temp_path=tmp_directory)160self.naccess_atom_dict=process_asa_data(atm_data)161property_dict={}162property_keys=[]163property_list=[]164# Now create a dictionary that maps Atom objects to accessibility165forchaininmodel:166chain_id=chain.get_id()167forresidueinchain:168res_id=residue.get_id()169foratominresidue:170atom_id=atom.get_id()171full_id=(chain_id,res_id,atom_id)172iffull_idinself.naccess_atom_dict:173asa=self.naccess_atom_dict[full_id]174property_dict[full_id]=asa175property_keys.append((full_id))176property_list.append((atom,asa))177atom.xtra['EXP_NACCESS']=asa178AbstractAtomPropertyMap.__init__(self,property_dict,179property_keys,property_list)