AlphaBetaTest / cing

Automatically exported from code.google.com/p/cing
0 stars 0 forks source link

Include Wattos NOE completeness and redundancy analyses #124

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Write ccpn from CING
Write star from FC
Write star from Wattos
Read star in CING

Original issue reported on code.google.com by jurge...@gmail.com on 13 Jan 2009 at 11:45

GoogleCodeExporter commented 9 years ago
Wim, can I ask you for a recommended strategy to write out NMR-STAR files from 
CING using CCPN FC? To whom should I address the below bug, to Tim or is it 
more Chris P.'s work?

Ok for the steps outlined above.

-1- Write ccpn from CING
-2- Write star from FC
-3- Write star from Wattos
-4- Read star in CING

Step 2 fails for the example:
http://code.google.com/p/cing/source/browse/trunk/cing/Tests/data/ccpn/1brv.tgz?
r=518

jd:stella/cingTmpCcpn/ analysis 1brv
Model read finished. Duration 1.35598301888 
Model validity check skipped
CcpNmr Analysis Version 2.0. Release 6 (Copyright 2003-2009 CCPN)
Distribution created Wed Jan 28 17:39:59 2009

If you use this software, please quote the following reference:

Wim F. Vranken, Wayne Boucher, Tim J. Stevens, Rasmus H. Fogh, Anne 
Pajon, Miguel Llinas, Eldon L. Ulrich, John L. Markley, John Ionides
and Ernest D. Laue (2005). The CCPN Data Model for NMR Spectroscopy: 
Development of a Software Pipeline. Proteins 59, 687 - 696.

The FAQ is at: http://www.ccpn.ac.uk/ccpn/software/ccpnmr-analysis/faq
For further help see the mailing list: http://www.jiscmail.ac.uk/ccpnmr

>>> 
###############################################
# FormatConverter: executing writeConstraints #
###############################################

