Clustering

From relax wiki
Jump to navigation Jump to search

Example

File with clustering

Flat text file with info

# Optimisation of the Kjaergaard et al., 2013 Off-resonance R1rho relaxation dispersion experiments using the 'DPL' model.
# Residues used for global fitting, in Figure 2.
# This uses the data from Kjaergaard's paper at http://dx.doi.org/10.1021/bi4001062
L13N-HN
R15N-HN
T16N-HN
Q25N-HN
Q26N-HN
Q28N-HN
L39N-HN
M40N-HN
A41N-HN
F43N-HN
I44N-HN
K45N-HN
A49N-HN
V52N-HN
A53N-HN

Cluster these residues

Script file: relax_global.py

import os
from auto_analyses.relax_disp import Relax_disp
from pipe_control.mol_res_spin import spin_loop
 
# Set settings for run.
pre_run_directory = os.path.join(os.getcwd(),"results")
results_directory = os.path.join(os.getcwd(),"results_clustering")
cluster_file = "global_fit_residues.txt"

# Load set
state.load(state='bug_21344.bz2', force=True)
 
# Open file for writing
f = open(cluster_file, 'r')

cluster_spins = []
for line in f:
    if line[0] == "#":
        continue
    else:
        resnspin = line.split()[0]
        resn = resnspin[0]
        resi = resnspin[1:].split("N-HN")[0]
        spinid = ":%s@N"%(resi)
        print spinid

        relax_disp.cluster('model_cluster', spinid)

# Close file
f.close()

# De-select for analysis those spins who have not been clustered
for free_spin in cdp.clustering['free spins']:
    deselect.spin(spin_id=free_spin, change_all=False)

# Print info
for curspin, mol_name, res_num, res_name, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=False):
    print curspin.select, curspin.name, curspin.isotope, mol_name, res_num, res_name, spin_id

Execute with:

relax -p relax_global.py