mailRe: r26153 - /trunk/specific_analyses/relax_disp/api.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on October 06, 2014 - 15:36:
As I mentioned previously (in the thread
http://thread.gmane.org/gmane.science.nmr.relax.scm/23903), you need
to use the model_loop() method here, just as is used in the minimise()
API method:

        # Loop over the spin blocks.
        model_index = -1
        for spin_ids in self.model_loop():
            # Increment the model index.
            model_index += 1

This is the only really correct way of consistently looping over the
spin clusters.  Note that spin clustering may be made analysis
independent in the future.  For example this functionality overlaps
with the domain user function
(http://www.nmr-relax.com/manual/domain.html).  Spin clustering has
been used in model-free analyses before as well, specifically the
domain motion work by Nico Tjandra on calmodulin (CaM).  If the
concept become analysis independent, then using the model_loop()
method will require no changes to the code that calls it, i.e. the
code you changed right here :)

Cheers,

Edward



On 6 October 2014 02:39,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Mon Oct  6 02:39:48 2014
New Revision: 26153

URL: http://svn.gna.org/viewcvs/relax?rev=26153&view=rev
Log:
Implemented looping over spin-clusters when issuing a minimise.calculate().

Bug #22754 (https://gna.org/bugs/index.php?22754): The minimise.calculate() 
does not calculate chi2 value for clustered residues.

Modified:
    trunk/specific_analyses/relax_disp/api.py

Modified: trunk/specific_analyses/relax_disp/api.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/relax_disp/api.py?rev=26153&r1=26152&r2=26153&view=diff
==============================================================================
--- trunk/specific_analyses/relax_disp/api.py   (original)
+++ trunk/specific_analyses/relax_disp/api.py   Mon Oct  6 02:39:48 2014
@@ -287,6 +287,14 @@
                 for clust_spin_id in cdp.clustering[cluster_id]:
                     clust_spin = return_spin(clust_spin_id)

+                    # Skip de-selected
+                    if not clust_spin.select:
+                        continue
+
+                    # Skip protons for MMQ data.
+                    if clust_spin.model in MODEL_LIST_MMQ and 
clust_spin.isotope == '1H':
+                        continue
+
                     # Add to list.
                     cluster_id_spin_list.append(clust_spin)
                     cluster_id_spin_id_list.append(clust_spin_id)
@@ -319,6 +327,10 @@
             free_spin_list = []
             free_spin_id_list = []
             for cur_spin, cur_spin_id in spin_loop(selection=spin_id, 
return_id=True, skip_desel=True):
+                # Skip protons for MMQ data.
+                if cur_spin.model in MODEL_LIST_MMQ and cur_spin.isotope 
== '1H':
+                    continue
+
                 free_spin_list.append(cur_spin)
                 free_spin_id_list.append(cur_spin_id)

@@ -335,22 +347,39 @@
             # 1H MMQ flag.
             proton_mmq_flag = has_proton_mmq_cpmg()

-            # Loop over all spins.
-            for spin, cur_spin_id in spin_loop(selection=spin_id, 
return_id=True, skip_desel=True):
-                # Skip protons for MMQ data.
-                if spin.model in MODEL_LIST_MMQ and spin.isotope == '1H':
-                    continue
-
-                # Get the attached proton.
-                proton = None
-                if proton_mmq_flag:
-                    proton = return_attached_protons(cur_spin_id)[0]
-
-                # The back calculated values.
-                back_calc = back_calc_r2eff(spin=spin, 
spin_id=cur_spin_id, store_chi2=True)
-
-                # Pack the data.
-                pack_back_calc_r2eff(spin=spin, spin_id=cur_spin_id, si=0, 
back_calc=back_calc, proton_mmq_flag=proton_mmq_flag)
+            # Loop over the cluster ids.
+            for i, cluster_id in enumerate(cluster_ids):
+                # Get the spins, ids and if the cluster contains the spin 
of interest.
+                cluster_spins = cluster_spin_list[i]
+                cluster_spin_ids = cluster_spin_id_list[i]
+                spin_of_interest = clust_contain_spin_id_list[i]
+
+                # If spin of interest is present:
+                if spin_of_interest:
+                    # If it is a free free spin, then calculate per spin.
+                    if cluster_id == 'free spins':
+                        for si, spin in enumerate(cluster_spins):
+                            cur_spin_id = cluster_spin_ids[si]
+
+                            # Get the attached proton.
+                            proton = None
+                            if proton_mmq_flag:
+                                proton = 
return_attached_protons(cur_spin_id)[0]
+
+                            # The back calculated values.
+                            back_calc = back_calc_r2eff(spins=[spin], 
spin_ids=[cur_spin_id], store_chi2=True)
+
+                            # Pack the data.
+                            pack_back_calc_r2eff(spin=spin, 
spin_id=cur_spin_id, si=0, back_calc=back_calc, 
proton_mmq_flag=proton_mmq_flag)
+
+                    else:
+                        # The back calculated values.
+                        back_calc = back_calc_r2eff(spins=cluster_spins, 
spin_ids=cluster_spin_ids, store_chi2=True)
+
+                        # Pack the data.
+                        for si, spin in enumerate(cluster_spins):
+                            cur_spin_id = cluster_spin_ids[si]
+                            pack_back_calc_r2eff(spin=spin, 
spin_id=cur_spin_id, si=si, back_calc=back_calc, 
proton_mmq_flag=proton_mmq_flag)


     def constraint_algorithm(self):


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits



Related Messages


Powered by MHonArc, Updated Mon Oct 06 16:00:10 2014