#######################################################
# FormatConverter: executing writeDistanceConstraints #
#######################################################

  Distance constraint 2: Removed A.14.HGb*,A.14.HA based on A.14.HGa*,A.14.HA
  Distance constraint 3: Removed A.14.HGb*,A.14.H based on A.14.HGa*,A.14.H
  Distance constraint 4: Removed A.15.HBa,A.15.HDb based on A.15.HBb,A.15.HDb
  Distance constraint 4: Removed A.15.HDb,A.15.HBa based on A.15.HDa,A.15.HBa
  Distance constraint 4: Removed A.15.HDb,A.15.HBa based on A.15.HDa,A.15.HBb (SET MATCH!)
  Distance constraint 5: Removed A.15.HGb,A.15.HA based on A.15.HGa,A.15.HA
  Distance constraint 16: Removed A.20.HBb,A.20.H based on A.20.HBa,A.20.H
  Distance constraint 17: Removed A.20.HGb,A.20.HA based on A.20.HGa,A.20.HA
  Distance constraint 18: Removed A.20.HGb,A.20.H based on A.20.HGa,A.20.H
  Distance constraint 21: Removed A.22.HD22,A.22.HA based on A.22.HD21,A.22.HA
  Distance constraint 25: Removed A.22.HD22,A.22.H based on A.22.HD21,A.22.H
  Distance constraint 31: Removed A.23.HDb*,A.23.HA based on A.23.HDa*,A.23.HA
  Distance constraint 32: Removed A.23.HDb*,A.23.HB2 based on A.23.HDa*,A.23.HB2
  Distance constraint 33: Removed A.23.HDb*,A.23.HB3 based on A.23.HDa*,A.23.HB3
  Distance constraint 34: Removed A.23.HDb*,A.23.H based on A.23.HDa*,A.23.H
  Distance constraint 45: Removed A.26.HDb*,A.26.HA based on A.26.HDa*,A.26.HA
  Distance constraint 46: Removed A.26.HDb*,A.26.H based on A.26.HDa*,A.26.H
  Distance constraint 47: Removed A.26.HDb*,A.26.HB2 based on A.26.HDa*,A.26.HB2
  Distance constraint 48: Removed A.26.HDb*,A.26.HB3 based on A.26.HDa*,A.26.HB3
  Distance constraint 52: Removed A.27.HBb,A.27.H based on A.27.HBa,A.27.H
  Distance constraint 53: Removed A.28.HBb,A.28.H based on A.28.HBa,A.28.H
  Distance constraint 54: Removed A.28.HDb*,A.28.HA based on A.28.HDa*,A.28.HA
  Distance constraint 55: Removed A.28.HDb*,A.28.HBa based on A.28.HDa*,A.28.HBa
  Distance constraint 55: Removed A.28.HBa,A.28.HDb* based on A.28.HBb,A.28.HDb*
  Distance constraint 55: Removed A.28.HBa,A.28.HDb* based on A.28.HBb,A.28.HDa* (SET MATCH!)
  Distance constraint 56: Removed A.28.HDb*,A.28.H based on A.28.HDa*,A.28.H
  Distance constraint 71: Removed A.31.HG1b,A.31.HA based on A.31.HG1a,A.31.HA
  Distance constraint 72: Removed A.31.HG1b,A.31.H based on A.31.HG1a,A.31.H
  Distance constraint 74: Removed A.32.HBb,A.32.H based on A.32.HBa,A.32.H
  Distance constraint 75: Removed A.32.HGb,A.32.HA based on A.32.HGa,A.32.HA
  Distance constraint 76: Removed A.32.HGb,A.32.H based on A.32.HGa,A.32.H
  Distance constraint 77: Removed A.15.HDb,A.14.HA based on A.15.HDa,A.14.HA
  Distance constraint 78: Removed A.14.HGb*,A.15.HDb based on A.14.HGa*,A.15.HDb
  Distance constraint 78: Removed A.15.HDb,A.14.HGb* based on A.15.HDa,A.14.HGb*
  Distance constraint 78: Removed A.15.HDb,A.14.HGb* based on A.15.HDa,A.14.HGa* (SET MATCH!)
  Distance constraint 79: Removed A.15.HDb,A.14.H based on A.15.HDa,A.14.H
  Distance constraint 80: Removed A.15.HBb,A.16.H based on A.15.HBa,A.16.H
  Distance constraint 88: Removed A.17.HBb,A.18.HA based on A.17.HBa,A.18.HA
  Distance constraint 99: Removed A.20.HBb,A.19.H based on A.20.HBa,A.19.H
  Distance constraint 101: Removed A.20.HGb,A.21.H based on A.20.HGa,A.21.H
  Distance constraint 111: Removed A.23.HDb*,A.22.HA based on A.23.HDa*,A.22.HA
  Distance constraint 114: Removed A.22.HD22,A.23.H based on A.22.HD21,A.23.H
  Distance constraint 119: Removed A.23.HDb*,A.24.H based on A.23.HDa*,A.24.H
  Distance constraint 125: Removed A.26.HDb*,A.25.HB3 based on A.26.HDa*,A.25.HB3
  Distance constraint 135: Removed A.26.HDb*,A.27.H based on A.26.HDa*,A.27.H
  Distance constraint 139: Removed A.27.HBa,A.28.HBb based on A.27.HBb,A.28.HBb
  Distance constraint 139: Removed A.28.HBb,A.27.HBa based on A.28.HBa,A.27.HBa
  Distance constraint 139: Removed A.28.HBb,A.27.HBa based on A.28.HBa,A.27.HBb (SET MATCH!)
  Distance constraint 140: Removed A.27.HBb,A.28.HDb* based on A.27.HBa,A.28.HDb*
  Distance constraint 140: Removed A.28.HDb*,A.27.HBb based on A.28.HDa*,A.27.HBb
  Distance constraint 140: Removed A.28.HDb*,A.27.HBb based on A.28.HDa*,A.27.HBa (SET MATCH!)
  Distance constraint 141: Removed A.27.HBb,A.28.HG based on A.27.HBa,A.28.HG
  Distance constraint 142: Removed A.27.HBb,A.28.H based on A.27.HBa,A.28.H
  Distance constraint 143: Removed A.28.HBb,A.27.H based on A.28.HBa,A.27.H
  Distance constraint 144: Removed A.28.HDb*,A.27.H based on A.28.HDa*,A.27.H
  Distance constraint 149: Removed A.28.HBb,A.29.H based on A.28.HBa,A.29.H
  Distance constraint 150: Removed A.28.HDb*,A.29.H based on A.28.HDa*,A.29.H
  Distance constraint 160: Removed A.15.HBb,A.17.H based on A.15.HBa,A.17.H
  Distance constraint 161: Removed A.15.HBb,A.18.HG2* based on A.15.HBa,A.18.HG2*
  Distance constraint 162: Removed A.15.HBb,A.18.H based on A.15.HBa,A.18.H
  Distance constraint 163: Removed A.15.HDb,A.18.HG2* based on A.15.HDa,A.18.HG2*
  Distance constraint 164: Removed A.15.HDb,A.18.H based on A.15.HDa,A.18.H
  Distance constraint 165: Removed A.15.HGb,A.18.HG2* based on A.15.HGa,A.18.HG2*
  Distance constraint 166: Removed A.15.HGb,A.18.H based on A.15.HGa,A.18.H
  Distance constraint 172: Removed A.20.HBb,A.18.HA based on A.20.HBa,A.18.HA
  Distance constraint 173: Removed A.20.HGb,A.18.HA based on A.20.HGa,A.18.HA
  Distance constraint 184: Removed A.20.HBb,A.22.H based on A.20.HBa,A.22.H
  Distance constraint 185: Removed A.20.HGb,A.22.H based on A.20.HGa,A.22.H
  Distance constraint 189: Removed A.22.HD22,A.24.HB* based on A.22.HD21,A.24.HB*
  Distance constraint 190: Removed A.22.HD22,A.24.H based on A.22.HD21,A.24.H
  Distance constraint 193: Removed A.22.HD22,A.25.HB3 based on A.22.HD21,A.25.HB3
  Distance constraint 194: Removed A.22.HD22,A.25.H based on A.22.HD21,A.25.H
  Distance constraint 197: Removed A.26.HDb*,A.22.HA based on A.26.HDa*,A.22.HA
  Distance constraint 198: Removed A.26.HDb*,A.22.HB3 based on A.26.HDa*,A.22.HB3
  Distance constraint 200: Removed A.26.HDb*,A.22.HB2 based on A.26.HDa*,A.22.HB2
  Distance constraint 203: Removed A.26.HDb*,A.22.H based on A.26.HDa*,A.22.H
  Distance constraint 207: Removed A.26.HDb*,A.23.HA based on A.26.HDa*,A.23.HA
  Distance constraint 210: Removed A.26.HDb*,A.23.HB3 based on A.26.HDa*,A.23.HB3
  Distance constraint 211: Removed A.26.HDb*,A.23.H based on A.26.HDa*,A.23.H
  Distance constraint 212: Removed A.26.HDb*,A.24.H based on A.26.HDa*,A.24.H
  Distance constraint 213: Removed A.27.HBb,A.24.HA based on A.27.HBa,A.24.HA
  Distance constraint 215: Removed A.27.HBb,A.24.HB* based on A.27.HBa,A.24.HB*
  Distance constraint 219: Removed A.28.HBb,A.25.HA based on A.28.HBa,A.25.HA
  Distance constraint 222: Removed A.28.HDb*,A.25.HB3 based on A.28.HDa*,A.25.HB3
  Distance constraint 229: Removed A.26.HDb*,A.29.HB3 based on A.26.HDa*,A.29.HB3
  Distance constraint 230: Removed A.26.HDb*,A.29.H based on A.26.HDa*,A.29.H
  Distance constraint 231: Removed A.27.HBb,A.29.H based on A.27.HBa,A.29.H
  Distance constraint 234: Removed A.14.HGb*,A.29.HA based on A.14.HGa*,A.29.HA
  Distance constraint 235: Removed A.14.HGb*,A.29.HB3 based on A.14.HGa*,A.29.HB3
  Distance constraint 236: Removed A.14.HGb*,A.29.HB2 based on A.14.HGa*,A.29.HB2
  Distance constraint 237: Removed A.26.HDb*,A.16.HB3 based on A.26.HDa*,A.16.HB3
  Distance constraint 238: Removed A.26.HDb*,A.16.HB2 based on A.26.HDa*,A.16.HB2
  Distance constraint 244: Removed A.31.HG1b,A.16.HB3 based on A.31.HG1a,A.16.HB3
  Distance constraint 246: Removed A.31.HG1b,A.16.HB2 based on A.31.HG1a,A.16.HB2
  Distance constraint 247: Removed A.31.HG1b,A.16.H based on A.31.HG1a,A.16.H
  Distance constraint 252: Removed A.26.HDb*,A.19.HB3 based on A.26.HDa*,A.19.HB3
  Distance constraint 256: Removed A.26.HDb*,A.19.HB2 based on A.26.HDa*,A.19.HB2
  Distance constraint 259: Removed A.26.HDb*,A.19.H based on A.26.HDa*,A.19.H
  Distance constraint 261: Removed A.26.HDb*,A.20.H based on A.26.HDa*,A.20.H
  Distance constraint 262: Removed A.26.HDb*,A.21.HA2 based on A.26.HDa*,A.21.HA2
  Distance constraint 263: Removed A.26.HDb*,A.21.HA3 based on A.26.HDa*,A.21.HA3
  Distance constraint 264: Removed A.26.HDb*,A.21.H based on A.26.HDa*,A.21.H
