>> Couldn't remember whether Link Seq Spin Systems is supposed to work with a
>> target window that posesses horizontal separators?
>
> I tried this and it seemed to "work" for me, where "work" means that the
> code deletes the extra row(s).
OK, I think I can answer this now - the current code does/should delete
the extra rows.
> Now it looks like for you that it fell over when trying to delete the
> extra row(s). So this might be a timing issue.
I had the query & target windows being the same, which I now remember is
not really how it's meant to be used. I don't get the falling over
problem when I use different query & target windows, so probably a timing
issue as you say.
> But the more general question is whether the extra horizontal
> row(s) should remain. It sounds like you would prefer that and I'm not
> sure if Tim intentionally didn't want that or (more likely) this is just
> an unexpected side effect. (He's not here today.)
It would be a nice feature for handling e.g. CA, CB & CO triple resonance
data. I think we've discussed it before, but I think Tim maybe has some
major alterations to the sequential assignment tool(s) coming up, or at
least in mind?
In the meantime, I knocked together a rough macro (attached) for
reproducing a set of strips at the same x & z1 positions from one window
to another but leaving the y position alone in the target window. Thus
it's easier to check a set of e.g. CO strips that match CA & CB strips.
Quite convenient boud to a keyboard shortcut and with the window menu that
pops up resized a little from its default so that you can see the window
names.
There's still a slight problem with it - displayStrips from WindowBasic is
the key to the macro, but it seems that if it's creating new strips, they
don't arrive at quite the right (x?, z1 is certainly OK) position.
Repeating the call to the macro fixes this, but doubling the call to
displayStrips within the macro doesn't seem to - another timing problem?
Dr. Brian O. Smith ---------------------- B Smith at bio gla ac uk
Division of Biochemistry & Molecular Biology,
Institute Biomedical & Life Sciences,
Joseph Black Building, University of Glasgow, Glasgow G12 8QQ, UK.
#from ccpnmr.analysis.UnitConverter import pnt2ppm, ppm2pnt
from ccpnmr.analysis.WindowBasic import displayStrips
def sameStrips(argServer, startWindow=None, targetWindow=None):
assert argServer or (startWindow and targetWindow)
if not startWindow:
startWindow = argServer.getCurrentWindow()
if not startWindow:
argServer.showWarning('No starting spectrum window')
return
if not targetWindow:
targetWindow = argServer.getWindow()
if not targetWindow:
argServer.showWarning('No target spectrum window')
return
#hardwired for x strips (could be generalised & mode nicer I'm sure)
stripAxis = 'x'
axisRegions = startWindow.findFirstAxisPanel(label=stripAxis).sortedAxisRegions()
positions = []
#find y position of targetWindow to put into positions
targYRegion = targetWindow.findFirstAxisPanel(label='y').findFirstAxisRegion()
targYPos = calcAxisMidpoint(targYRegion)
#print axisRegions
for strip in axisRegions:
#find positions of current strips in startWindow
pos = findPosition(startWindow,strip.serial)
pos['y'] = targYPos
positions.append(pos)
#displayStrips from WindowBasic.py in targetWindow
# NB newly created strips don't seem to get to right position so currently have to do this whole macro twice
#print positions
displayStrips(argServer.parent, positions, orthoPositions=None, spectrum=None, window=targetWindow)
#stolen from WindowDraw.py and modified to find position in all dims
#arguments are window and strip number
def findPosition(window, n):
position = {}
for axisPanel in window.sortedAxisPanels():
#if it's the strip axis get the appropriate x & z1 (for now - could be generalised)
if (axisPanel.label == 'x' or axisPanel.label == 'z1'):
axisRegion = axisPanel.findFirstAxisRegion(serial=n)
position[axisPanel.label] = calcAxisMidpoint(axisRegion)
#on the non-strip axis get the y (again should be generalised)
elif (axisPanel.label == 'y'):
axisRegion = axisPanel.findFirstAxisRegion()
position[axisPanel.label] = calcAxisMidpoint(axisRegion)
#print "strip, ",n, position
return position
#stolen from WindowDraw.py
def calcAxisMidpoint(axisRegion):
(z0, z1) = axisRegion.region
return 0.5 * (z0 + z1)
|