ccpn.core package

CCPN core package. High level interface for normal data access

Projects are saved by myProject.save(path, ...)

Within the CcpNmr suite there is always a project open, assigned to the variable ‘project’.

Module Organisation

Class Hierarchy

Classes are organised in a hierarchy, with all data objects ultimately contained within the Project: The diagram shows the hierarchy, with child objects displaced to the right of the containing parent object. E.g. Spectrum, SpectrumGroup, and DataSet are all children of Project; PeakList and IntegralList are both children of Spectrum; and Peak is a child of PeakList.

Project
\-------Spectrum
        \-------SpectrumReference
        \-------PeakList
                \-------Peak
        \-------IntegralList
                \-------Integral
        \-------PseudoDimension
        \-------SpectrumHit
\-------SpectrumGroup
\-------Sample
        \-------SampleComponent
\-------Substance
\-------Chain
        \-------Residue
                \-------Atom
\-------Complex
\-------NmrChain
        \-------NmrResidue
                \-------NmrAtom
\-------ChemicalShiftList
        \-------ChemicalShift
\-------DataSet
        \-------RestraintList
                \-------Restraint
                        \-------RestraintContribution
        \-------CalculationStep
        \-------Data
\-------StructureEnsemble
        \-------Model
\-------Note

The Project object serves as container for all other data objects and the starting point for navigation.

A Spectrum object contains all the stored properties of a spectrum, as well as the path to the stored NMR data file.

A SpectrumReference holds detailed information about axes and referencing needed for e.g. multple-quantum, projection, and reduced-dimensionality experiments.

A PeakList serves as a container for Peak objects, which contain Peak position, intensity and assignment information.

An IntegralList serves as a container for Integral objects, which contain Integral intervals and values.

A PseudoDimension object is used to describe sampled-value axes, such as the time delay axis for T1 experiments.

A SpectrumHis object is used in screening and metabolomics implementations to describe that a Substance has been found to be present (metabolomics) or active (screening) in a given spectrum.

A SpectrumGroup combines multiple Spectrum objects, so they can be treated as a single object.

A Sample corresponds to an NMR sample. It is made up of SampleComponents, which indicate which individual chemical entities make up that Sample, (e.g. protein, buffer, salt), and their concentrations.

A Substance object represents a defined chemical entity, e.g. Lysozyme, ATP, NaCl, or (less commonly) a composite material like fetal calf serum or standard lysis buffer.

A Chain object corresponds to a molecular chain. It is made up of Residue objects, which in turn are made up of Atom objects.

A Complex is a group of chain objects, combined so that they can be treated as a single object.

Assignment is done through a hierarchy of NmrChain, NmrResidue, and NmrAtom objects. that parallels the hierarchy of molecular chains. An NmrChain (NmrResidue, Atom) is considered assigned to the Chain (Residue, Atom) with the same ID. NmrAtom objects serve as a way of connecting a named nucleus to an observed chemical shift, and peaks are assigned to NmrAtoms.

A ChemicalShiftList object is a container for ChemicalShift objects, which represent observed chemical shifts.

DataSet objects serve to group RestraintLists and other input and output from a calculation.

A RestraintList contains Restraint Objects of a specific type (distance, dihedral, etc.). RestraintContribution objects hold the detailed information; they are needed for complex restraints, like coupled phi and psi dihedral restraints.

The CalculatioinStep object is used to track the calculation history of DataSets, storing input and output DataSet IDs, and the names of the programs used.

Data object storing links to the data structures (PeakLists, Spectra, StructureEnsembles etc.) connected to a given DataSet, and their associated calculation parameters.

A StructureEnsemble object is a container for ensembles of coordinate structures, with each coordinate structure defined by a Model object.

Note objects contain free-text information to be stored in a project.

Common Class elements

All classes in this module are subclasses of the ccpn-AbstractWrapperObject-ref, and inherit the following elements:

project - ccpn.core.Project

The Project (root) containing the object.

pid - ccpn.util.Pid.Pid

Identifier for the object, unique within the project. Set automatically from the short class name and object.id E.g. ‘NA:A.102.ALA.CA’

longPid - ccpn.util.Pid.Pid

Identifier for the object, unique within the project. Set automatically from the full class name and object.id E.g. ‘NmrAtom:A.102.ALA.CA’

id - str

Identifier for the object, used to generate the pid and longPid. Generated by combining the id of the containing object, with the value of one or more key attributes that uniquely identify the object in context. E.g. the id for an Atom, ‘A.55.VAL.HA’ is generated from:

  • ‘A’ Chain.shortName
  • ‘55’ Residue.sequenceCode
  • ‘VAL’ Residue.residueType
  • ‘HA’ Atom.name

delete()

Delete object, with all contained objects and underlying data.

getByPid(pidString)