Exception in Tkinter callback
Traceback (most recent call last):
  File "/Users/jd/workspace34/ccpnmr/python2.5/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__
    return self.func(*args)
  File "/Users/jd/workspace34/ccpnmr/ccpnmr2.0/python/ccpnmr/format/gui/ImportExportFormatPopup.py", line 565, in <lambda>
    self.exportButton[component] = Tkinter.Button(master, text = "Export %s file." % component, command = lambda comp = component: self.importExportFile(comp))
  File "/Users/jd/workspace34/ccpnmr/ccpnmr2.0/python/ccpnmr/format/gui/ImportExportFormatPopup.py", line 799, in importExportFile
    returnValue = rwFunc(*addArgs,**addKeywds)
  File "/Users/jd/workspace34/ccpnmr/ccpnmr2.0/python/ccpnmr/format/converters/DataFormat.py", line 945, in writeProject
    returnValue = self.createFullProject(fileName,**keywds)
  File "/Users/jd/workspace34/ccpnmr/ccpnmr2.0/python/ccpnmr/format/converters/NmrStarFormat.py", line 989, in createFullProject
    createSfFunc(constraintList)
  File "/Users/jd/workspace34/ccpnmr/ccpnmr2.0/python/ccpnmr/format/converters/NmrStarFormat.py", line 1543, in createDistanceConstraintsSf
    (constraintListID,sfKey) = self.setupConstraintSaveFrame(sfName,constraintList, subType = subType)
  File "/Users/jd/workspace34/ccpnmr/ccpnmr2.0/python/ccpnmr/format/converters/NmrStarFormat.py", line 2203, in setupConstraintSaveFrame
    constraintListID = returnInt(self.saveFrame.tags[self.saveFrame.prefix + tagSep + 'ID'])
