Hi Igor,
To further clarify: if the resonance.covalentlyBound links are set
correctly, then it will be trivial to get the proton resonances connected
to a carbon resonance:
connectedProtonResonances = []
for connectedResonance in carbonResonance.covalentlyBound:
if connectedResonance.isotopeCode == '1H':
connectedProtonResonances.append(connectedResonance)
With the way things are currently set up within Analysis, if you would
want to modify the getProtonResFromCarbRes() function I send earlier,
you'd first need the following function:
def getAnalysisAmbigProchiralLabel(resonance):
prochiralLabel = None
analysisAppData = resonance.findFirstApplicationData(application ='Analysis',keyword='ambigProchiralLabel')
if analysisAppData:
prochiralLabel = analyisAppData.value
return prochiralLabel
and then also:
def getProtonResFromCarbRes(resonance):
prochiralLabel = getAnalysisAmbigProchiralLabel(resonance)
...
for protResonance in protResonances[:]:
if getAnalysisAmbigProchiralLabel(protResonance) != prochiralLabel:
protResonances.pop(protResonances.index(protResonance))
return protResonances
This is assuming it's a project that's been handled by Analysis earlier -
the code itself does not require any Analysis package imports. Also, I
didn't test this bit of code so there could by typo's in here... .
Bye,
Wim
|