Dear All,
We have found out the problem and Wayne will look at the best ways to
change the Analysis code to avoid it.
The error only comes when the Analysis code is called, so you can load
your data and get to fix them if you do not use Analysis. The easiest way
to do it might be to start the FormatConverter on its own. Alternatively
you can do it the hard way:
python
>>> from memops.xml import Implementation
>>> project = Implementation.load(open('myProject.xml'))
where myProject.xml is replaced by the full path from your start directory
to your project.xml. You now have your project, and can use the API
commands from teh command line to interact with the objects.
Yours,
Rasmus
PS, If you are *really* interested, here is some background - it is rather
arcane, I am afraid.
- The link SpectrumWindowView.dataSource is derived, one-way, and
mandatory. This means that it is calculated from other information only
when it is needed (derived), that the DataSource does not know that there
is a link to it (one-way), and that it is an error if there is no
DataSource found (mandatory). If you delete a DataSource that has a link
to it you will leave the derived link dangling - and when you then access
the link you will get an error. It so happens that Analysis makes a
function call (findFirstSpectumWIndowView) that accesses all the
dataSource links.
- Serials are almost guaranteed to be unique, but not quite. If you delete
the object with the highest serial (e.g. 9), save, quit, and re-enter the
program, the data do not remember that there was once an object with
serial=9, and so reuses serial 9. This is a bit naughty, but it would be
rather clunky to fix. Anyway, if you delete the Experiment with the
highest serial, leaving a dangling link, and then later add a new one with
the same serial, you may get some confusion.
Rasmus
---------------------------------------------------------------------------
Dr. Rasmus H. Fogh Email: [log in to unmask]
Dept. of Biochemistry, University of Cambridge,
80 Tennis Court Road, Cambridge CB2 1GA, UK. FAX (01223)766002
On Fri, 18 Feb 2005, Wayne Boucher wrote:
> It depends what you mean by "number 9". If that is the spectrum name that
> you entered when loading the spectrum then that is not the same as the
> serials. Both the experimentSerial and the dataSourceSerial are
> automatically set by the API (and are integers, not strings), whereas the
> spectrum (and experiment) name is chosen by the user. But if the "number
> 9" does refer to the experimentSerial then what you say can happen (I
> think, Rasmus would know for sure). Needless to say, when you delete a
> spectrum it is supposed to happen automatically that the associated
> spectrumWindowViews (for a given spectrum there is one for each
> spectrumWindow) get deleted, but that seems not to have happened here.
>
> A few more words about the error message, for the general audience. It
> mentioned "key[9, 1]" and if you look at the documentation for
> SpectrumWindowView:
>
> http://www.ccpn.ac.uk/ccpnmr/ccpnmr/python/ccpnmr/api/doc/Analysis/SpectrumWindowView/index.html
>
> you see that the "main key" is (experimentSerial, dataSourceSerial) so
> that is why it is experimentSerial=9 and dataSourceSerial=1.
>
> Wayne
>
> On Fri, 18 Feb 2005, Magnus Helgstrand wrote:
>
> > Hi!
> >
> > I do not know if this helps, but I originally had a 3D-spectrum as "number 9". I then deleted that spectrum and loaded a new 2D-spectrum. The new spectrum then got "number 9".
> >
> > Looking in the Analysis.xml file I now find:
> >
> > <SpectrumWindowView _ID="_5828" isPosVisible="true" isNegVisible="true" experimentSerial="9" dataSourceSerial="1" isSliceVisible="true">
> > <AxisMapping _ID="_5829" dim="1" label="x">
> > </AxisMapping>
> > <AxisMapping _ID="_5830" dim="2" label="z1">
> > </AxisMapping>
> > <AxisMapping _ID="_5831" dim="3" label="y">
> > </AxisMapping>
> > <WindowPeakList _ID="_5832" isSymbolDrawn="true" isAnnotationDrawn="true" peakListSerial="1">
> > </WindowPeakList>
> > </SpectrumWindowView>
> >
> > Which probably is data for the old spectrum.
> >
> > Magnus
> >
> > ----------------------------------
> > Magnus Helgstrand
> > Dept. of Biophysical Chemistry
> > Lund University
> > Box 124
> > SE-221 00 Lund
> > Sweden
> >
> > Phone: +46-46-2228173
> >
> > ----- Original Message -----
> > From: Wayne Boucher <[log in to unmask]>
> > Date: Thursday, February 17, 2005 1:18 pm
> > Subject: Re: Opening project error
> >
> > > Yuk. I'm not sure why you got that error message originally. It
> > > seems to
> > > be complaining that a spectrum (dataSource) does not exist
> > > although you
> > > have a peakList in your hand at that point and its parent is that
> > > spectrum. So how can it be failing? (Rasmus might have some
> > > ideas on
> > > this point.)
> > >
> > > The short-term fix for you is to delete that spectrumWindowView
> > > from the
> > > xml file. Before you do that make a copy of the old one just in case!
> > > The file you want to edit is in the ccpnmr directory of the
> > > project (so if
> > > the top project file is called test1.xml then the directory would
> > > normallybe test1/ccpnmr). In there is the Analysis.xml file.
> > > Edit that and look
> > > for the SpectrumWindowView with experimentSerial 9 and
> > > dataSourceSerial 1
> > > (which is what the error message is complaing about) and delete
> > > it. That
> > > means delete everything from
> > >
> > > <SpectrumWindowView _ID=... experimentSerial="9"
> > > dataSourceSerial="1" ...>
> > >
> > > down to
> > >
> > > </SpectrumWindowView>
> > >
> > > If you have multiple windows then this might need to be repeated
> > > for the
> > > other windows as well.
> > >
> > > Wayne
> > >
> > > On Thu, 17 Feb 2005, Magnus Helgstrand wrote:
> > >
> > > > Hi!
> > > >
> > > > After opening a spectra processed usgin NMRPipe I got the
> > > following error messages:
> > > >
> > > > Spectrum successfully opened
> > > > Exception in Tkinter callback
> > > > Traceback (most recent call last):
> > > > File "/usr/local/ccpnmr/python2.2/lib/python2.2/lib-
> > > tk/Tkinter.py", line 1316, in __call__
> > > > return apply(self.func, args)
> > > > File
> > > "/usr/local/ccpnmr/ccpnmr1.0/python/ccpnmr/analysis/OpenSpectrumPopup.py", line 191, in openSpectra
> > > > self.parent.finishInitSpectrum(spectrum)
> > > > File
> > > "/usr/local/ccpnmr/ccpnmr1.0/python/ccpnmr/analysis/Analysis.py", line 870, in finishInitSpectrum
> > > > self.initSpectrumPeakList(spectrum)
> > > > File
> > > "/usr/local/ccpnmr/ccpnmr1.0/python/ccpnmr/analysis/Analysis.py", line 918, in initSpectrumPeakList
> > > > Nmr.PeakList(spectrum, details = 'Default list')
> > > > File "/usr/local/ccpnmr/ccpnmr1.0/python/ccp/api/Nmr.py", line
> > > -11377, in __init__
> > > > File
> > > "/usr/local/ccpnmr/ccpnmr1.0/python/ccpnmr/analysis/Analysis.py", line 1265, in initPeakList
> > > > view = window.findFirstSpectrumWindowView(dataSource=spectrum)
> > > > File
> > > "/usr/local/ccpnmr/ccpnmr1.0/python/ccpnmr/api/Analysis.py", line
> > > 13814, in findFirstSpectrumWindowView
> > > > if (getattr(v, key) == condition):
> > > > File
> > > "/usr/local/ccpnmr/ccpnmr1.0/python/ccpnmr/api/Analysis.py", line
> > > 15635, in getDataSource
> > > > raise
> > > ApiError("ccpnmr.Analysis.SpectrumWindowView.getDataSource:">
> > > ApiError: ccpnmr.Analysis.SpectrumWindowView.getDataSource: No
> > > object found for mandatory derived link using key[9, 1]
> > > >
> > > > After a while I quit Analysis and saved my project. When trying
> > > to open it again the project file was corrupted and I got the
> > > following error message:
> > > >
> > > > "Project invalid, please quit, fix and restart:
> > > ccpnmr.Analysis.Spectrum WindowView.getDataSource: No object found
> > > for mandatory derived link using key[9, 1]"
> > > >
> > > > Quit, fix and re-start sound easy enough, but how do I do that
> > > in real life? I need my project...
> > > >
> > > > Magnus
> > > >
> > > > ----------------------------------
> > > > Magnus Helgstrand
> > > > Dept. of Biophysical Chemistry
> > > > Lund University
> > > > Box 124
> > > > SE-221 00 Lund
> > > > Sweden
> > > >
> > > > Phone: +46-46-2228173
> > > >
> > >
> >
>
|