KeyError: '_Distance_constraints.ID'

Original comment by jurge...@gmail.com on 11 Mar 2009 at 2:35

GoogleCodeExporter commented 9 years ago
You're not using the NmrStarExport.py code, but the 'old' setup (which is now 
getting
obsolete, as you found out!).

In any case, try something like this, from linkNmrStarData.py (modify it for 
your own
needs, of course):

      from msd.nmrStar.IO.NmrStarExport import NmrStarExport

      nmrStarExport = NmrStarExport(nmrEntry, nmrStarVersion = '3.1')
      nmrStarExport.createFile(outNmrStarFile)

      # Set the header comment - only set this if you need a standard header!
      topComment = "# File written for CING by NmrStarExport.py code"

      nmrStarExport.writeFile(title = "CING", topComment=topComment)

Original comment by wfvran...@gmail.com on 11 Mar 2009 at 4:54

GoogleCodeExporter commented 9 years ago
Ok, so Tim probably wants to update the Analysis code too at some point.

Thanks for the suggestion again. I'll try that out.

Original comment by jurge...@gmail.com on 11 Mar 2009 at 4:56

GoogleCodeExporter commented 9 years ago
Ok Wim, ik kom er nog niet helemaal uit. Kun jij een paar regels verzinnen?
Hieronder staat hoever ik kwam met je suggestie...

