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

[modeller_usage] read_al_373E> Protein specified in ALIGN_CODES(i) was not found in the alignment file



Hello everybody!
I am new to Modeller, so please excuse me if my question seems stupid.
I build a model from multiple templates following your tutorial (https://salilab.org/modeller/tutorial/advanced.html). It's working. When I try to develop a module function with scripts, the 'align2d_mult.py' give me the following error: ModellerError: read_al_373E> Protein specified in ALIGN_CODES(i) was not found in the alignment file; ALIGN_CODES(       3) =  P02489

I can't understand because my sequence.ali file is built in the right way:

>P1;P02489
sequence:P02489:::::::0.00: 0.00
MDVTIQHPWFKRTLGPFYPSRLFDQFFGEGLFEYDLLPFLSSTISPYYRQSLFRTVLDSGISEVRSDRDKFVIFLDVKHFSPEDLTVKVQDDFVEIHGKHNERQDDHGYISREFHRRYRLPSNVDQSALSCSLSADGMLTFCGPKIQTGLDATHAERAIPVSREEKPTSAPSS*

In attached you can find the python module with the function of script
Thank you.
Andrea

#!/usr/bin/env python
from modeller import *
from modeller.automodel import *
import os

def salign():


    """ Illustrates the SALIGN multiple structure/sequence alignment """

    log.verbose()
    env = environ()
    env.io.atom_files_directory = os.getcwd()
    env.libs.topology.read(file='$(LIB)/top_heav.lib')

    aln = alignment(env)
    for (code, chain) in (('2klr', 'A'), ('3l1e', 'A')):
        mdl = model(env, file=code, model_segment=('FIRST:'+chain, 'LAST:'+chain))
        aln.append_model(mdl, atom_files=code, align_codes=code+chain)

    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,
                    dendrogram_file='P02489.tree',
                    alignment_type='tree', # 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='template.pap', alignment_format='PAP')
    aln.write(file='template.ali', alignment_format='PIR')

    aln.salign(rms_cutoff=1.0, 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, dendrogram_file='1is3A.tree',
            alignment_type='progressive', feature_weights=[0]*6,
            improve_alignment=False, fit=False, write_fit=True,
            write_whole_pdb=False, output='QUALITY')

def align_multi():
    log.verbose()
    env = environ()

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

    # Read aligned structure(s):
    aln = alignment(env)
    aln.append(file='template.ali', align_codes='all')
    aln_block = len(aln)

    # Read aligned sequence(s):
    aln.append(file='P02489.ali', align_codes='P02489')

    # Structure sensitive variable gap penalty sequence-sequence alignment:
    aln.salign(output='', max_gap_length=20,
               gap_function=True,   # to use structure-dependent gap penalty
               alignment_type='PAIRWISE', align_block=aln_block,
               feature_weights=(1., 0., 0., 0., 0., 0.), overhang=0,
               gap_penalties_1d=(-450, 0),
               gap_penalties_2d=(0.35, 1.2, 0.9, 1.2, 0.6, 8.6, 1.2, 0., 0.),
               similarity_flag=True)

    aln.write(file='P02489-mult.ali', alignment_format='PIR')
    aln.write(file='P02489-mult.pap', alignment_format='PAP')



def model_multi():
    env = environ()
    a = automodel(env, alnfile='P02489-mult.ali',
                  knowns=('2klrA','3l1eA'), sequence='P02489')
    a.starting_model = 1
    a.ending_model = 5
    a.make()

    # Get a list of all successfully built models from a.outputs
    ok_models = filter(lambda x: x['failure'] is None, a.outputs)

    # Rank the models by DOPE score
    key = 'molpdf'
    ok_models.sort(lambda a,b: cmp(a[key], b[key]))

    # Get top model
    m = ok_models[0]
    print "Top model: %s (DOPE score %.3f)" % (m['name'], m[key])