Seems to work a treat - thanks very much.
A Delete button for the DataLocation table would certainly be the most
straight forward option, though if possible there should probably be a
warning in place to stop a user from accidentally deleting a
DataLocation which is still associated with an existing spectrum/experiment.
Vicky
Wayne Boucher wrote:
> Hello,
>
> Unfortunately the code further down will not work, because you cannot
> delete a url if there is still a dataLocation associated with it (the API
> does not allow it). The real solution here would be for us to add a
> delete button to the DataLocation table. The reason we have not is a
> slightly arcane data model issue which I'm not sure is worth going into
> here. So for now you can do:
>
>
>>>> p = top.project
>>>> u = p.findFirstUrl(serial=knownSerial)
>>>> for d in u.dataLocations:
>>>>
> ... d.delete()
> ...
>
>>>> u.delete()
>>>>
>
> (Note that the knownSerial can be obtained from the Save As dialog, in the
> Url table.) Then do an ordinary save. Obviously be careful with this!
>
> Wayne
>
> On Wed, 31 Oct 2007, Rasmus Fogh wrote:
>
>
>> Dear All,
>>
>> OOps, typo. That sould have been
>> myUrl = top.project.findFirstUrl(serial=knownSerial)
>>
>> ---------------------------------------------------------------------------
>> 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 Wed, 31 Oct 2007, Rasmus Fogh wrote:
>>
>>
>>> Dear Vicky,
>>>
>>> You can delete the Url on the Python command line. That does mean that you
>>> yourself have to make sure you are not deleting anything you will miss.
>>> The following should work:
>>>
>>> # first get the Url - you must know the serial
>>> myUrl = top.project.findFirdtUrl(serial=knownSerial)
>>>
>>> # check that there are no storages - just to be safe.
>>> print myUrl.storages
>>>
>>> # check that there are no DataLocations you want to keep
>>> print myUrl.dataLocations
>>>
>>> # if you are happy, delete the Url
>>> myUrl.delete()
>>>
>>> Yours,
>>>
>>> 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 Tue, 30 Oct 2007, Vicky Higman wrote:
>>>
>>>
>>>>> You can remove the Url in the "save as" dialog. It will only let you do
>>>>> this if there are no storages and no data locations using the Url. (So
>>>>> are there storages that are using this? That is more complicated then.)
>>>>>
>>>>>
>>>> The problem is definitely data locations rather than storages. In fact
>>>> I have now worked out that where I moved spectra from one location to
>>>> another, the old URLs now have no storages and data locations associated
>>>> with them and can indeed be deleted. The problem seems to arise from
>>>> experiments/spectra which I have deleted from the project: the data
>>>> locations are still there although the spectra and experiments aren't.
>>>> Any way I can now get rid of these superfluous data locations (and then
>>>> after that I should be able to delete the URLs)?
>>>>
>>>> Thanks,
>>>>
>>>> Vicky
>>>>
>>>>
>>>>
>>>>> Wayne
>>>>> On Mon, 29 Oct 2007, Vicky Higman wrote:
>>>>>
>>>>>
>>>>>
>>>>>> Hi Tim,
>>>>>>
>>>>>>
>>>>>>> I have noticed that the project's data directory (when "Correspondingly
>>>>>>> change related paths" is selected) does not actually change when you alter
>>>>>>> the project file name unless you also happen to press <Return> in the
>>>>>>> "Project file:" text entry slot after. Accordingly, the project filename
>>>>>>> might not be getting set internally until the <Return> event. If you open
>>>>>>> the URLs tab then you ought to get a reddened row to indicate a change of
>>>>>>> project directory.
>>>>>>>
>>>>>>> If this is the problem for you, then there may be a quick tweak that we
>>>>>>> can do, but as Wayne mentions in the new implementation this is all much
>>>>>>> simpler and more robust.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> I don't think this was the problem - as I definitely remember various
>>>>>> scenarios involving red rows in the URL table.
>>>>>>
>>>>>> However, when I had a go again just now, I came across a different
>>>>>> problem concerning a URL which I no longer use (it's not linked to any
>>>>>> experiments or spectra any more), but is still in the URL table. The
>>>>>> actual directory doesn't exist any more and when doing a 'Detailed Save'
>>>>>> Analysis asks me whether I want to create it - but I don't have write
>>>>>> permission to be able to do so (and I don't want to create it in any
>>>>>> case). Is there a way of removing unwanted URLs? Is it best just to
>>>>>> remove the relevant lines from the project.xml file?
>>>>>>
>>>>>> Another query regarding my whole 'project overhaul' is that I have a
>>>>>> couple of spectra which I read in as Bruker data rather than as ucsf
>>>>>> files. I would now like to go over to using the ucsf files - is there a
>>>>>> straight forward way of doing this in Analysis - can I just change the
>>>>>> File Details? Or would it be best just to delete the Bruker
>>>>>> spectra/experiments and read the ucsf ones in newly and transfer peaks
>>>>>> etc. by hand (not a total disaster as they are only 2Ds - so won't take
>>>>>> particularly long).
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Vicky
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> ****************************************************
>>>>>> Dr. Victoria A. Higman
>>>>>> Leibniz-Institut fuer Molekulare Pharmakologie (FMP)
>>>>>> NMR-Supported Structural Biology
>>>>>> Robert-Roessle-Str. 10
>>>>>> 13125 Berlin
>>>>>> Germany
>>>>>> Phone: +49-30-94793 223
>>>>>> E-mail: [log in to unmask]
>>>>>> ****************************************************
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>> --
>>>> ****************************************************
>>>> Dr. Victoria A. Higman
>>>> Leibniz-Institut fuer Molekulare Pharmakologie (FMP)
>>>> NMR-Supported Structural Biology
>>>> Robert-Roessle-Str. 10
>>>> 13125 Berlin
>>>> Germany
>>>> Phone: +49-30-94793 223
>>>> E-mail: [log in to unmask]
>>>> ****************************************************
>>>>
>>>>
>
>
--
****************************************************
Dr. Victoria A. Higman
Leibniz-Institut fuer Molekulare Pharmakologie (FMP)
NMR-Supported Structural Biology
Robert-Roessle-Str. 10
13125 Berlin
Germany
Phone: +49-30-94793 223
E-mail: [log in to unmask]
****************************************************
|