from msd.nmrStar.IO.NmrStarExport import NmrStarExport
from recoord2.msd.linkNmrStarData import LinkNmrStarData

class NmrStar():
    def __init__(self, project):
        self.project = project
        self.ccpnProject = self.project.ccpn

    def toNmrStarFile(self, fileName):
        """Return True or None on error"""          
#        nmrProject = self.ccpnProject.currentNmrProject      
#        origStrucGen = nmrProject.findFirstStructureGeneration(name = 
'Original constraints and structures')

        linkNmrStarData = LinkNmrStarData(" %s -raise -force  -noGui" % self.project.name )
        linkNmrStarData.idCode = self.project.name

        studyTitle = 'CING project'
        entryTitle = 'CING entry %s'
        entryDetails = entryTitle

        nmrEntry = linkNmrStarData.setupEntry(studyTitle,entryTitle,entryDetails)
        nmrStarExport = NmrStarExport(nmrEntry, nmrStarVersion = '3.1', forceEntryId = self.project.name)
        nmrStarExport.createFile(fileName)

        # Set the header comment - only set this if you need a standard header!
        topComment = "# File written for CING by NmrStarExport.py code"

        nmrStarExport.writeFile(title = "CING", topComment=topComment)

        return True

Gives:

Read msd.adatah.localConstants.py version 0.0.2
DEBUG: New project <Project 1brv>
Moving CCPN directory from [linkNmrStarData] to [1brv]
==> Importing data from Ccpn project "1brv"
DEBUG: Molecule.__init__: <Molecule "CING_1brv" (C:0,R:0,A:0,M:0)>
DEBUG: Using CCPN Structure Ensemble 'Original constraints and structures'
Non-standard (residues and their) atoms added:
GLU : O'   [ 189]
DEBUG: Calculating dihedral angles
DEBUG: modelCount: 1; Calculating mean coordinates
==> Molecule CING_1brv: Potential disulfide bridges: 2
DEBUG: Calculating rmsd's (ranges: None, models: None)
DEBUG: Defining topology
==> Ccpn molecule 'CING_1brv' imported
DEBUG: CCPN project contains no shift lists
DEBUG: New "DistanceRestraintList" instance named "DistanceRestraint"
DEBUG: New "DihedralRestraintList" instance named "DihedralRestraint"
DEBUG: No ccpnRDCListOfList which can be normal.
DEBUG: ==> Ccpn project imported
-------------------------------------------------------
==> Saving <Project 1brv>
==> Saved <Molecule "CING_1brv" (C:1,R:32,A:669,M:1)> to 
"1brv.cing/Data/Molecules/CING_1brv.molecule"
==> Saving <DistanceRestraintList "DistanceRestraint" (keep,264)> to 
1brv.cing/Data/Restraints/DistanceRestraint.distances
==> Saving <DihedralRestraintList "DihedralRestraint" (keep,29)> to 
1brv.cing/Data/Restraints/DihedralRestraint.dihedrals
Removing existing project...
Doing 1...
  Warning: No Ccpn__2_0_b1__To_NmrStar__3_1__ conversion class available, using Ccpn_To_NmrStar default.
