Difference between revisions of "Clustering"

From relax wiki
Jump to navigation Jump to search
(Created page with " == Example == === File with clustering === Flat text file with info <source lang="text"> # Optimisation of the Kjaergaard et al., 2013 Off-resonance R1rho relaxation dispers...")
 
m (Switch from the depreciated <source> tags to <syntaxhighlight>.)
 
(One intermediate revision by one other user not shown)
Line 4: Line 4:
 
=== File with clustering ===
 
=== File with clustering ===
 
Flat text file with info
 
Flat text file with info
<source lang="text">
+
<syntaxhighlight lang="text">
 
# Optimisation of the Kjaergaard et al., 2013 Off-resonance R1rho relaxation dispersion experiments using the 'DPL' model.
 
# 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.
 
# Residues used for global fitting, in Figure 2.
Line 23: Line 23:
 
V52N-HN
 
V52N-HN
 
A53N-HN
 
A53N-HN
</souce>
+
</syntaxhighlight>
  
 
=== Cluster these residues ===
 
=== Cluster these residues ===
 
Script file: '''relax_global.py'''
 
Script file: '''relax_global.py'''
<source lang="python">
+
<syntaxhighlight lang="python">
 
import os
 
import os
 
from auto_analyses.relax_disp import Relax_disp
 
from auto_analyses.relax_disp import Relax_disp
Line 66: Line 66:
 
for curspin, mol_name, res_num, res_name, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=False):
 
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
 
     print curspin.select, curspin.name, curspin.isotope, mol_name, res_num, res_name, spin_id
</source>
+
</syntaxhighlight>
  
 
Execute with:
 
Execute with:
 
  relax -p relax_global.py
 
  relax -p relax_global.py

Latest revision as of 19:00, 19 September 2020

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