Index: modlib/modeller/automodel/generate.py =================================================================== --- modlib/modeller/automodel/generate.py (revision 8282) +++ modlib/modeller/automodel/generate.py (revision 8283) @@ -3,6 +3,17 @@ from modeller.alignment import alignment +def _set_seq_id(mdl, aln): + """Set the model's seq_id field using the most similar template. + This is done automatically by transfer_xyz, but generate methods + that don't use transfer_xyz to create the model from the templates + will need to do this manually.""" + target = aln[-1] + seq_id = 0. + for known in aln[:-1]: + seq_id = max(seq_id, known.get_sequence_identity(target)) + mdl.seq_id = seq_id + def generate_xyz(mdl, aln): """Build coordinates from scratch (ignore templates)""" @@ -10,6 +21,7 @@ mdl.create_topology(aln) mdl.build(initialize_xyz=True, build_method='3D_INTERPOLATION') mdl.make_valid_pdb_coordinates() + _set_seq_id(mdl, aln) def transfer_xyz(mdl, aln): @@ -47,3 +59,7 @@ # sequence is correct and any missing atoms are filled in: mdl.transfer_xyz(a, cluster_cut=-1.0) mdl.build(initialize_xyz=False, build_method='INTERNAL_COORDINATES') + + # Note that transfer_xyz will set mdl.seq_id to 100%, which is not what + # we want. So calculate it correctly here. + _set_seq_id(mdl, aln)