E  Warning: no NMR-STAR version 3.1 dictionary available, using default.

======================================================================
ERROR: testNmrStar (__main__.AllChecks)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jd/workspace34/cing/python/cing/PluginCode/test/test_NmrStar.py", line 55, in testNmrStar
    self.assertTrue( nmrStar.toNmrStarFile( fileName ))
  File "/Users/jd/workspace34/cing/python/cing/PluginCode/NmrStar.py", line 22, in toNmrStarFile
    nmrStarExport = NmrStarExport(nmrEntry, nmrStarVersion = '3.1', forceEntryId = self.project.name)
  File "/Users/jd/workspace34/recoord/python/msd/nmrStar/IO/NmrStarExport.py", line 61, in __init__
    if not self.nmrEntry.root.currentChemElementStore:
AttributeError: 'NoneType' object has no attribute 'root'

----------------------------------------------------------------------
Ran 1 test in 3.649s

FAILED (errors=1)

Original comment by jurge...@gmail.com on 12 Mar 2009 at 12:03

GoogleCodeExporter commented 9 years ago
OK I see - it's necessary to set up the NmrEntry so NmrStarExport knows what to
export from the CCPN project. Try this (and modify if you have hooks to 
specific CCPN
objects from the CING project, obviously - I'm now just doing everything):

        nmrEntryStore = self.ccpnProject.newNmrEntryStore(name = self.ccpnProject.name)
        molSystem = self.ccpnProject.findFirstMolSystem() # Or something more intelligent

        nmrEntry = nmrEntryStore.newEntry(
                           molSystem = self.molSystem,
                           name = 'CING entry')

        nmrProject = self.ccpnProject.currentNmrProject

        nmrEntry.structureGenerations = nmrProject.sortedStructureGenerations()
        nmrEntry.structureAnalyses = nmrProject.sortedStructureAnalyses()
        nmrEntry.measurementLists = nmrProject.sortedMeasurementLists()

        for ne in nmrProject.sortedNmrExperiments():
          for ds in ne.sortedDataSources():
            for pl in ds.sortedPeakLists():
              nmrEntry.addPeakList(pl)

        nmrStarExport = NmrStarExport(nmrEntry, nmrStarVersion = '3.1', forceEntryId
= self.project.name)
        nmrStarExport.createFile(fileName)

        # Set the header comment - only set this if you need a standard header!
        topComment = "# File written for CING by NmrStarExport.py code"

        nmrStarExport.writeFile(title = "CING", topComment=topComment)

        return True

Original comment by wfvran...@gmail.com on 12 Mar 2009 at 2:41

GoogleCodeExporter commented 9 years ago
Thank you very much Wim.

I just had to make changes to 3 lines and your code works:

        nmrEntryStore = self.ccpnProject.newNmrEntryStore(name = "newName"+self.ccpnProject.name)
..
        nmrEntry.structureAnalyses = nmrProject.sortedStructureAnalysiss() # watch out for misspelling.
..
        for ne in nmrProject.sortedExperiments(): # will be sortedNmrExperiments?

Original comment by jurge...@gmail.com on 12 Mar 2009 at 3:18

GoogleCodeExporter commented 9 years ago
Fixed the problem with parallel parking the temporary data in the recoord 
project so this issue is cleared.
Tested on nmr in revision 554.
There is a mod needed to the recoord project which I've relayed to Wim.

Original comment by jurge...@gmail.com on 17 Apr 2009 at 8:29