[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[modeller_usage] Structural alignment using iterative_structural_alignment



I was trying to clean two pdb files and superpose them based on the pairwise structural alignment.

The script is like followings:

from modeller import *
from modeller.scripts import complete_pdb
import sys
import modeller.salign

log.verbose()

env = environ()
env.libs.topology.read(file='$(LIB)/top_heav.lib')
env.libs.parameters.read(file='$(LIB)/par.lib')

env.io.atom_files_directory = './'

if len(sys.argv) != 5:
   print "Usage: superpose_pdbs.py code1 chain1 code2 chain2"
   sys.exit(1)

code1,chain1,code2,chain2 = sys.argv[1:]
file1 = code1+'.pdb'
file2 = code2+'.pdb'

aln = alignment(env)
mdl1 = complete_pdb(env,file1,model_segment=('FIRST:'+chain1,'LAST:'+chain1))
mdl1.write(file=code1+'_'+chain1+'_complete.pdb',model_format='PDB')
mdl2 = complete_pdb(env,file2,model_segment=('FIRST:'+chain2,'LAST:'+chain2))
mdl2.write(file=code2+'_'+chain2+'_complete.pdb',model_format='PDB')

aln.append_model(mdl1,atom_files=file1,align_codes=code1+chain1)
aln.append_model(mdl2,atom_files=file2,align_codes=code2+chain2)

modeller.salign.iterative_structural_align(aln)

#for (weights, write_fit, whole) in (((1., 0., 0., 0., 1., 0.), False, True),
#                                    ((1., 0.5, 1., 1., 1., 0.), False, True),
#                                    ((1., 1., 1., 1., 1., 0.), True, False)):
#    aln.salign(rms_cutoff=3.5, normalize_pp_scores=False,
#               rr_file='$(LIB)/as1.sim.mat', overhang=30,
#               gap_penalties_1d=(-450, -50),
#               gap_penalties_3d=(0, 3), gap_gap_score=0, gap_residue_score=0,
#               alignment_type='PAIRWISE', # If 'progresive', the tree is not
#                                      # computed and all structues will be
#                                      # aligned sequentially to the first
#               feature_weights=weights, # For a multiple sequence alignment only
#                                        # the first feature needs to be non-zero
#               improve_alignment=True, fit=True, write_fit=write_fit,
#               write_whole_pdb=whole, output='ALIGNMENT QUALITY')

aln.write(file=code1+chain1+'_'+code2+chain2+'.ali',alignment_format='PIR')
atmsel = selection(mdl1).only_atom_types('CA')
r = atmsel.superpose(mdl2,aln)
mdl2.write(file=code2+'_'+chain2+'_complete.pdb',model_format='PDB')

When I used three iterative cycles of 'salign' above (commented) I could successfully run the script.

But when I replaced it to 'modeller.salign.iterative_structural_align(aln), I had error message like:

Traceback (most recent call last):
  File "clean_pdb.sh", line 33, in ?
    modeller.salign.iterative_structural_align(aln)
  File "/Library/modeller-9v7/modlib/modeller/salign.py", line 122, in iterative_structural_align
    aln.append(file=opfile)
  File "/Library/modeller-9v7/modlib/modeller/alignment.py", line 79, in append
    allow_alternates)
IOError: openf______E> Cannot open file /var/folders/nx/nx+3eBsLGB4bYzOn5I3FjE+++TY/-Tmp-/tmp4FqRw9/salign_local_mid.ali: No such file or directory

Could you please let me know what I did wrong with this?

Thanks,

Best regards,

Seungyeul Yoo