Hi, I generated 100 models of a protein and now I would like to select the 20 with the lowest DOPE score. I tried to use the script provided in the manual but it gave an error (see below). To generate the models (models were obtained sucessfully): 
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
 
ZjQcmQRYFpfptBannerEnd
Hi,

I generated 100 models of a protein and now I would like to select the 20 with the lowest DOPE score. I tried to use the script provided in the manual but it gave an error (see below). 

To generate the models (models were obtained sucessfully):

# Comparative modeling with ligand transfer from the template

from modeller import *              # Load standard Modeller classes

from modeller.automodel import *    # Load the AutoModel class

import sys


log.verbose()    # request verbose output

env = Environ()  # create a new MODELLER environment to build this model in


# directories for input atom files

env.io.atom_files_directory = ['.', '../atom_files']


# Read in HETATM records from template PDBs

env.io.hetatm = True


a = AutoModel(env, alnfile='ahr-mult.ali',

              knowns=('3f1o_pasA','3h7w_pasA','3h82_pasA'), sequence='AhR', assess_methods=(assess.DOPE))


a.starting_model= 1                 # index of the first model

a.ending_model  = 100                 # index of the last model

                                    # (determines how many models to calculate)

a.make()                            # do the actual comparative modeling


To sort the models by DOPE score:


# Comparative modeling with ligand transfer from the template

from modeller import *              # Load standard Modeller classes

from modeller.automodel import *    # Load the AutoModel class

import sys


log.verbose()    # request verbose output

env = Environ()  # create a new MODELLER environment to build this model in


# Get a list of all successfully built models from a.output

ok_models = [x for x in a.outputs if x['failure'] is None


# Rank the models by DOPE score

key = 'DOPE score'

if sys.version_info[:2] == (2,3):

        ok_models.sort(lambda a,b: cmp(a[key], b[key]))

else:

        ok_models.sort(key=lambda a: a[key])


# Get top model

m = ok_models[0]

print("Top model: %s (DOPE score %.3f)" % (m['name'], m[key]))


Error shown:

  File "model-output.py", line 17

    key = 'DOPE score' 

      ^

SyntaxError: invalid syntax


I also tried to combine the scripts as shown in the manual (same error):

# Comparative modeling with ligand transfer from the template

from modeller import *              # Load standard Modeller classes

from modeller.automodel import *    # Load the AutoModel class

import sys


log.verbose()    # request verbose output

env = Environ()  # create a new MODELLER environment to build this model in


# directories for input atom files

env.io.atom_files_directory = ['.', '../atom_files']


# Read in HETATM records from template PDBs

env.io.hetatm = True


a = AutoModel(env, alnfile='ahr-mult.ali',

              knowns=('3f1o_pasA','3h7w_pasA','3h82_pasA'), sequence='AhR', assess_methods=(assess.DOPE))


a.starting_model= 1                 # index of the first model

a.ending_model  = 100                 # index of the last model

                                    # (determines how many models to calculate)

a.make()                            # do the actual comparative modeling


# Get a list of all succesfully built models from a.output

ok_models = [x for x in a.outputs if x['failure'] is None


# Rank the models by DOPE score

key = 'DOPE score'

if sys.version_info[:2] == (2,3):

        ok_models.sort(lambda a,b: cmp(a[key], b[key]))

else:

        ok_models.sort(key=lambda a: a[key])


# Get top model

m = ok_models[0]

print("Top model: %s (DOPE score %.3f)" % (m['name'], m[key]))


Error shown:


  File "model-output.py", line 27

    key = 'DOPE score' 

      ^

SyntaxError: invalid syntax


Please, any help to fix this issue with python coding would be appreciated (I have both python 2.7.13rc1 and python 3.8.9 installed).


Best,


Amanda F. Ghilardi