mailr10690 - in /branches/bieri_gui: ./ info.py specific_fns/n_state_model.py


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

Header


Content

Posted by edward on February 11, 2010 - 14:29:
Author: bugman
Date: Thu Feb 11 14:29:25 2010
New Revision: 10690

URL: http://svn.gna.org/viewcvs/relax?rev=10690&view=rev
Log:
Merged revisions 10688-10689 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3

........
  r10688 | bugman | 2010-02-09 11:36:44 +0100 (Tue, 09 Feb 2010) | 5 lines
  
  Added support for using Me pseudo-atom RDCs.
  
  This follows the method of Verdier, et al., JMR, 2003, 163, 353-359.
........
  r10689 | bugman | 2010-02-11 14:26:13 +0100 (Thu, 11 Feb 2010) | 3 lines
  
  Added the cite_html() method to the citation base class to produce a HTML 
formatted citation.
........

Modified:
    branches/bieri_gui/   (props changed)
    branches/bieri_gui/info.py
    branches/bieri_gui/specific_fns/n_state_model.py

Propchange: branches/bieri_gui/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb 11 14:29:25 2010
@@ -1,1 +1,1 @@
-/1.3:1-10686
+/1.3:1-10689

Modified: branches/bieri_gui/info.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/info.py?rev=10690&r1=10689&r2=10690&view=diff
==============================================================================
--- branches/bieri_gui/info.py (original)
+++ branches/bieri_gui/info.py Thu Feb 11 14:29:25 2010
@@ -171,6 +171,58 @@
         return cite
 
 
+    def cite_html(self, author=True, title=True, journal=True, volume=True, 
number=True, pages=True, year=True, doi=True, url=True):
+        """Compile a citation for HTML display.
+
+        @keyword author:    The author flag.
+        @type author:       bool
+        @keyword title:     The title flag.
+        @type title:        bool
+        @keyword journal:   The journal flag.
+        @type journal:      bool
+        @keyword volume:    The volume flag.
+        @type volume:       bool
+        @keyword number:    The number flag.
+        @type number:       bool
+        @keyword pages:     The pages flag.
+        @type pages:        bool
+        @keyword year:      The year flag.
+        @type year:         bool
+        @keyword doi:       The doi flag.
+        @type doi:          bool
+        @return:            The full citation.
+        @rtype:             str
+        """
+
+        # Build the citation.
+        cite = ''
+        if author and hasattr(self, 'author'):
+            cite = cite + self.author
+        if year and hasattr(self, 'year'):
+            cite = cite + ' (' + repr(self.year) + ').'
+        if title and hasattr(self, 'title'):
+            cite = cite + ' ' + self.title
+        if journal and hasattr(self, 'journal'):
+            cite = cite + ' <em>' + self.journal + '<em>,'
+        if volume and hasattr(self, 'volume'):
+            cite = cite + ' <strong>' + self.volume + '</strong>'
+        if number and hasattr(self, 'number'):
+            cite = cite + '(' + self.number + '),'
+        if pages and hasattr(self, 'pages'):
+            cite = cite + ' ' + self.pages
+        if doi and hasattr(self, 'doi'):
+            cite = cite + ' (<a href="http://dx.doi.org/%s>abstract</a>)' % 
self.doi
+        if url and hasattr(self, 'url'):
+            cite = cite + ' ('+self.url + ')'
+
+        # End.
+        if cite[-1] != '.':
+            cite = cite + '.'
+
+        # Return the citation.
+        return cite
+
+
 
 class Clore90(Ref):
     """Bibliography container."""

Modified: branches/bieri_gui/specific_fns/n_state_model.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/specific_fns/n_state_model.py?rev=10690&r1=10689&r2=10690&view=diff
==============================================================================
--- branches/bieri_gui/specific_fns/n_state_model.py (original)
+++ branches/bieri_gui/specific_fns/n_state_model.py Thu Feb 11 14:29:25 2010
@@ -803,7 +803,7 @@
             if not spin.select:
                 continue
 
-            # Skip spins without RDC data or unit XH bond vectors.
+            # Skip spins without RDC data.
             if not hasattr(spin, 'rdc'):
                 # Add rows of None if other data exists.
                 if hasattr(spin, 'pcs'):
@@ -816,9 +816,9 @@
                 continue
 
             # RDC data exists but the XH bond vectors are missing?
-            if not hasattr(spin, 'xh_vect') and not hasattr(spin, 
'bond_vect'):
+            if not hasattr(spin, 'members') and not hasattr(spin, 'xh_vect') 
and not hasattr(spin, 'bond_vect'):
                 # Throw a warning.
-                warn(RelaxWarning("RDC data exists but the XH bond vectors 
are missing, skipping spin " + spin_id))
+                warn(RelaxWarning("RDC data exists but the XH bond vectors 
are missing, skipping spin %s." % spin_id))
 
                 # Add rows of None if other data exists.
                 if hasattr(spin, 'pcs'):
@@ -830,16 +830,53 @@
                 # Jump to the next spin.
                 continue
 
-            # Append the RDC and XH vectors to the lists.
-            if hasattr(spin, 'xh_vect'):
-                obj = getattr(spin, 'xh_vect')
+            # Pseudo-atom set up.
+            if hasattr(spin, 'members'):
+                # Skip non-Me groups.
+                if len(spin.members) != 3:
+                    warn(RelaxWarning("Only methyl group pseudo atoms are 
supported due to their fast rotation, skipping spin %s." % spin_id))
+                    continue
+
+                # The summed vector.
+                vect = zeros(3, float64)
+                for i in range(3):
+                    # Get the spin.
+                    spin_i = return_spin(spin.members[i])
+
+                    # Add the bond vector.
+                    if hasattr(spin_i, 'xh_vect'):
+                        obj = getattr(spin_i, 'xh_vect')
+                    else:
+                        obj = getattr(spin_i, 'bond_vect')
+                    vect = vect + obj
+
+                # Normalise.
+                vect = vect / norm(vect)
+
+                # The RDC for the Me-pseudo spin where:
+                #     <D> = -1/3 Dpar.
+                # See Verdier, et al., JMR, 2003, 163, 353-359.
+                rdc = -3.0 * array(spin.rdc)
+
+            # Normal spin set up.
             else:
-                obj = getattr(spin, 'bond_vect')
-            rdcs.append(spin.rdc)
-            if isinstance(obj[0], float):
-                vectors.append([obj])
+                # Append the RDC and XH vectors to the lists.
+                if hasattr(spin, 'xh_vect'):
+                    vect = getattr(spin, 'xh_vect')
+                else:
+                    vect = getattr(spin, 'bond_vect')
+
+                # The RDC.
+                rdc = array(spin.rdc)
+
+            # Add the RDC.
+            rdcs.append(rdc)
+
+            # Add the bond vectors.
+            if isinstance(vect[0], float):
+                vectors.append([vect])
             else:
-                vectors.append(obj)
+                vectors.append(vect)
 
             # Append the PCS errors (or a list of None).
             if hasattr(spin, 'rdc_err'):




Related Messages


Powered by MHonArc, Updated Thu Feb 11 15:20:04 2010