Get an arbitrary data object from either its pid (e.g. ‘SP:HSQC2’) or its longPid (e.g. ‘Spectrum:HSQC2’

Returns None for invalid or unrecognised input strings.

rename(newName)

Change the object name or other key attribute(s), changing the object id, pid, and all internal references to maintain consistency. A number of Objects (Chain, Residue, Atom, Peak, cannot be renamed

Data access

The data of objects are accessed with the normal Python syntax (x = object.value; object.value = x. There are no public getter and setter functions. For collections you will get an unmodifiable copy of the internal collection, to prevent accidental modification of the data (e.g. myPeakList.peaks will return a tuple, not a list)

Each object has a link to the containing (parent) object (e.g. myPeakList.spectrum)

Each class has a link to contained objects, and a function to get a contained object by relative id. E.g. myProject.peaks, mySpectrum.peaks, and myPeakList.peaks will each get all peaks contained within the relevant object, sorted by Peak id. Similarly, a given peak can be found by either myProject.getPeak(‘HSQC2.1.593’), mySpectrum.getPeak(‘1.593’), or myPeakList.getPeak(‘593’)

Most objects can be created using a newXyzObject method on the parent. E.g. you can create a new Restraint object with the myRestraintList.newRestraint(...) function. ‘new’ functions create a single objects, using the passed-in parameters. There is no ‘newSpectrum’ function; spectra are created with ‘loadSpectrum’ as a complete spectrum object requires an external file with the data.

More complex object creation is done with ‘create...()’ functions, that may create multiple objects, and use heuristics to fill in missing parameters. E.g. the myRestraintList.createRestraint(....) function creates a Restraint with the contained RestraintContributions and restraintItems.

Functions whose names start with ‘get’ (e.g. getNmrAtom(...)) mostly take some kind of identifier as an argument and returns the identified object if it exists, None otherwise.

Functions whose names start with ‘fetch’ (e.g. fetchNmrAtom(...)) also take some kind of identifier as an argument. These will return the identified object if it exists, but will create a new object otherwise.

Other common prefixes for function names include ‘add’ and ‘remove’ (which add and remove pre-existing objects to collections), ‘copy’, ‘clear’, ‘load’, ‘process’ and ‘toggle’, all of which should be self-explanatory.

Submodules

ccpn.core.Atom module

class ccpn.core.Atom.Atom[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

A molecular Atom, contained in a Residue.

addInterAtomBond(atom: ccpn.core.Atom.Atom)[source]

ADVANCED Add generic bond between atoms - for creating disulfides or other crosslinks The bound-to atom will appear in self.boundAtoms.

NB This function does not remove superfluous atoms (like CYS HG), or check for chemical plausibility. Programmer beware!

boundAtoms

- Tuple[Atom], immutable - Atoms that are covalently bound to this Atom

className = 'Atom'
name

- str, immutable - Atom name string (e.g. ‘HA’)

nmrAtom

- ccpn.core.NmrAtom.NmrAtom, mutable - NmrAtom to which Atom is assigned

residue

- ccpn.core.Residue.Residue, immutable - Residue containing Atom.

shortClassName = 'MA'

Class name and Short class name, for PID.

ccpn.core.CalculationStep module

class ccpn.core.CalculationStep.CalculationStep[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

CalculationStep information, for tracking successive calculations. Ordered from oldest to newest

className = 'CalculationStep'
dataSet

- ccpn.core.DataSet.DataSet, immutable - DataSet containing RestraintList.

inputDataSet

- ccpn.core.DataSet.DataSet=None, mutable - Calculation input data set.

inputDataUuid

- str=None, mutable - Universal identifier (uuid) for calculation input data set.

outputDataSet

- ccpn.core.DataSet.DataSet=None, mutable - Calculation output data set.

outputDataUuid

- str=None, mutable - Universal identifier (uuid) for calculation output data set

programName

- str, mutable - Name of program doing calculation

programVersion

- str=None, mutable - Version of program doing calculation

script

- str=None, mutable - Text of script used for calculation

scriptName

- str=None, mutable - Name of script used for calculation

serial

- int, immutable - serial number of CalculationStep, used in Pid and to identify the CalculationStep.

shortClassName = 'DC'

Short class name, for PID.

ccpn.core.Chain module

class ccpn.core.Chain.Chain[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

A molecular Chain, containing one or more Residues.

atoms

- (‘ccpn.core.Atom.Atom,) - contained Atom objects sorted by id

className = 'Chain'
clone(shortName: str = None) → ccpn.core.Chain.Chain[source]

Make copy of chain.

comment

- str, mutable - Free-form text comment.

compoundName

- str, immutable - Short name of chemical compound (e.g. ‘Lysozyme’) making up Chain

getAtom(relativeId: str) → ccpn.core.Atom.Atom

Get contained ‘ccpn.core.Atom.Atom object by relative ID

getResidue(relativeId: str) → ccpn.core.Residue.Residue

Get contained ‘ccpn.core.Residue.Residue object by relative ID

isCyclic

- bool, immutable - True if this is a cyclic polymer.

nmrChain

- ccpn.core.NmrChain.NmrChain, mutable - NmrChain to which Chain is assigned

rename(value: str)[source]

Rename Chain, changing its shortName and Pid.

residues

- (‘ccpn.core.Residue.Residue,) - contained Residue objects sorted by id

role

- str, mutable - The role of the chain in a molecular complex or sample - free text. Could be ‘free’, ‘’bound’, ‘open’, ‘closed’, ‘minor form B’, ...

shortClassName = 'MC'

Short class name, for PID.

shortName

- str, immutable - short form of name

substance

- ccpn.core.Substance.Substance=None, immutable - Substance with sequence matching to Chain

If there are multiple matches, select labeling==’std’ or, failing that, the first found (sorting alphabetically on labeling)

ccpn.core.ChemicalShift module

class ccpn.core.ChemicalShift.ChemicalShift[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Chemical Shift.

chemicalShiftList

- ccpn.core.Project.Project, immutable - ChemicalShiftList containing ChemicalShift.

className = 'ChemicalShift'
comment

- str, mutable - Free-form text comment

figureOfMerit

- str, mutable - Figure of Merit for ChemicalShift, between 0.0 and 1.0 inclusive.

nmrAtom

- ccpn.core.NmrAtom.NmrAtom, immutable - NmrAtom that the shift belongs to

shortClassName = 'CS'

Short class name, for PID.

value

- float, mutable - shift value of ChemicalShift, in unit as defined in the ChemicalShiftList

valueError

- float, mutable - shift valueError of ChemicalShift, in unit as defined in the ChemicalShiftList

ccpn.core.ChemicalShiftList module

class ccpn.core.ChemicalShiftList.ChemicalShiftList(project: ccpn.core.Project.Project, wrappedData: ccpnmodel.ccpncore.api.ccp.nmr.Nmr.ShiftList)[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

An object containing Chemical Shifts. Note: the object is not a (subtype of a) Python list. To access all ChemicalShift objects, use chemicalShiftList.chemicalShifts.

A chemical shift list named ‘default’ is used by default for new experiments, and is created if necessary.

autoUpdate

- bool, mutable - Automatically update Chemical Shifts from assigned peaks - True/False

chemicalShifts

- (‘ccpn.core.ChemicalShift.ChemicalShift,) - contained ChemicalShift objects sorted by id

className = 'ChemicalShiftList'
comment

- str, mutable - Free-form text comment

getChemicalShift(relativeId: str) → ccpn.core.ChemicalShift.ChemicalShift

Get contained ‘ccpn.core.ChemicalShift.ChemicalShift object by relative ID

isSimulated

- bool, mutable - True if the ChemicalShiftList is simulated.

name

- str, immutable - name of ChemicalShiftList.

newChemicalShift(value: float, nmrAtom: ccpn.core.NmrAtom.NmrAtom, valueError: float = 0.0, figureOfMerit: float = 1.0, comment: str = None) → ccpn.core.ChemicalShift.ChemicalShift

Create new ChemicalShift within ChemicalShiftList.

rename(value: str)[source]

Rename ChemicalShiftList, changing its name and Pid.

serial

- int, immutable - Shift list serial number

shortClassName = 'CL'

Short class name, for PID.

spectra

- Tuple[ccpn.core.Spectrum.Spectrum, ...], mutable - ccpn.Spectra that use ChemicalShiftList to store chemical shifts

unit

- str, mutable - Measurement unit of ChemicalShiftList. Should always be ‘ppm’

ccpn.core.Complex module

class ccpn.core.Complex.Complex[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

A group of Chains, which can be used as a single object to describe a molecular complex.

NB NOT YET IMPLEMENTED

className = 'Complex'
shortClassName = 'MX'

Class name and Short class name, for PID.

ccpn.core.Data module

class ccpn.core.Data.Data[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Object storing links to the data structures (PeakLists, Spectra, StructureEnsembles etc.) connected to a given DataSet, and their associated calculation parameters.

attachedObject

- ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject=None, mutable - attached object - derived from self.attachedObjectPid.

If no attached object matching attachedObjectPid can be found (object has been renamed, deleted, or teh attachedObjectPid is incorrect) this attriibute has the value None.

attachedObjectPid

- str=None, mutable - Pid for attached object - used to calculate the attachedObject

Remains unchanged also if the object pointed to is renamed or deleted, to preserve, as far as possible, the original data.

calculationStep

- ccpn.core.DataSet.DataSet, immutable - DataSet containing Data.

className = 'Data'
clearParameters()[source]

Delete all parameters

deleteParameter(name: str)[source]

Delete parameter named ‘name’

name

- str, immutable - name of Data object, used in Pid and to identify the Data object.

parameters

- dict, immutable - Keyword-value dictionary of parameters. NB the value is a copy - modifying it will not modify the actual data. Use the setParameter, deleteParameter, clearParameters, and updateParameters methods to modify the parameters.

Dictionary alues can be anything that can be exported to JSON, including OrderedDict, numpy.ndarray, ccpn.util.Tensor, or pandas DataFrame, Series, or Panel

rename(value: str)[source]

Rename Data, changing its nmme and Pid

setParameter(name: str, value)[source]

Add name:value to parameters, overwriting existing entries

shortClassName = 'DA'

Short class name, for PID.

updateParameters(value: dict)[source]

Convenience routine, similar to dict.update(). Calls self.setParameter(key, value) for each key,value pair in the input.

ccpn.core.DataSet module

class ccpn.core.DataSet.DataSet[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Data set. Used to store the input to (or output from) a calculation, including data selection and parameters, to group Restraints that are used together, to track data history and file loads.

calculationSteps

- (‘ccpn.core.CalculationStep.CalculationStep,) - contained CalculationStep objects sorted by id

className = 'DataSet'
comment

- str, mutable - Free-form text comment

creationDate

- datetime.datetime=None, mutable - Creation timestamp for DataSet

data

- (‘ccpn.core.Data.Data,) - contained Data objects sorted by id

dataPath

- str=None, mutable - File path where dataSet is stored

getCalculationStep(relativeId: str) → ccpn.core.CalculationStep.CalculationStep

Get contained ‘ccpn.core.CalculationStep.CalculationStep object by relative ID

getData(relativeId: str) → ccpn.core.Data.Data

Get contained ‘ccpn.core.Data.Data object by relative ID

getRestraint(relativeId: str) → ccpn.core.Restraint.Restraint

Get contained ‘ccpn.core.Restraint.Restraint object by relative ID

getRestraintContribution(relativeId: str) → ccpn.core.RestraintContribution.RestraintContribution

Get contained ‘ccpn.core.RestraintContribution.RestraintContribution object by relative ID

getRestraintList(relativeId: str) → ccpn.core.RestraintList.RestraintList

Get contained ‘ccpn.core.RestraintList.RestraintList object by relative ID

inputCalculationSteps

- List[ccpn.core.CalculationStep.CalculationStep], immutable - ccpn.CalculationSteps (from this DataSet) that yielded DataSet as output NB there can be more than one, because the DataSet may result from multiple calculations that do not have intermediate DataSets stored

newCalculationStep(programName: str = None, programVersion: str = None, scriptName: str = None, script: str = None, inputDataUuid: str = None, outputDataUuid: str = None, inputDataSet: ccpn.core.DataSet.DataSet = None, outputDataSet: ccpn.core.DataSet.DataSet = None) → ccpn.core.CalculationStep.CalculationStep

Create new CalculationStep within DataSet

newData(name: str, attachedObjectPid: str = None, attachedObject: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject = None) → ccpn.core.Data.Data

Create new Data within DataSet

newRestraintList(restraintType, name: str = None, origin: str = None, comment: str = None, unit: str = None, potentialType: str = 'unknown', tensorMagnitude: float = 0.0, tensorRhombicity: float = 0.0, tensorIsotropicValue: float = 0.0, tensorChainCode: str = None, tensorSequenceCode: str = None, tensorResidueType: str = None, serial=None, itemLength=None) → ccpn.core.RestraintList.RestraintList

Create new RestraintList of type restraintType within DataSet

outputCalculationSteps

- List[ccpn.core.CalculationStep.CalculationStep], immutable - ccpn.CalculationSteps (from other DataSets) that used DataSet as input

programName

- str, mutable - Name of program performing the calculation

programVersion

- str=None, mutable - Version of program performing the calculation

restraintContributions

- (‘ccpn.core.RestraintContribution.RestraintContribution,) - contained RestraintContribution objects sorted by id

restraintLists

- (‘ccpn.core.RestraintList.RestraintList,) - contained RestraintList objects sorted by id

restraints

- (‘ccpn.core.Restraint.Restraint,) - contained Restraint objects sorted by id

serial

- int, immutable - serial number of DataSet, used in Pid and to identify the DataSet.

shortClassName = 'DS'

Short class name, for PID.

title

- str, mutable - Title of DataSet (not used in PID).

uuid

- str=None, mutable - Universal identifier for dataSet

ccpn.core.Integral module

class ccpn.core.Integral.Integral[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

n-dimensional Integral, with integration region and value.

Includes fields for per-dimension values.

annotation

- str=None, mutable - Integral text annotation

axisCodes

- Tuple[str, ...], immutable - Spectrum axis codes in dimension order matching position.

bias

- float, mutable - Baseplane offset used in calculating integral value

className = 'Integral'
comment

- str=None, mutable - Free-form text comment

figureOfMerit

- float=None, mutable - figureOfMerit of Integral, between 0.0 and 1.0 inclusive.

integralList

- ccpn.core.IntegralList.IntegralList, immutable - IntegralList containing Integral.

limits

- List[Tuple[float, float]], mutable - Integration limits in axis value (ppm), per dimension, with lowest value first

For Fid or sampled dimensions the individual limit values will be points

pointlimits

- List[Tuple[float, float]], mutable - Integration limits in points, per dimension, with lowest value first

serial

- int, immutable - serial number of Integral, used in Pid and to identify the Integral.

shortClassName = 'IT'

Short class name, for PID.

slopes

- List[float], mutable - slope (in dimension order) used in calculating integral value

The slope is defined as the intensity in point i+1 minus the intensity in point i

value

- float=None, mutable - value of Integral

valueError

- float=None, mutable - value error of Integral

ccpn.core.IntegralList module

class ccpn.core.IntegralList.IntegralList[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

An object containing Integrals. Note: the object is not a (subtype of a) Python list. To access all Integral objects, use integralList.integrals.

className = 'IntegralList'
comment

- str, mutable - Free-form text comment

getIntegral(relativeId: str) → ccpn.core.Integral.Integral

Get contained ‘ccpn.core.Integral.Integral object by relative ID

integrals

- (‘ccpn.core.Integral.Integral,) - contained Integral objects sorted by id

newIntegral(value: List[float] = None, valueError: List[float] = None, bias: float = 0, slopes: List[float] = None, figureOfMerit: float = 1.0, annotation: str = None, comment: str = None, limits: Sequence[Tuple[float, float]] = (), pointLimits: Sequence[Tuple[float, float]] = ()) → ccpn.core.Integral.Integral

Create new Integral within IntegralList

serial

- int, immutable - serial number of IntegralList, used in Pid and to identify the IntegralList.

shortClassName = 'IL'

Short class name, for PID.

spectrum

- ccpn.core.Spectrum.Spectrum, immutable - Spectrum containing IntegralList.

symbolColour

- str, mutable - Symbol colour for integral annotation display

textColour

- str, mutable - Text colour for integral annotation display

title

- str, mutable - title of IntegralList (not used in PID).

ccpn.core.Model module

class ccpn.core.Model.Model[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

ccpn.Model - Structural Model, or one member of the structure ensemble.

atomNameData

- numpy.ndarray, mutable - atomCount length numpy array of model-specific atom names.

bFactorData

- numpy.ndarray, mutable - atomCount length numpy array of B factors.

className = 'Model'
comment

- str, mutable - Free-form text comment

coordinateData

- numpy.ndarray, mutable - atomCount * 3 numpy array of coordinates.

occupancyData

- numpy.ndarray, mutable - atomCount length numpy array of occupancies.

serial

- int, immutable - ID number of Model, used in Pid and to identify the Model.

shortClassName = 'MD'

Short class name, for PID.

structureEnsemble

- ccpn.core.StructureEnsemble.StructureEnsemble, immutable - StructureEnsemble containing Model.

title

- str, mutable - title of Model (not used in PID).

ccpn.core.NmrAtom module

class ccpn.core.NmrAtom.NmrAtom[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

NmrAtom objects are used for assignment. An NmrAtom within an assigned NmrResidue is by definition assigned to the Atom with the same name (if any).

NmrAtoms serve as a way of connecting a named nucleus to an observed chemical shift, and peaks are assigned to NmrAtoms. Renaming an NmrAtom (or its containing NmrResidue or NmrChain) automatically updates peak assignments and ChemicalShifts that use the NmrAtom, preserving the link.

NmrAtom names must start with the atom type, (‘H’ for proton, ‘D’ for deuterium, ‘C’ for carbon, etc.), with ‘?’ for ‘unknown.

assignTo(chainCode: str = None, sequenceCode: int | str = None, residueType: str = None, name: str = None, mergeToExisting=False) → ccpn.core.NmrAtom.NmrAtom[source]

Assign NmrAtom to naming parameters) and return the reassigned result

If the assignedTo NmrAtom already exists the function raises ValueError. If mergeToExisting is True it instead merges the current NmrAtom into the target and returns the merged target. NB Merging is NOT undoable

WARNING: is mergeToExisting is True, always use in the form “x = x.assignTo(...)”, as the call ‘x.assignTo(...) may cause the source x object to be deleted.

Passing in empty parameters (e.g. chainCode=None) leaves the current value unchanged. E.g.: for NmrAtom NR:A.121.ALA.HA calling with sequenceCode=124 will assign to (chainCode=’A’, sequenceCode=124, residueType=’ALA’, atomName=’HA’)

The function works as:

nmrChain = project.fetchNmrChain(shortName=chainCode)

nmrResidue = nmrChain.fetchNmrResidue(sequenceCode=sequenceCode, residueType=residueType)

(or nmrChain.fetchNmrResidue(sequenceCode=sequenceCode) if residueType is None)

assignedPeaks

- Tuple[ccpn.core.Peak.Peak], immutable - All Peaks assigned to the NmrAtom

atom

- ccpn.core.Atom.Atom, mutable - Atom to which NmrAtom is assigned. NB resetting the atom will rename the NmrAtom

boundNmrAtoms

- ‘NmrAtom’, immutable - NmrAtoms directly bound to this one, as calculated from assignment and NmrAtom name matches (NOT from peak assignment)

chemicalShifts

- Tuple[ccpn.core.ChemicalShift.ChemicalShift, ...], immutable - Chemical shifts belonging to NmrAtom

className = 'NmrAtom'
deassign()[source]

Reset NmrAtom back to its originalName, cutting all assignment links

isotopeCode

- str, immutable - isotopeCode of NmrAtom. Set automatically on creation (from NmrAtom name) and cannot be changed later

name

- str, immutable - Atom name string (e.g. ‘HA’)

nmrResidue

- ccpn.core.NmrResidue.NmrResidue, immutable - Parent (containing) object.

rename(value: str = None)[source]

Rename the NmrAtom, changing ita name, Pid, and internal representation.

serial

- int, immutable - NmrAtom serial number - set at creation and unchangeable

shortClassName = 'NA'

Short class name, for PID.

ccpn.core.NmrChain module

class ccpn.core.NmrChain.NmrChain[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

NmrChains are used for NMR assignment. An NmrChain is by definition assigned to the Chain with the same shortName (if any).

An NmrChain created without a name will be given the name '@ij‘, where ij is the serial number of the NmrChain. Names of this form are reserved. Setting the NmrChain shortName to None will revert to this default name.

The order of NmrResidues within an NmrChain is not significant (they are given in sorted order). NmrChains with isConnected==True are used to describe connected but as yet unassigned stretches of NmrResidues, and here the NmrResidues are given in sequential order (N-terminal to C-terminal for proteins). Connected NmrChains have names of the form ‘#ij’ where ij is the serial number of the NmrChain, and cannot be renamed. Names of this form are reserved.

assignConnectedResidues(firstResidue: ccpn.core.Residue.Residue | str)[source]

Assign all NmrResidues in connected NmrChain sequentially, with the first NmrResidue assigned to firstResidue.

Returns ValueError if NmrChain is not connected, or if any of the Residues are missing or already assigned

chain

- ccpn.core.Chain.Chain, mutable - Chain to which NmrChain is assigned

className = 'NmrChain'
comment

- str, mutable - Free-form text comment

deassign()[source]

Reset NmrChain back to its originalName, cutting all assignment links

fetchNmrResidue(sequenceCode: int | str = None, residueType: str = None) → ccpn.core.NmrResidue.NmrResidue

Fetch NmrResidue with sequenceCode=sequenceCode and residueType=residueType, creating it if necessary.

if sequenceCode is None will create a new NmrResidue

if bool(residueType) is False will return any existing NmrResidue that matches the sequenceCode

getNmrAtom(relativeId: str) → ccpn.core.NmrAtom.NmrAtom

Get contained ‘ccpn.core.NmrAtom.NmrAtom object by relative ID

getNmrResidue(relativeId: str) → ccpn.core.NmrResidue.NmrResidue

Get contained ‘ccpn.core.NmrResidue.NmrResidue object by relative ID

isConnected

- bool, immutable - True if this this NmrChain is a connected stretch (in which case the mainNmrResidues are sequentially connected).

label

- str, mutable - Identifying label of NmrChain. Defaults to ‘?’

mainNmrResidues

- Tuple[ccpn.core.NmrResidue.NmrResidue], mutable - NmrResidues belonging to NmrChain that are NOT defined relative to another NmrResidue (sequenceCode ending in ‘-1’, ‘+1’, etc.) For connected NmrChains in sequential order, otherwise sorted by assignment

newNmrResidue(sequenceCode: int | str = None, residueType: str = None, comment: str = None) → ccpn.core.NmrResidue.NmrResidue

Create new NmrResidue within NmrChain

nmrAtoms

- (‘ccpn.core.NmrAtom.NmrAtom,) - contained NmrAtom objects sorted by id

nmrResidues

- (‘ccpn.core.NmrResidue.NmrResidue,) - contained NmrResidue objects sorted by id

rename(value: str)[source]

Rename NmrChain, changing its shortName and Pid. Use the ‘deassign’ function if you want to revert to the canonical name

serial

- int, immutable - NmrChain serial number - set at creation and unchangeable

shortClassName = 'NC'

Short class name, for PID.

shortName

- str, immutable - short form of name, used in Pid and to identify the NmrChain Names of the form ‘@ijk’ and ‘#ijk’ (where ijk is an integers) are reserved and cannot be set. They can be obtained by the deassign command. Connected NmrChains (isConnected == True) always have canonical names of the form ‘#ijk’

ccpn.core.NmrResidue module

class ccpn.core.NmrResidue.NmrResidue[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Nmr Residues are used for assignment. An NmrResidue within an assigned NmrChain is by definition assigned to the Residue with the same sequenceCode (if any). An NmrResidue is defined by its containing chain and sequenceCode, so you cannot have two NmrResidues with the same NmrChain and sequenceCode but different residueType.

An NmrResidue created without a name will be given the name '@ij‘, where ij is the serial number of the NmrResidue. Names of this form are reserved. Setting the NmrResidue sequenceCode to None will revert to this default name.

An NmrResidue can be defined by a sequential offset relative to another NmrResidue. E.g. the NmrResidue i-1 relative to NmrResidue @5.@185.ALA would be named @5.@185-1.VAL. Reassigning NR:@5.@185.ALA to NR:B.do1.ALA or NR:B.125.THR, would cause the offset NmrResidue to be reassigned to NR:B.do1-1.VAL or NR:B.125-1.VAL, respectively. Offsets can be any integer (including ‘+0’.

NmrResidues that are not offset can be linked into consecutive stretches by putting them into connected NmrChains (see NmrChain).

assignTo(chainCode: str = None, sequenceCode: int | str = None, residueType: str = None, mergeToExisting: bool = False) → ccpn.core.NmrResidue.NmrResidue[source]

Assign NmrResidue to new assignment, as defined by the naming parameters and return the result.

Empty parameters (e.g. chainCode=None) retain the previous value. E.g.: for NmrResidue NR:A.121.ALA calling with sequenceCode=123 will reassign to ‘A.123.ALA’.

If no assignment with the same chainCode and sequenceCode exists, the current NmrResidue will be reassigned. If an NmrResidue with the same chainCode and sequenceCode already exists, the function will either raise ValueError. If mergeToExisting is set to False, it will instead merge the two NmrResidues, delete the current one, and return the new one . NB Merging is NOT undoable. WARNING: When calling with mergeToExisting=True, always use in the form “x = x.assignTo(...)”, as the call ‘x.assignTo(...) may cause the source x object to become deleted.

NB resetting the NmrChain for an NmrResidue in the middle of a connected NmrChain will cause an error. Use moveToNmrChain(newNmrChainOrPid) instead

className = 'NmrResidue'
comment

- str, mutable - Free-form text comment

connectNext(value: NmrResidue | str) → ccpn.core.NmrChain.NmrChain[source]

Connect free end of self to free end of next residue in sequence, and return resulting connected NmrChain

Raises error if self is assigned, of if either self or value is offset.

NB Undoing a connection between two connected stretches will get back a ‘value’ stretch with a new shortName

connectPrevious(value) → ccpn.core.NmrChain.NmrChain[source]

Connect free end of self to free end of previous residue in sequence, and return resulting connected NmrChain

Raises error if self is assigned, of if either self or value is offset.

NB Undoing a connection between two connected stretches will get back a ‘value’ stretch with a new shortName

deassign()[source]

Reset sequenceCode and residueType assignment to default values

disconnect()[source]

Move NmrResidue from connected NmrChain to default chain, creating new connected NmrChains as necessary

disconnectNext()[source]

Cut connected NmrChain after NmrResidue, creating new connected NmrChain if necessary Does nothing if nextNmrResidue is empty; Raises ValueError for assigned NmrResidues

disconnectPrevious()[source]

Cut connected NmrChain before NmrResidue, creating new connected NmrChain if necessary Does nothing if previousNmrResidue is empty; Deletes one-NmrResidue NmrChains if generated Raises ValueError for assigned NmrResidues

fetchNmrAtom(name: str)

Fetch NmrAtom with name=name, creating it if necessary

getNmrAtom(relativeId: str) → ccpn.core.NmrAtom.NmrAtom

Get contained ‘ccpn.core.NmrAtom.NmrAtom object by relative ID

getOffsetNmrResidue(offset: int) → NmrResidue=None[source]

Get offset NmrResidue with indicated offset (or None, if no such offset NmrResidue exists

mainNmrResidue

- NmrResidue=None, immutable - Main NmrResidue (self, or the residue that self is offset relative to

moveToNmrChain(newNmrChain: NmrChain | str = None)[source]

Reset NmrChain, breaking connected NmrChain if necessary.

If set to None resets to NmrChain ‘@-‘ Illegal for offset NmrResidues

newNmrAtom(name: str = None, isotopeCode: str = None) → ccpn.core.NmrAtom.NmrAtom

Create new NmrAtom within NmrResidue. If name is None, use default name (of form e.g. 'H@211‘, 'N@45‘, ...)

nextNmrResidue

- NmrResidue=None, immutable - Next sequentially connected NmrResidue (or None, as appropriate). Either from a connected NmrChain, or the NmrResidue assigned to the next Residue in the same Chain

nmrAtoms

- (‘ccpn.core.NmrAtom.NmrAtom,) - contained NmrAtom objects sorted by id

nmrChain

- ccpn.core.NmrChain.NmrChain, immutable - NmrChain containing NmrResidue. Use self.assignTo to reset the NmrChain

offsetNmrResidues

- Tuple[NmrResidue, ...], immutable - “All other NmrResidues with the same sequenceCode sorted by offSet suffix ‘-1’, ‘+1’, etc.

previousNmrResidue

- NmrResidue=None, immutable - Previous sequentially connected NmrResidue (or None, as appropriate). Either from a connected NmrChain, or the NmrResidue assigned to the previous Residue in the same Chain

probableResidueTypes

- Tuple[Tuple[str, float]], mutable - tuple of (residueType, probability) tuples for probable residue types sorted by decreasing probability

probableResidues

- Tuple[Tuple[ccpn.core.Residue.Residue, float], ...], mutable - tuple of (residue, probability) tuples for probable residue assignments sorted by decreasing probability. Probabilities are normalised to 1

relativeOffset

- int=None, immutable - Sequential offset of NmrResidue relative to mainNmrResidue May be 0. Is None for residues that are not offset.

rename(value: str = None)[source]

Rename NmrResidue. changing its sequenceCode, residiueType, or both.

The value is a dot-separated string sequenceCode.`residueType`. Values like None, ‘abc’, or ‘abc.’ will set the residueType to None. Values like None or ‘.abc’ will set the sequenceCode to None, resetting it to its canonical form, ‘@`serial`.

residue

- ccpn.core.Residue.Residue, mutable - Residue to which NmrResidue is assigned

residueType

- str, immutable - Residue type string (e.g. ‘ALA’). Part of id. Use self.assignTo or self.rename to reset the residueType

sequenceCode

- str, immutable - Residue sequence code and id (e.g. ‘1’, ‘127B’, ‘@157+1) Names of the form ‘@ijk’ ,’@ijk+n’, and ‘@ijk-n’ (where ijk and n are integers) are reserved and cannot be set. They are obtained by the deassign command.

serial

- int, immutable - NmrResidue serial number - set at creation and unchangeable

shortClassName = 'NR'

Short class name, for PID.

ccpn.core.Note module

class ccpn.core.Note.Note[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Project note.

className = 'Note'
created

- str, immutable - Note creation time

header

- str, immutable - Note header == first line of note

lastModified

- str, immutable - Note last modification time

name

- str, immutable - Name of note, part of identifier

rename(value: str)[source]

Rename Note, changing its name and Pid.

serial

- int, immutable - serial number of note - immutable, part of identifier

shortClassName = 'NO'

Short class name, for PID.

text

- str, mutable - Free-form text comment

ccpn.core.Peak module

class ccpn.core.Peak.Peak[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Peak object, holding position, intensity, and assignment information

Measurements that require more than one NmrAtom for an individual assignment (such as splittings, J-couplings, MQ dimensions, reduced-dimensionality experiments etc.) are not supported (yet). Assignments can be viewed and set either as a list of assignments for each dimension (dimensionNmrAtoms) or as a list of all possible assignment combinations (assignedNmrAtoms)

addAssignment(value: Sequence[str | NmrAtom])[source]

Add a peak assignment - a list of one NmrAtom or Pid for each dimension

annotation

- str=None, mutable - Peak text annotation

assignDimension()[source]

Assign dimension with axisCode to value (NmrAtom, or Pid or sequence of either, or None)

assignedNmrAtoms

- Tuple[Tuple[NmrAtom=None, ...], ...], mutable - Peak assignment - a tuple of tuples of NmrAtom combinations. (e.g. a tuple of triplets for a 3D spectrum). One of two alternative views on the Peak assignment. Missing assignments are entered as None.

Example, for 13H HSQC::

((<NA:A.127.LEU.HA>, <NA:A.127.LEU.CA>),

(<NA:A.127.LEU.HBX>, <NA:A.127.LEU.CB>),

(<NA:A.127.LEU.HBY>, <NA:A.127.LEU.CB>),

(<NA:A.127.LEU.HG>, None),)

To add a single assignment tuple, use the Peak.addAssignment method

See also dimensionNmrAtoms, which gives assignments per dimension.

axisCodes

- Tuple[str, ...], immutable - Spectrum axis codes in dimension order matching position.

boxWidths

- Tuple[float=None, ...], mutable - The full width of the peak footprint in points for eqach dimension, i.e. the width of the area that should be considered for integration, fitting, etc. .

className = 'Peak'
comment

- str=None, mutable - Free-form text comment

dimensionNmrAtoms

- Tuple[Tuple[NmrAtom, ...], ...], mutable - Peak dimension assignment - a tuple of tuples with the assigned NmrAtoms for each dimension. One of two alternative views on the Peak assignment.

Example, for a 13C HSQC:

((<NA:A.127.LEU.HA>, <NA:A.127.LEU.HBX>, <NA:A.127.LEU.HBY>, <NA:A.127.LEU.HG>,

(<NA:A.127.LEU.CA>, <NA:A.127.LEU.CB>) )

Assignments as a list of individual combinations is given in ‘assignedNmrAtoms’. Note that by setting dimensionAssignments you tel the program that all combinations are possible - in the example that all four protons could be bound to either of the carbons

To (re)set the assignment for a single dimension, use the Peak.assignDimension method.

figureOfMerit

- float=None, mutable - figureOfMerit of Peak, between 0.0 and 1.0 inclusive.

height

- float=None, mutable - height of Peak

heightError

- float=None, mutable - height error of Peak

lineWidths

- Tuple[float=None, ...], mutable - Full-width-half-height of peak/multiplet for each dimension, in Hz.

peakList

- ccpn.core.PeakList.PeakList, immutable - PeakList containing Peak.

pointPosition

- Tuple[float, ...], mutable - Peak position in points.

position

- Tuple[float, ...], mutable - Peak position in ppm (or other relevant unit) in dimension order.

positionError

- Tuple[float=None, ...], mutable - Peak position error in ppm (or other relevant unit).

restraints

- Tuple[ccpn.core.Restraint.Restraint, ...], mutable - Restraints corresponding to Peak

serial

- int, immutable - serial number of Peak, used in Pid and to identify the Peak.

shortClassName = 'PK'

Short class name, for PID.

volume

- float=None, mutable - volume of Peak

volumeError

- float=None, mutable - volume error of Peak

ccpn.core.PeakList module

class ccpn.core.PeakList.PeakList[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

An object containing Peaks. Note: the object is not a (subtype of a) Python list. To access all Peak objects, use PeakList.peaks.

chemicalShiftList

- ccpn.core.ChemicalShiftList.ChemicalShiftList, mutable - ChemicalShiftList associated with PeakList.

className = 'PeakList'
comment

- str, mutable - Free-form text comment

getPeak(relativeId: str) → ccpn.core.Peak.Peak

Get contained ‘ccpn.core.Peak.Peak object by relative ID

isSimulated

- bool, mutable - True if this PeakList is simulated.

newPeak(height: float = None, volume: float = None, heightError: float = None, volumeError: float = None, figureOfMerit: float = 1.0, annotation: str = None, comment: str = None, position: Sequence[float] = (), positionError: Sequence[float] = (), pointPosition: Sequence[float] = (), serial: int = None) → ccpn.core.Peak.Peak

Create new Peak within peakList

NB you must create the peak before you can assign it. The assignment attributes are:

  • assignedNmrAtoms - A tuple of all (e.g.) assignment triplets for a 3D spectrum
  • dimensionNmrAtoms - A tuple of tuples of assignments, one for each dimension

See the Peak class for details

peakListViews

- Tuple[ccpn.ui._implementation.PeakListView.PeakListView, ...], immutable - PeakListViews showing Spectrum

peaks

- (‘ccpn.core.Peak.Peak,) - contained Peak objects sorted by id

pickPeaks1d(dataRange, intensityRange=None, size: int = 3, mode: str = 'wrap') → List[Peak][source]

Pick 1D peaks form data1d float array

pickPeaks1dFiltered(size: int = 9, mode: str = 'wrap', ignoredRegions=None, noiseThreshold=None)[source]

Pick 1D peaks form data in self.spectrum

pickPeaksNd(positions: Sequence[float] = None, doPos: bool = True, doNeg: bool = True, fitMethod: str = 'gaussian', excludedRegions=None, excludedDiagonalDims=None, excludedDiagonalTransform=None)[source]
refit(method: str = 'gaussian')[source]
restrictedPick(positionCodeDict, doPos, doNeg)[source]
serial

- int, immutable - serial number of PeakList, used in Pid and to identify the PeakList.

shortClassName = 'PL'

Short class name, for PID.

spectrum

- ccpn.core.Spectrum.Spectrum, immutable - Spectrum containing Peaklist.

subtractPeakLists(peakList2: ccpn.core.PeakList.PeakList) → ccpn.core.PeakList.PeakList[source]

Subtracts peaks in peakList2 from peaks in peakList1, based on position, and puts those in a new peakList3. Assumes a common spectrum for now.

symbolColour

- str, mutable - Symbol colour for peak annotation display

symbolStyle

- str, mutable - Symbol style for peak annotation display

textColour

- str, mutable - Text colour for peak annotation display

title

- str, mutable - title of PeakList (not used in PID).

ccpn.core.Project module

class ccpn.core.Project.Project(wrappedData: ccpnmodel.ccpncore.api.ccp.nmr.Nmr.NmrProject)[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

The Project is the object that contains all data objects and serves as the hub for navigating between them.

There are eleven top-level data objects directly within a project, of which seven have child objects of their own, namely Spectrum, Sample, Chain, NmrChain, ChemicalShiftList, DataSet and StructureEnsemble. The child data objects are organised in a logical hierarchy; for example, a Spectrum has PeakLists, which in turn, are made up of Peaks, whereas a Chain is made up of -Residues, which are made up of Atoms.

atoms

- (‘ccpn.core.Atom.Atom,) - contained Atom objects sorted by id

axes

- (‘ccpn.ui._implementation.Axis.Axis,) - contained Axis objects sorted by id

blankNotification()[source]

Disable notifiers temporarily e.g. to disable ‘object modified’ notifiers during object creation

Caller is responsible to make sure necessary notifiers are called, and to unblank after use

calculationSteps

- (‘ccpn.core.CalculationStep.CalculationStep,) - contained CalculationStep objects sorted by id

chains

- (‘ccpn.core.Chain.Chain,) - contained Chain objects sorted by id

chemicalShiftLists

- (‘ccpn.core.ChemicalShiftList.ChemicalShiftList,) - contained ChemicalShiftList objects sorted by id

chemicalShifts

- (‘ccpn.core.ChemicalShift.ChemicalShift,) - contained ChemicalShift objects sorted by id

className = 'Project'
createChain(sequence: Sequence[str], compoundName: str = None, startNumber: int = 1, molType: str = None, isCyclic: bool = False, shortName: str = None, role: str = None, comment: str = None) → ccpn.core.Chain.Chain

Create new chain from sequence of residue codes

Automatically creates the corresponding polymer Substance if the compoundName is not already taken

Parameters:
  • sequence (Sequence) – string of one-letter codes or sequence of residue types
  • compoundName (str) – name of new Substance (e.g. ‘Lysozyme’) Defaults to ‘Molecule_n
  • molType (str) – molType (‘protein’,’DNA’, ‘RNA’). Needed only if sequence is a string.
  • startNumber (int) – number of first residue in sequence
  • shortName (str) – shortName for new chain (optional)
  • role (str) – role for new chain (optional)
  • comment (str) – comment for new chain (optional)
createDummySpectrum(axisCodes: Sequence[str], name=None) → ccpn.core.Spectrum.Spectrum

Make dummy spectrum from isotopeCodes list - without data and with default parameters

createPolymerSubstance(sequence: Sequence[str], name: str, labeling: str = None, userCode: str = None, smiles: str = None, synonyms: Sequence[str] = (), comment: str = None, startNumber: int = 1, molType: str = None, isCyclic: bool = False) → ccpn.core.Substance.Substance

Make new Substance from sequence of residue codes, using default linking and variants

NB: For more complex substances, you must use advanced, API-level commands.

Parameters:
  • sequence (Sequence) – string of one-letter codes or sequence of residueNames
  • name (str) – name of new substance
  • labeling (str) – labeling for new substance. Optional - None means ‘natural abundance’
  • userCode (str) – user code for new substance (optional)
  • smiles (str) – smiles string for new substance (optional)
  • synonyms (Sequence[str]) – synonyms for Substance name
  • comment (str) – comment for new substance (optional)
  • startNumber (int) – number of first residue in sequence
  • molType (str) – molType (‘protein’,’DNA’, ‘RNA’). Required only if sequence is a string.
  • isCyclic (bool) – Should substance created be cyclic?
data

- (‘ccpn.core.Data.Data,) - contained Data objects sorted by id

dataSets

- (‘ccpn.core.DataSet.DataSet,) - contained DataSet objects sorted by id

delete()

Clean up the wrapper project previous to deleting or replacing

Cleanup includes wrapped data graphics objects (e.g. Window, Strip, ...)

deleteObjects(*objects: Sequence[ccpn.core.lib.Pid.Pid | ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject])[source]

Delete one or more objects, given as either objects or Pids

duplicateNotifier()[source]

register copy of notifier for a new className and target. Intended for onceOnly=True notifiers. It is up to the user to make sure the calling

interface matches the action
execute(pid, funcName, *params, **kwparams)[source]

Get the object identified by pid, execute object.funcName(*params, **kwparams) and return the result

fetchNefSubstance(sequence: Sequence[dict], name: str = None)

Fetch Substance that matches sequence of NEF rows and/or name

fetchNmrChain(shortName: str = None) → ccpn.core.NmrChain.NmrChain

Fetch chain with given shortName; If none exists call newNmrChain to make one first

If shortName is None returns a new NmrChain with name starting with ‘@’

fetchSubstance(name: str, labeling: str = None) → ccpn.core.Substance.Substance

get or create Substance with given name and labeling.

getAtom(relativeId: str) → ccpn.core.Atom.Atom

Get contained ‘ccpn.core.Atom.Atom object by relative ID

getAxis(relativeId: str) → ccpn.ui._implementation.Axis.Axis

Get contained ‘ccpn.ui._implementation.Axis.Axis object by relative ID

getCalculationStep(relativeId: str) → ccpn.core.CalculationStep.CalculationStep

Get contained ‘ccpn.core.CalculationStep.CalculationStep object by relative ID

getChain(relativeId: str) → ccpn.core.Chain.Chain

Get contained ‘ccpn.core.Chain.Chain object by relative ID

getChemicalShift(relativeId: str) → ccpn.core.ChemicalShift.ChemicalShift

Get contained ‘ccpn.core.ChemicalShift.ChemicalShift object by relative ID

getChemicalShiftList(relativeId: str) → ccpn.core.ChemicalShiftList.ChemicalShiftList

Get contained ‘ccpn.core.ChemicalShiftList.ChemicalShiftList object by relative ID

getData(relativeId: str) → ccpn.core.Data.Data

Get contained ‘ccpn.core.Data.Data object by relative ID

getDataSet(relativeId: str) → ccpn.core.DataSet.DataSet

Get contained ‘ccpn.core.DataSet.DataSet object by relative ID

getIntegral(relativeId: str) → ccpn.core.Integral.Integral

Get contained ‘ccpn.core.Integral.Integral object by relative ID

getIntegralList(relativeId: str) → ccpn.core.IntegralList.IntegralList

Get contained ‘ccpn.core.IntegralList.IntegralList object by relative ID

getMark(relativeId: str) → ccpn.ui._implementation.Mark.Mark

Get contained ‘ccpn.ui._implementation.Mark.Mark object by relative ID

getModel(relativeId: str) → ccpn.core.Model.Model

Get contained ‘ccpn.core.Model.Model object by relative ID

getModule(relativeId: str) → ccpn.ui._implementation.Module.Module

Get contained ‘ccpn.ui._implementation.Module.Module object by relative ID

getNmrAtom(relativeId: str) → ccpn.core.NmrAtom.NmrAtom

Get contained ‘ccpn.core.NmrAtom.NmrAtom object by relative ID

getNmrChain(relativeId: str) → ccpn.core.NmrChain.NmrChain

Get contained ‘ccpn.core.NmrChain.NmrChain object by relative ID

getNmrResidue(relativeId: str) → ccpn.core.NmrResidue.NmrResidue

Get contained ‘ccpn.core.NmrResidue.NmrResidue object by relative ID

getNote(relativeId: str) → ccpn.core.Note.Note

Get contained ‘ccpn.core.Note.Note object by relative ID

getPeak(relativeId: str) → ccpn.core.Peak.Peak

Get contained ‘ccpn.core.Peak.Peak object by relative ID

getPeakList(relativeId: str) → ccpn.core.PeakList.PeakList

Get contained ‘ccpn.core.PeakList.PeakList object by relative ID

getPeakListView(relativeId: str) → ccpn.ui._implementation.PeakListView.PeakListView

Get contained ‘ccpn.ui._implementation.PeakListView.PeakListView object by relative ID

getPseudoDimension(relativeId: str) → ccpn.core.PseudoDimension.PseudoDimension

Get contained ‘ccpn.core.PseudoDimension.PseudoDimension object by relative ID

getResidue(relativeId: str) → ccpn.core.Residue.Residue

Get contained ‘ccpn.core.Residue.Residue object by relative ID

getRestraint(relativeId: str) → ccpn.core.Restraint.Restraint

Get contained ‘ccpn.core.Restraint.Restraint object by relative ID

getRestraintContribution(relativeId: str) → ccpn.core.RestraintContribution.RestraintContribution

Get contained ‘ccpn.core.RestraintContribution.RestraintContribution object by relative ID

getRestraintList(relativeId: str) → ccpn.core.RestraintList.RestraintList

Get contained ‘ccpn.core.RestraintList.RestraintList object by relative ID

getSample(relativeId: str) → ccpn.core.Sample.Sample

Get contained ‘ccpn.core.Sample.Sample object by relative ID

getSampleComponent(relativeId: str) → ccpn.core.SampleComponent.SampleComponent

Get contained ‘ccpn.core.SampleComponent.SampleComponent object by relative ID

getSpectrum(relativeId: str) → ccpn.core.Spectrum.Spectrum

Get contained ‘ccpn.core.Spectrum.Spectrum object by relative ID

getSpectrumDisplay(relativeId: str) → ccpn.ui._implementation.SpectrumDisplay.SpectrumDisplay

Get contained ‘ccpn.ui._implementation.SpectrumDisplay.SpectrumDisplay object by relative ID

getSpectrumGroup(relativeId: str) → ccpn.core.SpectrumGroup.SpectrumGroup

Get contained ‘ccpn.core.SpectrumGroup.SpectrumGroup object by relative ID

getSpectrumHit(relativeId: str) → ccpn.core.SpectrumHit.SpectrumHit

Get contained ‘ccpn.core.SpectrumHit.SpectrumHit object by relative ID

getSpectrumReference(relativeId: str) → ccpn.core.SpectrumReference.SpectrumReference

Get contained ‘ccpn.core.SpectrumReference.SpectrumReference object by relative ID

getSpectrumView(relativeId: str) → ccpn.ui._implementation.SpectrumView.SpectrumView

Get contained ‘ccpn.ui._implementation.SpectrumView.SpectrumView object by relative ID

getStrip(relativeId: str) → ccpn.ui._implementation.Strip.Strip

Get contained ‘ccpn.ui._implementation.Strip.Strip object by relative ID

getStructureEnsemble(relativeId: str) → ccpn.core.StructureEnsemble.StructureEnsemble

Get contained ‘ccpn.core.StructureEnsemble.StructureEnsemble object by relative ID

getSubstance(relativeId: str) → ccpn.core.Substance.Substance

Get contained ‘ccpn.core.Substance.Substance object by relative ID

getTask(relativeId: str) → ccpn.ui._implementation.Task.Task

Get contained ‘ccpn.ui._implementation.Task.Task object by relative ID

getWindow(relativeId: str) → ccpn.ui._implementation.Window.Window

Get contained ‘ccpn.ui._implementation.Window.Window object by relative ID

integralLists

- (‘ccpn.core.IntegralList.IntegralList,) - contained IntegralList objects sorted by id

integrals

- (‘ccpn.core.Integral.Integral,) - contained Integral objects sorted by id

loadData()[source]

Load data from path, determining type first.

loadProject(path: str, subType: str) → ccpn.core.Project.Project[source]

Load project from file into application and return the new project

loadSpectrum(path: str, subType: str) → list[source]

Load spectrum from file into application

marks

- (‘ccpn.ui._implementation.Mark.Mark,) - contained Mark objects sorted by id

models

- (‘ccpn.core.Model.Model,) - contained Model objects sorted by id

modules

- (‘ccpn.ui._implementation.Module.Module,) - contained Module objects sorted by id

name

- str, immutable - name of Project

newChemicalShiftList(name: str = None, unit: str = 'ppm', autoUpdate: bool = True, isSimulated: bool = False, serial: int = None, comment: str = None) → ccpn.core.ChemicalShiftList.ChemicalShiftList

Create new ChemicalShiftList.

newDataSet(title: str = None, programName: str = None, programVersion: str = None, dataPath: str = None, creationDate: datetime.datetime = None, uuid: str = None, comment: str = None, serial: int = None) → ccpn.core.DataSet.DataSet

Create new DataSet

newNmrChain(shortName: str = None, isConnected: bool = False, label: str = '?', comment: str = None) → ccpn.core.NmrChain.NmrChain

Create new NmrChain. Setting isConnected=True produces a connected NmrChain.

Parameters:
  • shortName (str) – shortName for new nmrChain (optional, defaults to '@ijk‘ or ‘#ijk’, ijk positive integer
  • isConnected (bool) – (default to False) If true the NmrChain is a connected stretch. This can NOT be changed later
  • label (str) – Modifiable NmrChain identifier that does not change with reassignment. Defaults to '@ijk'/'#ijk
  • comment (str) – comment for new nmrChain (optional)
newNote(name: str = 'Note', text: str = None) → ccpn.core.Note.Note

Create new Note

newSample(name: str = None, pH: float = None, ionicStrength: float = None, amount: float = None, amountUnit: str = None, isVirtual: bool = False, isHazardous: bool = None, creationDate: datetime.datetime = None, batchIdentifier: str = None, plateIdentifier: str = None, rowNumber: int = None, columnNumber: int = None, comment: str = None) → ccpn.core.Sample.Sample

Create new Sample

newSpectrum(name: str) → ccpn.core.Spectrum.Spectrum

Creation of new Spectrum NOT IMPLEMENTED. Use Project.loadData or Project.createDummySpectrum instead

newSpectrumGroup(name: str, spectra=()) → ccpn.core.SpectrumGroup.SpectrumGroup

Create new SpectrumGroup

newStructureEnsemble(ensembleId: int = None, comment: str = None) → ccpn.core.StructureEnsemble.StructureEnsemble

Create new, empty StructureEnsemble

newSubstance(name: str, labeling: str = None, substanceType: str = 'Molecule', userCode: str = None, smiles: str = None, inChi: str = None, casNumber: str = None, empiricalFormula: str = None, molecularMass: float = None, comment: str = None, synonyms: Sequence[str] = (), atomCount: int = None, bondCount: int = None, ringCount: int = None, hBondDonorCount: int = None, hBondAcceptorCount: int = None, polarSurfaceArea: float = None, logPartitionCoefficient: float = None) → ccpn.core.Substance.Substance

Create new substance WITHOUT storing the sequence internally (and hence not suitable for making chains). SubstanceType defaults to ‘Molecule’.

ADVANCED alternatives are ‘Cell’ and ‘Material’

newTask(name: str, nameSpace: str = None, comment: str = None) → ccpn.ui._implementation.Task.Task

Create new Task

newUndoPoint()[source]

Set a point in the undo stack, you can undo/redo to

newWindow(title: str = None, position: tuple = (), size: tuple = ()) → ccpn.ui._implementation.Window.Window

Create new child Window

Parameters:
  • title (str) – window title (optional, defaults to ‘W1’, ‘W2’, ‘W3’, ...
  • size (tuple) – x,y size for new window in integer pixels
  • position (tuple) – x,y position for new window in integer pixels
nmrAtoms

- (‘ccpn.core.NmrAtom.NmrAtom,) - contained NmrAtom objects sorted by id

nmrChains

- (‘ccpn.core.NmrChain.NmrChain,) - contained NmrChain objects sorted by id

nmrResidues

- (‘ccpn.core.NmrResidue.NmrResidue,) - contained NmrResidue objects sorted by id

notes

- (‘ccpn.core.Note.Note,) - contained Note objects sorted by id

path

- str, immutable - path to directory containing Project

peakListViews

- (‘ccpn.ui._implementation.PeakListView.PeakListView,) - contained PeakListView objects sorted by id

peakLists

- (‘ccpn.core.PeakList.PeakList,) - contained PeakList objects sorted by id

peaks

- (‘ccpn.core.Peak.Peak,) - contained Peak objects sorted by id

programName

- str, immutable - Name of running program - defaults to ‘CcpNmr’

pseudoDimensions

- (‘ccpn.core.PseudoDimension.PseudoDimension,) - contained PseudoDimension objects sorted by id

registerNotifier()[source]

Register notifiers to be triggered when data change

Parameters:
  • className (str) – className of wrapper class to monitor (AbstractWrapperObject for ‘all’)
  • target (str) –

    can have the following values

    ‘create’ is called after the creation (or undeletion) of the object and its wrapper. Notifier functions are called with the created wrapper object as the only parameter.

    ‘delete’ is called after the object is deleted, but before the .id and .pid attributes are modified. Notifier functions are called with the deleted wrapper object as the only parameter.

    ‘rename’ is called after the id and pid of an object has changed Notifier functions are called with the renamed wrapper object and the old pid as parameters.

    ‘change’ when any object attribute changes value. Notifier functions are called with the created wrapper object as the only parameter. rename and crosslink notifiers (see below) may also trigger change notifiers.

    Any other value is interpreted as the name of a wrapper class, and the notifier is triggered when a cross link (NOT a parent-child link) between the className and the target class is modified

  • func (Callable) –

    The function to call when the notifier is triggered.

    for actions ‘create’, ‘delete’ and ‘change’ the function is called with the object created (deleted, undeleted, changed) as the only parameter

    For action ‘rename’ the function is called with an additional parameter: oldPid, the value of the pid before renaming.

    If target is a second className, the function is called with the project as the only parameter.

param: dict parameterDict: Parameters passed to the notifier function before execution.

This allows you to use the same function with different parameters in different contexts

param: bool onceOnly: If True, only one of multiple copies is executed

when notifiers are resumed after a suspension.

return: The registered notifier (which can be passed to removeNotifier or duplicateNotifier)

removeNotifier()[source]

Unregister the the notifier from all places where it appears.

renameObject(objectOrPid: str | ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject, newName: str)[source]

Rename object indicated by objectOrPid to name newName NB at last one class (Substance) has a two-art name - these are passed as one, dot-separated string (e.g. ‘Lysozyme.U13C’

residues

- (‘ccpn.core.Residue.Residue,) - contained Residue objects sorted by id

restraintContributions

- (‘ccpn.core.RestraintContribution.RestraintContribution,) - contained RestraintContribution objects sorted by id

restraintLists

- (‘ccpn.core.RestraintList.RestraintList,) - contained RestraintList objects sorted by id

restraints

- (‘ccpn.core.Restraint.Restraint,) - contained Restraint objects sorted by id

resumeNotification()[source]

Execute accumulated notifiers and resume immediate notifier execution

sampleComponents

- (‘ccpn.core.SampleComponent.SampleComponent,) - contained SampleComponent objects sorted by id

samples

- (‘ccpn.core.Sample.Sample,) - contained Sample objects sorted by id

save(newPath: str = None, changeBackup: bool = True, createFallback: bool = False, overwriteExisting: bool = False, checkValid: bool = False, changeDataLocations: bool = False) → bool[source]

Save project with all data, optionally to new location or with new name. Unlike lower-level functions, this function ensures that data in high level caches are saved. Return True if save succeeded otherwise return False (or throw error)

shortClassName = 'PR'

Short class name, for PID.

spectra

- (‘ccpn.core.Spectrum.Spectrum,) - contained Spectrum objects sorted by id

spectrumDisplays

- (‘ccpn.ui._implementation.SpectrumDisplay.SpectrumDisplay,) - contained SpectrumDisplay objects sorted by id

spectrumGroups

- (‘ccpn.core.SpectrumGroup.SpectrumGroup,) - contained SpectrumGroup objects sorted by id

spectrumHits

- (‘ccpn.core.SpectrumHit.SpectrumHit,) - contained SpectrumHit objects sorted by id

spectrumReferences

- (‘ccpn.core.SpectrumReference.SpectrumReference,) - contained SpectrumReference objects sorted by id

spectrumViews

- (‘ccpn.ui._implementation.SpectrumView.SpectrumView,) - contained SpectrumView objects sorted by id

strips

- (‘ccpn.ui._implementation.Strip.Strip,) - contained Strip objects sorted by id

structureEnsembles

- (‘ccpn.core.StructureEnsemble.StructureEnsemble,) - contained StructureEnsemble objects sorted by id

substances

- (‘ccpn.core.Substance.Substance,) - contained Substance objects sorted by id

suspendNotification()[source]

Suspend notifier execution and accumulate notifiers for later execution

tasks

- (‘ccpn.ui._implementation.Task.Task,) - contained Task objects sorted by id

unRegisterNotifier()[source]

Unregister the notifier from this className, and target

unblankNotification()[source]

Resume notifier execution after blanking

windows

- (‘ccpn.ui._implementation.Window.Window,) - contained Window objects sorted by id

ccpn.core.PseudoDimension module

class ccpn.core.PseudoDimension.PseudoDimension[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

ADVANCED. A sampled SPectrum axis with non-gridded values. Used to describe sampled-value axes in pseudo-2D and nD experiments, such as the time delay axis for T1 experiments.

axisCode

- str, mutable - PseudoDimension axisCode

axisParameter

- str, mutable - Name of the condition or parameter that is varied along the axis. Use ‘sample’ if samples are different for each point on the dimension

axisUnit

- str, mutable - unit for transformed data using the reference (most commonly ‘ppm’)

className = 'PseudoDimension'
comment

- str, mutable - Free-form text comment

dimension

- int, immutable - dimension number

dimensionType = 'Sampled'
orderedSamples

- Tuple[ccpn.core.Sample.Sample, ...], mutable - Samples used to acquire the individual points in this sampled dimension

pointCount

- int, immutable - dimension number

pointErrors

- Tuple[float, ...], mutable - point errors for PseudoDimension).

pointValues

- Tuple[float, ...], mutable - point values for PseudoDimension).

shortClassName = 'SD'

Short class name, for PID.

spectrum

- ccpn.core.Spectrum.Spectrum, immutable - Spectrum containing PseudoDimension.

spectrumHits

- List[ccpn.core.SpectrumHit.SpectrumHit], immutable - SpectrumHits (for screening/metabolomics) that refer to individual points in the PseudoDimension

ccpn.core.Residue module

class ccpn.core.Residue.Residue[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

A molecular Residue, contained in a Chain, and containing Atoms.

atoms

- (‘ccpn.core.Atom.Atom,) - contained Atom objects sorted by id

chain

- ccpn.core.Chain.Chain, immutable - Chain containing residue.

className = 'Residue'
comment

- str, mutable - Free-form text comment

descriptor

- str, mutable - variant descriptor (protonation state etc.) for residue, as defined in the CCPN V2 ChemComp description.

getAtom(relativeId: str) → ccpn.core.Atom.Atom

Get contained ‘ccpn.core.Atom.Atom object by relative ID

linking

- str, mutable - linking (substitution pattern) code for residue

Allowed values are:

For linear polymers: ‘start’, ‘end’, ‘middle’, ‘single’, ‘break’, ‘cyclic’ For other molecules: ‘nonlinear’

‘cyclic’ and ‘break’ are used at the end of linear polymer stretches to signify, respectively, that the polymer is cyclic, or that the residue is bound to an unknown residue or to a cap, so that the linear polymer chain does not continue.

nextResidue

- ccpn.core.Residue.Residue, immutable - Next sequentially connected Residue

nmrResidue

- ccpn.core.NmrResidue.NmrResidue, mutable - NmrResidue to which Residue is assigned

previousResidue

- ccpn.core.Residue.Residue, immutable - Previous sequentially connected Residue

rename(sequenceCode: str = None)[source]

Reset Residue.sequenceCode (residueType is immutable). Renaming to None sets the sequence code to the seqId (serial number equivalent)

residueType

- str, immutable - Residue type name string (e.g. ‘ALA’)

residueVariant

- str=None, immutable - NEF convention Residue variant descriptor (protonation state etc.) for residue

sequenceCode

- str, immutable - Residue sequence code and id (e.g. ‘1’, ‘127B’)

shortClassName = 'MR'

Short class name, for PID.

shortName

- str, immutable -

ccpn.core.Restraint module

class ccpn.core.Restraint.Restraint[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Restraint. The type is defined in the containing RestraintList.

Most of the values are the consensus of the values in the contained RestraintContributions. In the normal case, where you have only one RestraintContribution per Restraint, you can get and set the values

directly from the Restraint without reference to the RestraintContributions.
additionalLowerLimit

- float, mutable - additionalLowerLimit of restraint - consensus of all contributions or None Used for potential functions that require more than one parameter, typically for

parabolic-linear potentials where the additionalLowerLimit marks the transition from parabolic to linear potential
additionalUpperLimit

- float, mutable - additionalUpperLimit of restraint - consensus of all contributions or None. Used for potential functions that require more than one parameter, typically for

parabolic-linear potentials where the additionalUpperLimit marks the transition from parabolic to linear potential
className = 'Restraint'
comment

- str, mutable - Free-form text comment

error

- float, mutable - standard error of restraint - consensus of all contributions or None

figureOfMerit

- str, mutable - Restraint figure of merit, between 0.0 and 1.0 inclusive.

getRestraintContribution(relativeId: str) → ccpn.core.RestraintContribution.RestraintContribution

Get contained ‘ccpn.core.RestraintContribution.RestraintContribution object by relative ID

lowerLimit

- float, mutable - lowerLimit of restraint - consensus of all contributions or None

newRestraintContribution(targetValue: float = None, error: float = None, weight: float = 1.0, upperLimit: float = None, lowerLimit: float = None, additionalUpperLimit: float = None, additionalLowerLimit: float = None, scale: float = 1.0, isDistanceDependent: bool = False, combinationId: int = None, restraintItems: Sequence[T_co] = ()) → ccpn.core.RestraintContribution.RestraintContribution

Create new RestraintContribution within Restraint

peaks

- Tuple[ccpn.core.Peak.Peak, ...], mutable - peaks used to derive restraint

restraintContributions

- (‘ccpn.core.RestraintContribution.RestraintContribution,) - contained RestraintContribution objects sorted by id

restraintList

- ccpn.core.RestraintList.RestraintList, immutable - RestraintList object containing restraint.

serial

- int, immutable - serial number of Restraint, used in Pid and to identify the Restraint.

shortClassName = 'RE'

Short class name, for PID.

targetValue

- float, mutable - target value of constraint - consensus of all contributions or None

upperLimit

- float, mutable - upperLimit of restraint - consensus of all contributions or None

vectorLength

- str, mutable - Reference vector length, where applicable. (Mainly?) for Rdc

weight

- float, mutable - weight of restraint - consensus of all contributions or None

ccpn.core.Restraint.createSimpleRestraint(self: ccpn.core.RestraintList.RestraintList, comment: str = None, figureOfMerit: float = None, peaks: Sequence[ccpn.core.Peak.Peak] = (), targetValue: float = None, error: float = None, weight: float = 1.0, upperLimit: float = None, lowerLimit: float = None, additionalUpperLimit: float = None, additionalLowerLimit: float = None, scale=1.0, vectorLength=None, restraintItems: Sequence[T_co] = ()) → ccpn.core.Restraint.Restraint[source]

Create a Restraint with a single RestraintContribution within the RestraintList. The function takes all the information needed and creates the RestraintContribution as

well as the Restraint proper.

This function should be used routinely, unless there is a need to crreate more complex Restraints.

ccpn.core.RestraintContribution module

class ccpn.core.RestraintContribution.RestraintContribution[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Restraint contribution, corresponding to a set of alternative Atom tuples with associated limits, target value, weight, and other parameters. Simple restraints will have only contribution, whereas more complex restraints can have multiple contributions with different parameters and possibly logical relationships

addRestraintItem(restraintItem: Sequence[str])[source]

Add a restraint item, given as aa tuple of atomId (NOT Pid). Example value: (‘A.127.ALA.HA’,’A.130.SER.H’)

additionalLowerLimit

- float, mutable - additionalLowerLimit of contribution Used for potential functions that require more than one parameter, typically for

parabolic-linear potentials where the additionalLowerLimit marks the transition from parabolic to linear potential
additionalUpperLimit

- float, mutable - additionalUpperLimit of contribution. Used for potential functions that require more than one parameter, typically for

parabolic-linear potentials where the additionalUpperLimit marks the transition from parabolic to linear potential
className = 'RestraintContribution'
combinationId

- int, mutable - combinationId of contribution. Contributions with the same combinationId are AND’ed together, where contributions with different combinationId (or combinationId None) are OR’ed

error

- float, mutable - error of contribution

isDistanceDependent

- float, mutable - Does targetValue depend on a variable distance (where this is relevant, e.g. for Rdc)

lowerLimit

- float, mutable - lowerLimit of contribution

restraint

- ccpn.core.Restraint.Restraint, immutable - Restraint object containing restraintContribution.

restraintItems

- Tuple[Tuple[str, ...]], mutable - restraint items of contribution - given as a tuple of tuples of AtomId (not Pid).

Example value: ((‘A.127.ALA.HA’,’A.130.SER.H’), (‘A.93.VAL.HA’,’A.93.TYR.H’))

scale

- float, mutable - scaling factor (relevant mainly for RDC) to be multiplied with targetValue to get scaled value

serial

- int, immutable - serial number of RestraintContribution, used in Pid and to identify the RestraintContribution.

shortClassName = 'RC'

Short class name, for PID.

targetValue

- float, mutable - targetValue of contribution

upperLimit

- float, mutable - upperLimit of contribution

weight

- float, mutable - weight of contribution

ccpn.core.RestraintList module

class ccpn.core.RestraintList.RestraintList(project, wrappedData)[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

An object containing Restraints. Note: the object is not a (subtype of a) Python list. To access all rRstraint objects, use RestraintList.restraints.

RThe type of restraint is determined by the restraintType attribute. Typical examples are Distance, Dihedral and Rdc restraints, but can also be used to store measurements or derived values (Rdc, J coupling, T1, T2, Chemical Shift, ...)

className = 'RestraintList'
comment

- str, mutable - Free-form text comment

createSimpleRestraint(comment: str = None, figureOfMerit: float = None, peaks: Sequence[ccpn.core.Peak.Peak] = (), targetValue: float = None, error: float = None, weight: float = 1.0, upperLimit: float = None, lowerLimit: float = None, additionalUpperLimit: float = None, additionalLowerLimit: float = None, scale=1.0, vectorLength=None, restraintItems: Sequence[T_co] = ()) → ccpn.core.Restraint.Restraint

Create a Restraint with a single RestraintContribution within the RestraintList. The function takes all the information needed and creates the RestraintContribution as

well as the Restraint proper.

This function should be used routinely, unless there is a need to crreate more complex Restraints.

dataSet

- ccpn.core.DataSet.DataSet, immutable - DataSet containing RestraintList.

getRestraint(relativeId: str) → ccpn.core.Restraint.Restraint

Get contained ‘ccpn.core.Restraint.Restraint object by relative ID

getRestraintContribution(relativeId: str) → ccpn.core.RestraintContribution.RestraintContribution

Get contained ‘ccpn.core.RestraintContribution.RestraintContribution object by relative ID

measurementType

- str, mutable - Type of measurements giving rise to Restraints. Used for restraintTypes like T1 (types z, zz), T2 (types SQ, DQ), ... Freely settable for now - precise enumerations will eventually be introduced.

name

- str, immutable - name of Restraint List

newRestraint(figureOfMerit: float = None, comment: str = None, peaks: Sequence[T_co] = (), vectorLength: float = None, serial: int = None) → ccpn.core.Restraint.Restraint

Create new Restraint within RestraintList.

ADVANCED: Note that you just create at least one RestraintContribution afterwards in order to have valid data. Use the simpler createSimpleRestraint instead, unless you have specific reasons for needing newRestraint

origin

- str, mutable - Data origin for restraints. Free text. Examples would be ‘noe’, ‘hbond’, ‘mutation’, or ‘shift-perturbation’ (for a distance restraint list), ‘jcoupling’ or ‘talos’ (for a dihedral restraint list), ‘measured’ (for any observed value)

potentialType

- str, mutable - Potential type for restraints

rename(value: str)[source]

rename RestraintList, changing its name and Pid.

restraintContributions

- (‘ccpn.core.RestraintContribution.RestraintContribution,) - contained RestraintContribution objects sorted by id

restraintItemLength

- int, immutable - Length of restraintItem - number of atom ID identifying a restraint

restraintType

- str, immutable - Restraint type.

Recommended types are Distance, Rdc, JCoupling, ChemicalShift, Csa, Dihedral, T1, T2, ... Freely settable for now - further enumerations will eventually be introduced.

restraints

- (‘ccpn.core.Restraint.Restraint,) - contained Restraint objects sorted by id

serial

- int, immutable - serial number of RestraintList, used in Pid and to identify the RestraintList.

shortClassName = 'RL'

Short class name, for PID.

tensor

- ccpn.util.Tensor.Tensor, mutable - orientation tensor for restraints.

tensorChainCode

- float, mutable - tensorChainCode of orientation tensor. Used to identify tensor in coordinate files

tensorIsotropicValue

- float, immutable - tensor IsotropicValue of orientation tensor.

tensorMagnitude

- float, immutable - tensor Magnitude of orientation tensor.

tensorResidueType

- float, mutable - tensorResidueType of orientation tensor. Used to identify tensor in coordinate files

tensorRhombicity

- float, immutable - tensor Rhombicity of orientation tensor. U

tensorSequenceCode

- float, mutable - tensorSequenceCode of orientation tensor. Used to identify tensor in coordinate files

unit

- str, mutable - Unit for restraints

ccpn.core.Sample module

class ccpn.core.Sample.Sample[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Corresponds to an NMR (or other) sample, with properties such as amount, pH, and sample identifiers. The composition is given through the contained SampleComponent objects.

amount

- float, mutable - amount of sample, in unit of amountUnit. In most cases this is the volume, but there are other possibilities, e.g. for solid state NMR.

amountUnit

- str, mutable - amountUnit for sample, one of : ‘L’, ‘g’, ‘mole’

batchIdentifier

- str, mutable - batch identifier for sample

className = 'Sample'
columnNumber

- str, mutable - Column number on plate

comment

- str, mutable - Free-form text comment

creationDate

- datetime.datetime, mutable - Creation timestamp for sample (not for the description record)

getSampleComponent(relativeId: str) → ccpn.core.SampleComponent.SampleComponent

Get contained ‘ccpn.core.SampleComponent.SampleComponent object by relative ID

ionicStrength

- float, mutable - ionicStrength of sample

isHazardous

- bool, mutable - True if this Sample is a hazard?

isVirtual

- bool, mutable - True if this sample is virtual and does not describe an actual Sample.. Virtual samples serve as templates and may not be linked to Spectra

name

- str, immutable - actual sample name

newSampleComponent(name: str, labeling: str = None, role: str = None, concentration: float = None, concentrationError: float = None, concentrationUnit: str = None, purity: float = None, comment: str = None) → ccpn.core.SampleComponent.SampleComponent

Create new SampleComponent within Sample

Automatically creates the corresponding Substance if the name is not already taken

pH

- float, mutable - pH of sample

plateIdentifier

- str, mutable - plate identifier for sample

pseudoDimensions

- ccpn.core.PseudoDimension.PseudoDimension, immutable - Pseudodimensions where sample is used for only one point along the sampled dimension

rename(value: str)[source]

Rename Sample, changing its name and Pid.

rowNumber

- str, mutable - Row number on plate

sampleComponents

- (‘ccpn.core.SampleComponent.SampleComponent,) - contained SampleComponent objects sorted by id

shortClassName = 'SA'

Short class name, for PID.

spectra

- Tuple[ccpn.core.Spectrum.Spectrum, ...], mutable - ccpn.Spectra acquired using ccpn.Sample (excluding multiSample spectra)

spectrumHits

- Tuple[ccpn.core.SpectrumHit.SpectrumHit, ...], immutable - SpectrumHits that were found using Sample

ccpn.core.SampleComponent module

class ccpn.core.SampleComponent.SampleComponent[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

A Samplecomponent indicates a Substance contained in a specific Sample, (e.g. protein, buffer, salt), and its concentrations.

The Substance referred to is defined by the ‘name’ and ‘labeling’ attributes. FOr this reason teh SampleCOmponent cannot be renamed. See Substance.

className = 'SampleComponent'
comment

- str, mutable - Free-form text comment

concentration

- float, mutable -

concentrationError

- float, mutable - Estimated Standard error of SampleComponent.concentration

concentrationUnit

- str, mutable - Unit of SampleComponent.concentration, one of: ‘Molar’, ‘g/L’, ‘L/L’, ‘mol/mol’, ‘g/g’

labeling

- str, immutable - labeling descriptor of SampleComponent and corresponding substance

name

- str, immutable - name of SampleComponent and corresponding substance

purity

- float, mutable - SampleComponent.purity on a scale between 0 and 1

role

- str, mutable - Role of SampleComponent in solvent, e.g. ‘solvent’, ‘buffer’, ‘target’, ...

sample

- ccpn.core.Sample.Sample, immutable - Sample containing SampleComponent.

shortClassName = 'SC'

Short class name, for PID.

spectrumHits

- Tuple[ccpn.core.SpectrumHit.SpectrumHit, ...], immutable - ccpn.SpectrumHits found for SampleComponent

substance

- ccpn.core.Substance.Substance=None, immutable - Substance corresponding to SampleComponent

ccpn.core.Spectrum module

Spectrum class. Gives spectrum values, including per-dimension values as tuples. Values that are not defined for a given dimension (e.g. sampled dimensions) are given as None. Reference-related values apply only to the first Reference given (which is sufficient for all common cases).

Dimension identifiers run from 1 to the number of dimensions (e.g. 1,2,3 for a 3D). Per-dimension values are given in the order data are stored in the spectrum file - for CCPN data the preferred convention is to have the acquisition dimension as dimension 1.

The axisCodes are used as an alternative axis identifier. They are unique strings (so they can b recognised even if the axes are reordered in display). The axisCodes reflect the isotope on the relevant axis, and match the dimension identifiers in the reference experiment templates, linking a dimension to the correct reference experiment dimension. They are also used to map automatically spectrum axes to display axes and to other spectra. By default the axis name is the name of the atom being measured. Axes that are linked by a onebond magnetisation transfer are given a lower-case suffix to show the nucleus bound to. Duplicate axis names are distinguished by a numerical suffix. The rules are best shown by example:

Experiment axisCodes

1D Bromine NMR Br

3D proton NOESY-TOCSY H, H1, H2

19F-13C-HSQC Fc, Cf

15N-NOESY-HSQC OR 15N-HSQC-NOESY: Hn, Nh, H

4D HCCH-TOCSY Hc, Ch, Hc1, Ch1

HNCA/CB H. N. C

HNCO Hn, Nh, CO (CO is treated as a separate type)

HCACO Hca, CAh, CO (CA is treated as a separate type)

class ccpn.core.Spectrum.Spectrum(project: ccpn.core.Project.Project, wrappedData: ccpnmodel.ccpncore.api.ccp.nmr.Nmr.ShiftList)[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

A Spectrum object contains all the stored properties of an NMR spectrum, as well as the path to the stored NMR data file.

acquisitionAxisCode

- str=None, mutable - Axis code of acquisition axis - None if not known

aliasingLimits

- Tuple[Tuple[float, None], float=None] | ..., mutable - - ((float,float))*dimensionCount

tuple of tuples of (lowerAliasingLimit, higherAliasingLimit) for spectrum

assignmentTolerances

- Tuple[float=None, ...], mutable - Assignment tolerance in axis unit (ppm), per dimension.

automaticIntegration(spectralData)[source]
axisCodes

- Tuple[str=None, ...], mutable - axisCode, per dimension - None if no main ExpDimRef

axisUnits

- Tuple[str=None, ...], mutable - Main axis unit (most commonly ‘ppm’), per dimension - None if no unique code

Uses first Shift-type ExpDimRef if there is more than one, otherwise first ExpDimRef

chemicalShiftList

- ccpn.core.ChemicalShiftList.ChemicalShiftList, mutable - ccpn.ChemicalShiftList used for ccpn.Spectrum

className = 'Spectrum'
comment

- str, mutable - Free-form text comment

complexStoredBy

- str, immutable - Hypercomplex numbers are stored by (‘timepoint’, ‘quadrant’, or ‘dimension’).

dimensionCount

- int, immutable - Number of dimensions in spectrum

dimensionTypes

- Tuple[str, ...], immutable - dimension types (‘Fid’ / ‘Frequency’ / ‘Sampled’), per dimension

estimateNoise()[source]
experimentName

- str, mutable - Common experiment type descriptor (May not be unique).

experimentType

- str, mutable - Systematic experiment type descriptor (CCPN system).

filePath

- str, mutable - Absolute path to NMR data file.

foldingModes

- Tuple[str=None, ...], mutable - folding mode (values: ‘circular’, ‘mirror’, None), per dimension

gaussianBroadenings

- Tuple[float=None, ...], mutable - Gaussian broadening per dimension. Always None for sampled dimensions.

getIntegral(relativeId: str) → ccpn.core.Integral.Integral

Get contained ‘ccpn.core.Integral.Integral object by relative ID

getIntegralList(relativeId: str) → ccpn.core.IntegralList.IntegralList

Get contained ‘ccpn.core.IntegralList.IntegralList object by relative ID

getPeak(relativeId: str) → ccpn.core.Peak.Peak

Get contained ‘ccpn.core.Peak.Peak object by relative ID

getPeakList(relativeId: str) → ccpn.core.PeakList.PeakList

Get contained ‘ccpn.core.PeakList.PeakList object by relative ID

getPlaneData(position=None, xDim: int = 1, yDim: int = 2)[source]
getPseudoDimension(relativeId: str) → ccpn.core.PseudoDimension.PseudoDimension

Get contained ‘ccpn.core.PseudoDimension.PseudoDimension object by relative ID

getSliceData(position=None, sliceDim: int = 1)[source]
getSpectrumHit(relativeId: str) → ccpn.core.SpectrumHit.SpectrumHit

Get contained ‘ccpn.core.SpectrumHit.SpectrumHit object by relative ID

getSpectrumReference(relativeId: str) → ccpn.core.SpectrumReference.SpectrumReference

Get contained ‘ccpn.core.SpectrumReference.SpectrumReference object by relative ID

headerSize

- int, immutable - File header size in bytes.

integralLists

- (‘ccpn.core.IntegralList.IntegralList,) - contained IntegralList objects sorted by id

integrals

- (‘ccpn.core.Integral.Integral,) - contained Integral objects sorted by id

intensities

- numpy.ndarray, immutable - spectral intensities as NumPy array for 1D spectra

isComplex

- Tuple[bool, ...], mutable - Is dimension complex? - per dimension

isotopeCodes

- Tuple[str=None, ...], mutable - isotopeCode of isotope being measured, per dimension - None if no unique code

lorentzianBroadenings

- Tuple[float=None, ...], mutable - Lorenzian broadening in Hz per dimension. Always None for sampled dimensions.

magnetisationTransfers

- Tuple[ccpn.core.lib.SpectrumLib.MagnetisationTransferTuple, ...], immutable - tuple of MagnetisationTransferTuple describing magnetisation transfer between the spectrum dimensions.

MagnetisationTransferTuple is a namedtuple with the fields [‘dimension1’, ‘dimension2’, ‘transferType’, ‘isIndirect’] of types [int, int, str, bool] The dimensions are dimension numbers (one-origin] transfertype is one of (in order of increasing priority): ‘onebond’, ‘Jcoupling’, ‘Jmultibond’, ‘relayed’, ‘relayed-alternate’, ‘through-space’ isIndirect is used where there is more than one successive transfer step;

it is combined with the highest-priority transferType in the transfer path.
measurementTypes

- Tuple[str=None, ...], mutable - Type of value being measured, per dimension.

In normal cases the measurementType will be ‘Shift’, but other values might be ‘MQSHift’ (for multiple quantum axes), JCoupling (for J-resolved experiments), ‘T1’, ‘T2’, ...

name

- str, immutable - short form of name, used for id

negativeContourBase

- float, mutable - base level of negative contours

negativeContourColour

- str, mutable - colour of negative contours

negativeContourCount

- int, mutable - number of negative contours to draw

negativeContourFactor

- float, mutable - level multiplier for negative contours

newIntegralList(title: str = None, comment: str = None) → ccpn.core.IntegralList.IntegralList

Create new IntegralList within Spectrum

newPeakList(title: str = None, comment: str = None, isSimulated: bool = False, serial: int = None) → ccpn.core.PeakList.PeakList

Create new empty PeakList within Spectrum

newSpectrumHit(substanceName: str, pointNumber: int = 0, pseudoDimensionNumber: int = 0, pseudoDimension: ccpn.core.PseudoDimension.PseudoDimension = None, figureOfMerit: float = None, meritCode: str = None, normalisedChange: float = None, isConfirmed: bool = None, concentration: float = None, concentrationError: float = None, concentrationUnit: str = None, comment: str = None)

Create new SpectrumHit within Spectrum

newSpectrumReference(dimension: int, spectrometerFrequency: float, isotopeCodes: Sequence[str], axisCode: str = None, measurementType: str = 'Shift', maxAliasedFrequency: float = None, minAliasedFrequency: float = None, foldingMode: str = None, axisUnit: str = None, referencePoint: float = 0.0, referenceValue: float = 0.0) → ccpn.core.SpectrumReference.SpectrumReference

Create new SpectrumReference within Spectrum

numberType

- str, immutable - Data type of numbers stored in data matrix (‘int’ or ‘float’).

peakLists

- (‘ccpn.core.PeakList.PeakList,) - contained PeakList objects sorted by id

peaks

- (‘ccpn.core.Peak.Peak,) - contained Peak objects sorted by id

phases0

- tuple, mutable - zero order phase correction (or None), per dimension. Always None for sampled dimensions.

phases1

- Tuple[float=None, ...], mutable - first order phase correction (or None) per dimension. Always None for sampled dimensions.

pointCounts

- Tuple[int, ...], mutable - Number active of points per dimension

NB for FidDataDims more points than these may be stored (see totalPointCount).

pointOffsets

- Tuple[int, ...], mutable - index of first active point relative to total points, per dimension

positions

- numpy.ndarray, immutable - spectral region in ppm as NumPy array for 1D spectra

positiveContourBase

- float, mutable - base level of positive contours

positiveContourColour

- str, mutable - colour of positive contours

positiveContourCount

- int, mutable - number of positive contours to draw

positiveContourFactor

- float, mutable - level multiplier for positive contours

projectedPlaneData(xDim: int = 1, yDim: int = 2, method: str = 'max')[source]
projectedToFile(path: str, xDim: int = 1, yDim: int = 2, method: str = 'max', format: str = 'NmrPipe')[source]
pseudoDimensions

- (‘ccpn.core.PseudoDimension.PseudoDimension,) - contained PseudoDimension objects sorted by id

referencePoints

- Tuple[float=None, ...], mutable - point used for axis (chemical shift) referencing, per dimension.

referenceSubstance

- ccpn.core.Substance.Substance, mutable - Substance that has this Spectrum as reference spectrum

referenceValues

- Tuple[float=None, ...], mutable - value used for axis (chemical shift) referencing, per dimension.

rename(value: str)[source]

Rename Spectrum, changing its name and Pid

resetAssignmentTolerances()[source]

Reset assignment tolerances to default values

sample

- ccpn.core.Sample.Sample=None, mutable - ccpn.Sample used to acquire ccpn.Spectrum

scale

- float, mutable - Scaling factor for intensities and volumes. Intensities and volumes should be multiplied by scale before comparison.

shortClassName = 'SP'

Short class name, for PID.

sineWindowShifts

- Tuple[float=None, ...], mutable - Shift of sine/sine-square window function in degrees. Always None for sampled dimensions.

sliceColour

- str, mutable - colour of 1D slices

spectralWidths

- Tuple[float=None, ...], mutable - spectral width after processing in axis unit (ppm), per dimension

spectralWidthsHz

- Tuple[float=None, ...], mutable - spectral width (in Hz) before dividing by spectrometer frequency, per dimension

spectrometerFrequencies

- Tuple[float=None, ...], mutable - Tuple of spectrometer frequency for main dimensions reference

spectrumGroups

- Tuple[ccpn.core.SpectrumGroup.SpectrumGroup, ...], mutable - SpectrumGroups that contain Spectrum

spectrumHits

- (‘ccpn.core.SpectrumHit.SpectrumHit,) - contained SpectrumHit objects sorted by id

spectrumLimits

- Tuple[Tuple[float, None], float=None] | ..., immutable - - ((float,float))*dimensionCount

tuple of tuples of (lowerLimit, higherLimit) for spectrum

spectrumReferences

- (‘ccpn.core.SpectrumReference.SpectrumReference,) - contained SpectrumReference objects sorted by id

spectrumViews

- None, immutable - SpectrumViews showing Spectrum

spinningRate

- float, mutable - NMR tube spinning rate (in Hz).

totalPointCounts

- Tuple[int, ...], mutable - Total number of points per dimension

NB for FidDataDims and SampledDataDims these are the stored points, for FreqDataDims these are the points after transformation before cutting down.

windowFunctions

- Tuple[str=None, ...], mutable - Window function name (or None) per dimension - e.g. ‘EM’, ‘GM’, ‘SINE’, ‘QSINE’, .... Always None for sampled dimensions.

ccpn.core.SpectrumGroup module

class ccpn.core.SpectrumGroup.SpectrumGroup[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Combines multiple Spectrum objects into a group, so they can be treated as a single object.

className = 'SpectrumGroup'
name

- str, immutable - Name of SpectrumGroup, part of identifier

rename(value: str)[source]

Rename SpectrumGroup, changing its name and Pid

shortClassName = 'SG'

Short class name, for PID.

spectra

- Tuple[ccpn.core.Spectrum.Spectrum, ...], mutable - Spectra that make up SpectrumGroup.

ccpn.core.SpectrumHit module

class ccpn.core.SpectrumHit.SpectrumHit[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Used in screening and metabolomics implementations to describe a ‘hit’, i.e. that a Substance has been found to be present (metabolomics) or active (screening) in a given spectrum.

The Substance referred to is defined by the SubsanceName attribute, which is part of the ID. For this reason SpectrumHits cannot be renamed.

className = 'SpectrumHit'
comment

- str, mutable - Free-form text comment

concentration

- float, mutable - Concentration determined for the spectrumHit - used for e.g. Metabolomics where concentrations are not known a priori.

concentrationError

- float, mutable - Estimated Standard error of SpectrumHit.concentration

concentrationUnit

- str, mutable -

figureOfMerit

- float, mutable - Figure of merit describing quality of hit, between 0.0 and 1.0 inclusive.

isConfirmed

- bool=None, mutable - True if this Hit is confirmed? True: yes; False; no; None: not determined

meritCode

- str, mutable - User-defined merit code string describing quality of hit.

normalisedChange

- float, mutable - Normalized size of effect (normally intensity change). in range -1 <= x <= 1. Positive values denote expected changes, while negative values denote changes in the ‘wrong’ direction, e.g. intensity increase where a decrease was expected.

pointNumber

- int, immutable - Point number for pseudoDimension (0 if none), if the Hit only refers to one point in a pseudoDimension

pseudoDimension

- ccpn.core.PseudoDimension.PseudoDimension, immutable - PseudoDimension, if the Hit only refers to one point in a pseudoDimension

pseudoDimensionNumber

- int, immutable - Dimension number for pseudoDimension (0 if none), if the Hit only refers to one point in a pseudoDimension

sample

- ccpn.core.Sample.Sample, immutable - ccpn.Sample in which ccpn.SpectrumHit (for screening/metabolomics) is found

sampleComponent

- ccpn.core.SampleComponent.SampleComponent, immutable - ccpn.SampleComponent in which ccpn.SpectrumHit is found

shortClassName = 'SH'

Short class name, for PID.

spectrum

- ccpn.core.Spectrum.Spectrum, immutable - Spectrum containing spectrumHit.

substanceName

- int, immutable - Name of hit substance

ccpn.core.SpectrumReference module

class ccpn.core.SpectrumReference.SpectrumReference[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

ADVANCED. A SpectrumReference holds detailed information about axes and referencing needed for e.g. multple-quantum, projection, and reduced-dimensionality experiments.

SpectrumRefefences can only exist for Fourier transformed dimensions. Required for describing experiments with assignable splittings (e.g. J-coupling, RDC), reduced dimensionality, more than one nucleus per axis, or multi-atom parameters (J-dimensions, MQ dimensions).

axisCode

- str, mutable - Reference axisCode

axisUnit

- str, mutable - unit for transformed data using thei reference (most commonly ‘ppm’)

className = 'SpectrumReference'
dimension

- int, immutable - dimension number

dimensionType = 'Frequency'
foldingMode

- str=None, mutable - folding mode matching reference (values: ‘aliased’, ‘folded’, None)

isAcquisition

- bool, mutable - True if this dimension is the acquisition dimension?

isotopeCodes

- Tuple[str, ...], mutable - Isotope identification strings for isotopes. NB there can be several isotopes for e.g. J-coupling or multiple quantum coherence.

maxAliasedFrequency

- float, mutable - maximum possible peak frequency (in ppm) for this reference

measurementType

- str, mutable - Type of NMR measurement referred to by this reference. Legal values are: ‘Shift’,’ShiftAnisotropy’,’JCoupling’,’Rdc’,’TROESY’,’DipolarCoupling’, ‘MQShift’,’T1’,’T2’,’T1rho’,’T1zz’

minAliasedFrequency

- float, mutable - minimum possible peak frequency (in ppm) for this reference

referencePoint

- float, mutable - point used for axis (chemical shift) referencing.

referenceSerial

- int, immutable - Spectrum reference serial number

referenceValue

- float, mutable - value used for axis (chemical shift) referencing.

shortClassName = 'SR'

Short class name, for PID.

spectralWidth

- float, mutable - spectral width after processing (generally in ppm)

spectrometerFrequency

- float, mutable - Absolute frequency at carrier (or at splitting 0.0). In MHz or dimensionless.

spectrum

- ccpn.core.Spectrum.Spectrum, immutable - Spectrum containing spectrumReference.

ccpn.core.StructureEnsemble module

class ccpn.core.StructureEnsemble.StructureEnsemble[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

Ensemble of coordinate structures.

addAtomId(atomId, coordinateData: numpy.ndarray = None, occupancyData: Sequence[float] = None, bFactorData: Sequence[float] = None, atomNameData: Sequence[str] = None)[source]

Add atom with atomId. Atom is inserted at the end of the matching chain or residue (if any) otherwise at the end of the atomId list. Data matrices are filled with NaN or with the atom Name (for atomNameData)

addAtomIds(atomIds: Sequence[str], override: bool = False)[source]

Add atoms matching atomIds (in order) to empty structureEnsemble. Coordinate data to be added later. If override is True you can add to non-empty ensembles, and consistency is not checked.

addChain(chain: ccpn.core.Chain.Chain)[source]

Add atoms from Chain (in order) to empty structureEnsemble. Coordinate data to be added later

atomIds

- Tuple[str, ...], immutable - Tuple of atom id (‘chainCode.sequenceCode.residueType.atomName’ for atoms making up structure ensemble The atom IDs and their order is the same for all Models in the ensemble.

atomNameData

- numpy.ndarray, mutable - modelCount * atomCount numpy array of model-specific atom names. Intended for storing IUPAC atom names that vary from model to model NB the atomNameData array is a cached copy. It can be modified, but modifications will be kept in cache till the attribute is set or the project is saved.

bFactorData

- numpy.ndarray, mutable - modelCount * atomCount numpy array of atom B factors. NB the occupancyData array is a cached copy. It can be modified, but modifications will be kept in cache till the attribute is set or the project is saved.

className = 'StructureEnsemble'
comment

- str, mutable - Free-form text comment

coordinateData

- numpy.ndarray, mutable - modelCount * atomCount * 3 numpy array of coordinates. NB the coordinateData array is a cached copy. It can be modified, but modifications will be kept in cache till the attribute is set or the project is saved.

ensembleId

- int, immutable - ID number of StructureEnsemble, used in Pid and to identify the StructureEnsemble.

getAtomBFactors(atomId) → numpy.ndarray=None[source]

get nModels array of bFactors for atom atomId

getAtomCoordinates(atomId: str) → numpy.ndarray=None[source]

get nModels * 3 array of coordinates for atom atomId

getAtomOccupancies(atomId) → numpy.ndarray=None[source]

get nModels array of occupancies for atom atomId

getAtomSpecificNames(atomId) → numpy.ndarray=None[source]

get nModels array of model-specific names for atom atomId

getModel(relativeId: str) → ccpn.core.Model.Model

Get contained ‘ccpn.core.Model.Model object by relative ID

models

- (‘ccpn.core.Model.Model,) - contained Model objects sorted by id

newModel(title: str = None, comment: str = None, coordinateData: numpy.ndarray = None, bFactorData: Sequence[float] = None, occupancyData: Sequence[float] = None) → ccpn.core.Model.Model

Create new Model

CoordinateData can be a numpy.ndarray of the right shape, or any nested list or tuple representation that contains the right number of elements

occupancyData

- numpy.ndarray, mutable - modelCount * atomCount numpy array of atom occupancies. NB the occupancyData array is a cached copy. It can be modified, but modifications will be kept in cache till the attribute is set or the project is saved.

removeAtomId(atomId)[source]

Remove atom with atomId, adjusting data matrices to fit

removeAtomIds(atomIds: Sequence[str])[source]

Remove atoms with atomIds, adjusting data matrices to fit

replaceAtomIds(atomIds: Sequence[str])[source]

Replace atomIds with new list of the same length, without modifying coordinates and other data

residueIds

- Tuple[str, ...], immutable - Tuple of atom id (‘chainCode.sequenceCode.residueType’ for residues making up structure ensemble The residue IDs and their order is the same for all Models in the ensemble.

setAtomBFactors(atomId: str, value: numpy.ndarray)[source]

set nModels array of bFactors for atom atomId

setAtomCoordinates(atomId: str, value: numpy.ndarray)[source]

set nModels * 3 array of coordinates for atom atomId

setAtomOccupancies(atomId: str, value: numpy.ndarray)[source]

set nModels array of occupancies for atom atomId

setAtomSpecificNames(atomId: str, value: numpy.ndarray)[source]

set nModels array of specific atom names for atom atomId

shortClassName = 'SE'

Short class name, for PID.

ccpn.core.Substance module

class ccpn.core.Substance.Substance[source]

Bases: ccpn.core._implementation.AbstractWrapperObject.AbstractWrapperObject

A Substance is a chemical entity or material that can be added to a Sample. Substances are defined by their name and labeling attributes (labeling defaults to None). Renaming a Substance will also rename all SampleComponents and SpectrumHits associated with it, so as to preserve the link between the objects.

The most common case (by far) is substanceType ‘Molecule’, which corresponds to a chemical entity, such as Calmodulin, ATP, or NaCl. This type of Substance will have Smiles strings, sequence, and other molecular attributes as appropriate. Such a Substance may be associated with one or more Chains, and cna be used as a starting point to generate new Chains, using the Project.createPolymerSubstance() function.

ADVANCED: It is also possible to create Substances with substanceType ‘Material’ or ‘Cell’. Materials are used to describe chemical mixtures, such as fetal calf serum, algal lysate, or ‘standard experiment buffer number 3’.

atomCount

- int=None, mutable - Number of atoms in the molecule - for Molecular substances

bondCount

- int=None, mutable - Number of bonds in the molecule - for Molecular substances

casNumber

- str=None, mutable - CAS number string - for substances that have one

chains

- Tuple[ccpn.core.Chain.Chain, ...], immutable - ccpn.Chains that correspond to the sequence of ccpn.Substance (if defined)

className = 'Substance'
comment

- str, mutable - Free-form text comment

createChain(shortName: str = None, role: str = None, comment: str = None) → ccpn.core.Chain.Chain

Create new Chain that matches Substance

empiricalFormula

- str=None, mutable - Empirical molecular formula string - for substances that have one

hBondAcceptorCount

- int=None, mutable - Number of hydrogen bond acceptors in the molecule - for Molecular substances

hBondDonorCount

- int=None, mutable - Number of hydrogen bond donors in the molecule - for Molecular substances

inChi

- str=None, mutable - inChi string - for substances that have one

labeling

- str, immutable - labeling descriptor of Substance (default is ‘std’)

logPartitionCoefficient

- float=None, mutable - Logarithm of the octanol-water partition coefficient (logP) - for Molecular substances

molecularMass

- float=None, mutable - Molecular mass - for substances that have one

name

- str, immutable - name of Substance

polarSurfaceArea

- float=None, mutable - Polar surface area (in square Angstrom) of the molecule - for Molecular substances

referenceSpectra

- Tuple[ccpn.core.Spectrum.Spectrum, ...], mutable - Reference Spectra acquired for Substance. There should be only one reference spectrum for each experiment type

rename(name: str = None, labeling: str = None)[source]

Rename Substance, changing its name and/or labeling and Pid, and rename SampleComponents and SpectrumHits with matching names. If name is None, the existing value w ill be used. Labeling ‘None’ means ‘Natural abundance’

ringCount

- int=None, mutable - Number of rings in the molecule - for Molecular substances

sampleComponents

- Tuple[ccpn.core.SampleComponent.SampleComponent, ...], immutable - SampleComponents that correspond to Substance

sequenceString

- str=None, immutable - Molecular sequence string - set by the createPolymerSubstance function. Substances created by this function can be used to generate matching chains with the substance.createChain function

For standard polymers defaults to a string of one-letter codes; for other molecules to a comma-separated tuple of three-letter codes

shortClassName = 'SU'

Short class name, for PID.

smiles

- str=None, mutable - Smiles string - for substances that have one

substanceType

- str, immutable - Category of substance: Molecule, Cell, Material, or Composite

  • Molecule is a single molecule, including plasmids
  • Cell is a cell,
  • Material is a mixture, like fetal calf serum, growth medium, or standard buffer,
  • Composite is multiple components in fixed ratio, like a protein-ligand or multiprotein

complex, or (technically) a Cell containing a particular plasmid.

synonyms

- Tuple[str, ...], mutable - Synonyms for Substance name

userCode

- str=None, mutable - User-defined compound code