'''relax_5_ini_cluster.py'''
<source lang="python">
"""Taken from the relax disp manual, section 10.6.1 Dispersion script mode - the sample script. To run the script, simply type: $ ../../../../../relax relax_5_ini_cluster.py --tee relax_5_ini_cluster.log""" import osfrom auto_analyses.relax_disp import Relax_dispfrom pipe_control.mol_res_spin import spin_loop # Set settings for run.pre_run_directory = os.path.join(os.getcwd(),"model_sel_analyt")results_directory = os.path.join(os.getcwd(),"model_clustering_analyt")cluster_file = "cluster_residues.txt" # Load the initial previous final state setupwith results.state.load(state='ini_setupfinal_state.bz2', dir=pre_run_directory, force=False) # Open file for writingf = open(cluster_file, 'w') # Make a list to count number of modelsresi_models = [] for spin, mol_name, res_num, res_name, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=True): # Write models to file f.write( str(spin_id) + " ; " + str(spin.model) + " ; " + str(mol_name) + " ; " + str(res_num) + " ; " + str(res_name) + "\n" ) # Append models to list resi_models.append(spin.model) # Count resi_modelsc_resi_models = dict((i,resi_models.count(i)) for i in resi_models)print c_resi_models # Write count result to filefor key, val in c_resi_models.items(): f.write( "# ; " + str(key) + " ; " + str(val) + "\n" ) #Close the file f.close()
##################
# Cluster file for selection residues.
cluster_file ################# # Load the initial state setupstate.load(state= "cluster_residues'ini_setup.txt"bz2', force=True)
# Cluster residues
# Check for selected/deselected spins.
from pipe_control.mol_res_spin import spin_loop
for spin, spin_id in spin_loop(return_id=True, skip_desel=False):
print spin_id, spin.select