Date post: | 11-Jan-2016 |
Category: |
Documents |
Upload: | roland-walker |
View: | 215 times |
Download: | 1 times |
The CCPN ProjectTim Stevens and Wayne BoucherTim Stevens and Wayne Boucher
October 2005October 2005
CCPN at Göteborg: Day 1■ Introduction to CCPNIntroduction to CCPN■ The CcpNmr applicationsThe CcpNmr applications■ Analysis basicsAnalysis basics■ Future developmentsFuture developments■ Analysis advancedAnalysis advanced
CCPN at Göteborg: Day 2■ An overview of the data modelAn overview of the data model■ API TutorialAPI Tutorial■ Analysis MacrosAnalysis Macros■ Widgets and PopupsWidgets and Popups
CCPN OverviewCCPN Overview
The CCPN Project
■ Collaborative Computing Project for NMRCollaborative Computing Project for NMR● Started in 1999Started in 1999● Collaborators in several countriesCollaborators in several countries● Developers at University of Cambridge and EBIDevelopers at University of Cambridge and EBI
■ Unifying platform for NMR softwareUnifying platform for NMR software● Similar toSimilar to CCP4 (X-ray) CCP4 (X-ray)
■ Main goals:Main goals:● Data standards and data exchangeData standards and data exchange● Software developmentSoftware development and distribution and distribution● Meetings to determine and disseminate best practiceMeetings to determine and disseminate best practice● Open source accessOpen source access
People
■ CambridgeCambridge● Ernest LaueErnest Laue● Rasmus FoghRasmus Fogh● Dan O’DonovanDan O’Donovan
■ EBI, HinxtonEBI, Hinxton● Kim HenrickKim Henrick● John IonidesJohn Ionides● Wim VrankenWim Vranken● Anne PajonAnne Pajon
History
■ Workshops:Workshops:● EBI (2000, 2001)EBI (2000, 2001)● Washington (2000)Washington (2000)
■ Funding:Funding:● BBSRC (2000-2003, 2003-2006)BBSRC (2000-2003, 2003-2006)● NMRQUAL (2001-2004)NMRQUAL (2001-2004)● TEMBLOR (2002-2005)TEMBLOR (2002-2005)● NMR-EXTEND (2005-2008)NMR-EXTEND (2005-2008)
NMR Software
■ Problem - Heterogeneous developmentProblem - Heterogeneous development● Lots of proprietary data formatsLots of proprietary data formats● Lots of stand-alone programsLots of stand-alone programs● Data is ‘lost’ along the wayData is ‘lost’ along the way● Dedicated converters neededDedicated converters needed● Not acceptable for structural genomics projectsNot acceptable for structural genomics projects
■ Solution - UnitySolution - Unity● Data standardsData standards
■ Ease of transfer between programsEase of transfer between programs■ Completeness, integrity, deposition, data miningCompleteness, integrity, deposition, data mining
● LibrariesLibraries
Data Format vs. Data Model
■ Data format - How data is storedData format - How data is stored● STARSTAR● XMLXML● SQLSQL● Tab-separated asciiTab-separated ascii
■ Data model - What data meansData model - What data means● RCSB (PDB) mmCIFRCSB (PDB) mmCIF● XML DTD or schemasXML DTD or schemas● SQL schemaSQL schema
CCPN Approach
■ Data model rather than data formatData model rather than data format● Format independentFormat independent● Language independentLanguage independent● Scientifically descriptive (NMR)Scientifically descriptive (NMR)
■ Library (API): in memory manipulationLibrary (API): in memory manipulation● Create, update, delete & query objectsCreate, update, delete & query objects● One for each languageOne for each language● Error checkingError checking
■ I/O modules: load/store data from/to diskI/O modules: load/store data from/to disk● One for each (storage format, language)One for each (storage format, language)● BookkeepingBookkeeping
Application View
User
ApplicationApplication11
Data StoreData Store(XML, SQL)(XML, SQL)
ApplicationApplication22 ApplicationApplication33
In Memory RepresentationIn Memory Representation(Python, Java, C++, Perl)(Python, Java, C++, Perl)
GUIGUI
APIAPI
I/OI/O
Model-Driven Architecture
■ UML: Unified Modelling LanguageUML: Unified Modelling Language● Abstract representation of semanticsAbstract representation of semantics● PictorialPictorial
■ Mapping from UML: to anythingMapping from UML: to anything● Multi-languageMulti-language● Multi-formatMulti-format● Architecture neutral (e.g. distributed or not)Architecture neutral (e.g. distributed or not)
■ Power: good and badPower: good and bad■ CCPN uses Object Domain as its UML toolCCPN uses Object Domain as its UML tool
● Python as scripting languagePython as scripting language
User
Docum
entationA
pplicationD
eposition
APIs
Python
Java
C
Perl
Storage
SQL
XML
Handcoded (1%)
UML Model
Package 1
Package 2
Package 3
Autogeneration
DomainExperts
MEMOPSframework
ProgramDevelopers
Data Model Packages
MoleculeSequence
NMR
Citations
Nuclei andIsotopes
ExperimentalProtocols
Organisms,Taxonomy
CcpNmrPrograms
CompoundSource
StructureTargets
Crystallisation
CompoundPreparation
ProjectTracking
X-rayCrystallography
Structure andCoordinates
ResidueTemplate
MolecularSystem
Reference
Molecule
Laboratory
Samples
UML Example
CCPN API
■ Classes for developersClasses for developers● Mainly getters and settersMainly getters and setters● More than just code stubsMore than just code stubs● Constraints (e.g. cardinality) enforcedConstraints (e.g. cardinality) enforced● Links the hard partLinks the hard part
■ Mostly (> 99%) auto generated from UMLMostly (> 99%) auto generated from UML● Some helper functions and constraints hand codedSome helper functions and constraints hand coded
■ Currently around 360k lines in Python and 650k Currently around 360k lines in Python and 650k lines in Javalines in Java
Developer Benefits
■ Specified data model and APISpecified data model and API■ No I/O codeNo I/O code■ Concentrate on science, not bookkeepingConcentrate on science, not bookkeeping■ ExtendibleExtendible
● Application data can be assigned to any objectApplication data can be assigned to any object● UML model can be extended (packages)UML model can be extended (packages)
■ Notification systemNotification system● Register interest when specified attribute changes Register interest when specified attribute changes
(class, not object, level)(class, not object, level)
■ Undo/Redo (in future)Undo/Redo (in future)
Current Status of API
■ Stable and released:Stable and released:● Python and XML code generationPython and XML code generation● NMR, molecule description and structure data modelNMR, molecule description and structure data model
■ In testing stages:In testing stages:● Java and SQL database code generationJava and SQL database code generation● Protein production data modelProtein production data model
■ Preliminary:Preliminary:● X-ray crystallography data modelX-ray crystallography data model
CcpNmr ApplicationsCcpNmr Applications
Structural Biology Pipeline
NMR machine
NMR machine
Dataprocessing
Dataprocessing
Spectrumanalysis
Spectrumanalysis
Structurecalculation
Structurecalculation
DatabasesDatabases
NMR Applications
CcpNmr
Processing
CCPNData Model
CcpNmrFormatConvert
er
Reference data
Other formats (NmrView, XEasy, …)
NMRStar 3.0
CcpNmrAnalysis
ARIA 2.0 Validationsoftware
Main CcpNmr Applications
■ Format ConverterFormat Converter● Conversion to and from legacy formatsConversion to and from legacy formats
■ AnalysisAnalysis● Graphical analysis (e.g. assignment) programGraphical analysis (e.g. assignment) program
■ ProcessingProcessing (coming soon)(coming soon)● Azara “process” wrapped in data modelAzara “process” wrapped in data model
CcpNmr Format Converter
■ Import/export of data formats to the Data ModelImport/export of data formats to the Data Model● For harvesting/deposition purposesFor harvesting/deposition purposes● Allow people to use or try out the data modelAllow people to use or try out the data model● Interaction with existing programsInteraction with existing programs
■ Fully or partially handles:Fully or partially handles:● Ansig, Auremol, Autoassign, Azara, Bruker, Charmm, Ansig, Auremol, Autoassign, Azara, Bruker, Charmm,
CNS/XPLOR/ARIA, Concoord, Diana/Dyana/Cyana, Discover, CNS/XPLOR/ARIA, Concoord, Diana/Dyana/Cyana, Discover, Fasta, Felix, Module, .mol, Molmol, Monte, NmrDraw, NMRPipe, Fasta, Felix, Module, .mol, Molmol, Monte, NmrDraw, NMRPipe, NMR-STAR (v2.1.1, v3.0), NmrView, Pdb, Pipp, Pistachio, Pronto, NMR-STAR (v2.1.1, v3.0), NmrView, Pdb, Pipp, Pistachio, Pronto, Sparky, Talos, Varian, XEasySparky, Talos, Varian, XEasy
● Sequences, chemical compounds, coordinates, NMR Sequences, chemical compounds, coordinates, NMR measurements, constraints and peak lists, processing and measurements, constraints and peak lists, processing and acquisition parameters.acquisition parameters.
Format Converter - The NMR Translator
CCPNData Model
Peaks Chemical shifts Acquisition parameters
XEasy NmrView XEasy NmrView Bruker Varian... ...
Generic peak converter
Generic chemical shift converter
Generic acquisition parameters converter
Processing parameters
XEasy XEasy NmrView NMRPipeAzara... ...NmrView
Fo
rmat
sp
ecif
ic r
ead
ers
Dat
a m
od
e l e
ntr
yF
orm
at s
pec
ific
wri
ters
Chemical shiftsPeaks
Format Converter Design
■ Wim Vranken (EBI)Wim Vranken (EBI)■ Set of Python scriptsSet of Python scripts■ Accessed Accessed viavia::
● Tkinter (Tcl/Tk)Tkinter (Tcl/Tk)● custom Python scriptscustom Python scripts
■ http://www.ebi.ac.uk/msd-srv/docs/NMR/http://www.ebi.ac.uk/msd-srv/docs/NMR/NMRtoolkit/main.htmlNMRtoolkit/main.html
CcpNmr Analysis
■ RequirementsRequirements● Cross platformCross platform● ScalableScalable● ExtensibleExtensible● Open and easy scripting languageOpen and easy scripting language● Modern graphical user interfaceModern graphical user interface● Uses CCPN data model and APIUses CCPN data model and API
■ SoftwareSoftware● Python, Tcl/Tk, C, OpenGLPython, Tcl/Tk, C, OpenGL● (Java, X, Motif)(Java, X, Motif)
■ OSOS● Linux, Sun, SGI, OSX (Windows)Linux, Sun, SGI, OSX (Windows)
Spectrum Windows
■ N-dim. windowsN-dim. windows■ Multiple spectraMultiple spectra■ Automatic mappingAutomatic mapping■ Contours on flyContours on fly■ AliasingAliasing■ Strips & cellsStrips & cells■ Mouse and keyMouse and key■ Blocked dataBlocked data
● AzaraAzara● FelixFelix● NMRPipeNMRPipe● UCSFUCSF
Graphical Interface
■ Menus and popup dialoguesMenus and popup dialogues● CcpNmr widgetsCcpNmr widgets
■ Main objectsMain objects● SpectraSpectra● WindowsWindows● PeaksPeaks● ResonancesResonances● MoleculesMolecules● StructuresStructures
Assignment
■ Peak finding and fittingPeak finding and fitting■ Rich assignment modelRich assignment model■ Mainly mouse-drivenMainly mouse-driven■ Can assign to atomsCan assign to atoms■ Ambiguous contributionsAmbiguous contributions■ Existing structureExisting structure■ Short resonance listShort resonance list■ Multiple peaks easilyMultiple peaks easily■ NavigationNavigation
The CLOUDS Protocol
■ Automated assignment & Automated assignment & structure determinationstructure determination● Miguel Llinas, Alex Grishaev, et al.Miguel Llinas, Alex Grishaev, et al.● Spatial distribution of anonymous Spatial distribution of anonymous
resonances generated with NOEsresonances generated with NOEs
■ Integrated Integrated within CCPNwithin CCPN● An Analysis moduleAn Analysis module● Data Model glues modulesData Model glues modules● Functional platformFunctional platform● Distribution networkDistribution network
Spectra
Distance Constraints
Proton Clouds
Chain Assignment
Protein Structure
Spin Systems NOE intensities
Pick Peaks &Normalise
Pick Peaks,Link Shifts &
Combine
Relaxation MatrixOptimisation
Hydrogen AtomMolecular Dynamics
Chain Fitting &Molecular Replacement
Full StructureCalculation
The CLOUDS Protocol
A family of Clouds A fitted protein backbone
Other Features
■ Works with FormatConverterWorks with FormatConverter■ Chemical compounds databaseChemical compounds database■ NMR reference informationNMR reference information■ Hard copyHard copy
● PostScriptPostScript● PDFPDF
■ Table exportTable export■ Rate analysisRate analysis■ MacrosMacros■ StructuresStructures
CcpNmr Analysis Tutorial Part ICcpNmr Analysis Tutorial Part I
CCPN FutureCCPN Future
Extend-NMR
■ EU STREP application funded to fully EU STREP application funded to fully integrate software from:integrate software from:● Bruker (TOPSPIN, acquisition)Bruker (TOPSPIN, acquisition)● Billeter, Orekhov (Garant, Munin, MDD)Billeter, Orekhov (Garant, Munin, MDD)● Kalbitzer (Auremol)Kalbitzer (Auremol)● Llinas (CLOUDS)Llinas (CLOUDS)● Nilges (Inferential Structure Determination)Nilges (Inferential Structure Determination)● Bonvin (Haddock, RECOORD)Bonvin (Haddock, RECOORD)● Vriend, Vuister (Queen, What-Check)Vriend, Vuister (Queen, What-Check)● Henrick, Vranken (NMR database)Henrick, Vranken (NMR database)
■ Focus on complexes and development of Focus on complexes and development of better software methodologybetter software methodology
LIMS Collaborations
■ PIMS project collaborationPIMS project collaboration● Protein production LIMS Protein production LIMS
(with EBI, Sport Consortia, OPPF and Poupon)(with EBI, Sport Consortia, OPPF and Poupon)
■ EU STREP application (SFGLIMS) to work with :EU STREP application (SFGLIMS) to work with :● Poupon (Protein Production)Poupon (Protein Production)● Perrakis (Biophysical methods, crystallisation)Perrakis (Biophysical methods, crystallisation)● Bricogne (X-ray data collection and structure Bricogne (X-ray data collection and structure
generation)generation)● Prilusky, Sussman (Bioinformatics, data mining)Prilusky, Sussman (Bioinformatics, data mining)
Data Model Extensions
■ EXTEND-NMREXTEND-NMR● New NMR applicationsNew NMR applications
■ Solid state NMRSolid state NMR■ PIMSPIMS
● LIMS for protein productionLIMS for protein production
■ SFGLIMSSFGLIMS● LIMS for NMR and X-ray structure determinationLIMS for NMR and X-ray structure determination
■ X-rayX-ray■ ChemoinformaticsChemoinformatics■ (Metabolomics?)(Metabolomics?)
Code Generation Plans
■ C++/C/FORTRAN codeC++/C/FORTRAN code● Needed for Extend-NMR and for CcpNmr ProcessingNeeded for Extend-NMR and for CcpNmr Processing● Needed for interface to CYANA, NMRPIPE, Needed for interface to CYANA, NMRPIPE,
AUTOPSY, etc.AUTOPSY, etc.
■ Java/Database codeJava/Database code● Extend for LIMS, high-throughput projects, NMRVIEWExtend for LIMS, high-throughput projects, NMRVIEW
■ Basic MachineryBasic Machinery● Upgrades for long term extensibility/maintainability Upgrades for long term extensibility/maintainability
and performanceand performance
API Languages and Formats
Python Java C++ Perl
XML
SQL
Analysis Analysis FormatConverterFormatConverter
Bruker Bruker TopSpinTopSpin
NMRVIEWNMRVIEW
AzaraAzara
Extend-NMRExtend-NMR
NMRPIPE NMRPIPE AUTOPSYAUTOPSY
(Varian)(Varian)
(CYANA)(CYANA)
(Bioinformatics)(Bioinformatics)
MSD NMR MSD NMR databasedatabase
PIMS PIMS SFGLIMSSFGLIMS
(SFGLIMS) (SFGLIMS) (bioinformatics)(bioinformatics)
Fo
rmat
Language
For all languages:• Metamodel• Documentation
For all formats:• Schemas• I/O mappings
New Core API technology
■ Reduce burden of adding new languages, formatsReduce burden of adding new languages, formats● Languages (Python, Java, C++, Perl)Languages (Python, Java, C++, Perl)● Storage formats (XML, SQL)Storage formats (XML, SQL)
Language & Formatindependent
Format dependentonly
Language dependentonly
Language & Formatdependent
Code required for
new language Code required for
new format
Most of the logic
Core API technology, cont.
■ Remodelling of implementation detailsRemodelling of implementation details● Storages, collection types, root objects, etc.Storages, collection types, root objects, etc.
■ Complex data typesComplex data types● e.g. rotation matrixe.g. rotation matrix
■ Client/Server architectureClient/Server architecture● For PIMS and SFGLIMSFor PIMS and SFGLIMS
Analysis Development
■ Beyond CLOUDSBeyond CLOUDS● Large proteins, homologuesLarge proteins, homologues
■ Processing linked inProcessing linked in■ Couplings (RDCs, TROSY), dihedral Couplings (RDCs, TROSY), dihedral
constraintsconstraints■ Titrations (Ka, Kd)Titrations (Ka, Kd)■ Chain states (alternate conformations)Chain states (alternate conformations)■ Solid State NMRSolid State NMR■ Organic chemistry NMR (1D)Organic chemistry NMR (1D)■ Publication-ready diagrams and tablesPublication-ready diagrams and tables■ Windows versionWindows version
Developments in Extend-NMR
■ Integrated Bayesian, maximum entropy, … Integrated Bayesian, maximum entropy, … methods for data-processing, analysis and methods for data-processing, analysis and structure calculationstructure calculation
■ ‘‘Molecular replacement’ for NMR Molecular replacement’ for NMR ■ Further RECOORD developmentFurther RECOORD development■ Databank for Experimental NMR spectra (DEN)Databank for Experimental NMR spectra (DEN)■ MSD database analysisMSD database analysis
Licenses
■ GPLGPL● Data modelData model● Scripts which produce APIsScripts which produce APIs
■ LGPLLGPL● Generic librariesGeneric libraries● Widget librariesWidget libraries● Format ConverterFormat Converter
■ CCPNCCPN● AnalysisAnalysis
Resources, 1
■ SourceForge:SourceForge:● CVS repository for codeCVS repository for code● API and FormatConverter releasesAPI and FormatConverter releases● http://sourceforge.net/projects/ccpnhttp://sourceforge.net/projects/ccpn
■ CCPN:CCPN:● Meetings, workshopsMeetings, workshops● API, FormatConverter and Analysis releasesAPI, FormatConverter and Analysis releases● http://www.ccpn.ac.ukhttp://www.ccpn.ac.uk
Resources, 2
■ EBI:EBI:● Format ConverterFormat Converter● Databases (MSD group)Databases (MSD group)● http://www.ebi.ac.uk/msd-srv/docs/NMR/http://www.ebi.ac.uk/msd-srv/docs/NMR/
NMRtoolkit/main.htmlNMRtoolkit/main.html
■ JISCMAIL:JISCMAIL:● Email listEmail list● http://www.jiscmail.ac.uk/lists/ccpnmr.htmlhttp://www.jiscmail.ac.uk/lists/ccpnmr.html● (http://www.jiscmail.ac.uk/lists/nmrgen.html)(http://www.jiscmail.ac.uk/lists/nmrgen.html)
CcpNmr Analysis Tutorial Part IICcpNmr Analysis Tutorial Part II
CCPN at Göteborg: Day 2■ An overview of the data modelAn overview of the data model■ API TutorialAPI Tutorial■ Analysis MacrosAnalysis Macros■ Widgets and PopupsWidgets and Popups
Major Data Model PackagesMajor Data Model Packages
CCPN Packages
■ Groupings of related dataGroupings of related data● e.g. NMR, X-ray, Molecular descriptione.g. NMR, X-ray, Molecular description
■ Connections between packagesConnections between packages● e.g. NMR loads Nucleus (isotope) e.g. NMR loads Nucleus (isotope)
informationinformation
■ Allows lazy loadingAllows lazy loading● Only load relevant dataOnly load relevant data● Only load when a link is queriedOnly load when a link is queried
■ Save only modifiedSave only modified
■ Reference packagesReference packages● Chemical compound, Reference Chemical compound, Reference
chemical shiftschemical shifts
Nmr
ChemCompMolecule
Nucleus
Coordinates
MolSystem
People
Sample
ChemElement
ChemElement - Details
Coordnates
Analysis
Implementation
Molecules and MolSystemsMolecules and MolSystems
■ MoleculesMolecules● Templates for specifying molecular connectivity.Templates for specifying molecular connectivity.● Sequences, chemical components, protonation state etc.Sequences, chemical components, protonation state etc.● A kind of reference, e.g. “Lysozyme”A kind of reference, e.g. “Lysozyme”
■ MolSystemsMolSystems● Contain chains, which contain residues, which contain atoms.Contain chains, which contain residues, which contain atoms.● The objects you assign to.The objects you assign to.● Built using molecule templates, e.g. a homo-oligomer is built Built using molecule templates, e.g. a homo-oligomer is built
using the same template to make different chains.using the same template to make different chains.
■ Stored in different packagesStored in different packages● Molecule.xml, MolSystem.xmlMolecule.xml, MolSystem.xml
MolSystem
Molecule
ChemComp
Experiment, Spectrum & Shift List Objects
■ Experiment● The set-up under particular conditions at a particular time, not a class of
experiment.
■ Spectrum● Known as Data Source in the data model. A pointer to a chunk of data
that results from an experiment. Several spectra may result from the same experiment if they are processed differently.
■ Peak List● A set of crosspeaks that have been picked for a spectrum. A spectrum
can have several peak lists. The user can separate peaks into classes, e.g. picked in different ways.
■ Shift List● A set of chemical shifts, which are derived from peaks and may be
linked to atoms. Valid for a set of experiments with similar conditions that give similar chemical shifts. Using different shift lists doesn’t change assignments, but it does change which peaks are used in the calculation of a shift value.
Nmr
Nmr.Peak
Resonances and Assignment
Resonance
ConstraintDistanceDihedral
MeasurementChemical ShiftRelaxationCoupling
MoleculeAtomsResiduesChains
StructureCo-ordinates
AnnotationSpin SystemConnectivityResidue Type
ExperimentSpectraConditions
PeakDimensions
■ ResonancesResonances● The centre of the NMR data The centre of the NMR data
modelmodel
■ Connect to peaksConnect to peaks● Different peaks may be Different peaks may be
caused by the same thing.caused by the same thing.
■ Connect to atomsConnect to atoms● A connection to NMR A connection to NMR
equivalent atoms. Need not equivalent atoms. Need not be set if anonymous.be set if anonymous.
■ Have chemical shiftsHave chemical shifts● May have different shifts May have different shifts
under different conditions.under different conditions.
Nmr.Resonance
NmrConstraints
Python API coding tutorialPython API coding tutorial
Development in the CCPN framework
■ CcpNmr MacrosCcpNmr Macros● Small home-use Python Small home-use Python
functionsfunctions
■ Additions to function libraryAdditions to function library● Functions incorporated in Functions incorporated in
software releasesoftware release● Community sharingCommunity sharing
■ Embedded optionsEmbedded options● Extension to CcpNmr applicationExtension to CcpNmr application
■ Stand-alone applicationsStand-alone applications● Built on CCPN libraries and APIBuilt on CCPN libraries and API
■ CcpNmr Clouds has examples of CcpNmr Clouds has examples of all of theseall of these
The Python interface to the CCPN Data Model
■ Find the number of assigned peaks in a spectrumFind the number of assigned peaks in a spectrum
count = 0count = 0for peakList in spectrum.peakLists:for peakList in spectrum.peakLists: for peak in peakList.peaks:for peak in peakList.peaks: for peakDim in peak.peakDimsfor peakDim in peak.peakDims if peakDim.peakDimContribs:if peakDim.peakDimContribs: count += 1count += 1 breakbreak
■ Find all H-C partners in a residueFind all H-C partners in a residue
pairs = []pairs = []for atom in residue.atoms:for atom in residue.atoms: if atom.chemAtom.elementSymbol == ‘C’:if atom.chemAtom.elementSymbol == ‘C’: for bond in atom.chemAtom.chemBonds:for bond in atom.chemAtom.chemBonds: chemAtoms = list(bond.chemAtoms)chemAtoms = list(bond.chemAtoms) chemAtoms.remove(chemAtom)chemAtoms.remove(chemAtom) if chemAtoms[0].elementSymbol == ‘H’:if chemAtoms[0].elementSymbol == ‘H’: pairs append([atom, residue.findFirstAtom(chemAtom=chemAtom2))])pairs append([atom, residue.findFirstAtom(chemAtom=chemAtom2))])
CcpNmr Analysis Macros
■ Python scripts/functionsPython scripts/functions■ Accessible from Analysis and embeddableAccessible from Analysis and embeddable■ Argument serverArgument server
● An interface to the Analysis programAn interface to the Analysis program● Access to objectsAccess to objects
■ Selected peaksSelected peaks■ Cursor positionCursor position■ SpectraSpectra■ WindowsWindows■ Etc…Etc…
■ High-level function libraryHigh-level function library● Windows, Assignment, Molecules, ConstraintsWindows, Assignment, Molecules, Constraints● DocumentedDocumented
Macro 1 - Simple stuff
• Python language• Function anatomy• Import library functions• ArgumentServer• Simple program
def addMarksToPeaks(argServer, peaks=None): """Descrn: Adds position line markers to the selected peaks. Inputs: ArgumentServer, List of Nmr.Peaks Output: None """ from ccpnmr.analysis.MarkBasic import createPeakMark if not peaks: peaks = argServer.getCurrentPeaks()
# no peaks - nothing happens for peak in peaks: createPeakMark(peak, remove=0)
Macro 2 - Ask the user
def calcAveragePeakListIntensity(argServer, peakList=None, intensityType='height'): """Descrn: Find the average height of peaks in a peak list. Inputs: ArgumentServer, Nmr.PeakList Output: Float """ from ccpnmr.analysis.ConstraintBasic import getMeanPeakIntensity if not peakList: peakList = argServer.getPeakList()
if not peakList: argServer.showWarning('No peak list selected') return answer = argServer.askYesNo('Use peak volumes? Height will be used otherwise.') if answer: # is true intensityType = 'volume'
spec = peakList.dataSource expt = spec.experiment intensity = getMeanPeakIntensity(peakList.peaks, intensityType=intensityType) data = (intensityType,expt.name,spec.name,peakList.serial,intensity)) argServer.showInfo('Mean peak %s for %s %s peak list %d is %e' % data return intensity
Macro 3 - Popup loader
def openMyPopup(argServer): """Descrn: Opens and example popup. Inputs: ArgumentServer Output: None """
peakList = argServer.getPeakList() popup = MyPopup(argServer.parent, peakList)
from memops.gui.BasePopup import BasePopupfrom memops.gui.ButtonList import ButtonListfrom memops.gui.ScrolledGraph import ScrolledGraphfrom ccpnmr.analysis.PeakBasic import getPeakHeight, getPeakVolume
Macro 3 - The popup
class MyPopup(BasePopup): def __init__(self, parent, peakList, *args, **kw): self.peakList = peakList self.colours = ['red', 'green'] self.dataSets = [] BasePopup.__init__(self, parent=parent, title='Test Popup', **kw)
def body(self, guiParent): row = 0 self.graph = ScrolledGraph(guiParent) self.graph.grid(row=row, column=0, sticky='NSEW') row += 1 texts = ['Draw graph','Goodbye'] commands = [self.draw, self.destroy] buttons = ButtonList(guiParent, texts=texts, commands = commands) buttons.grid(row=row, column=0, sticky='NSEW')
def draw(self): self.dataSets = self.getData() self.graph.update(self.dataSets, self.colours)
def getData(self): peakData = [( getPeakVolume(peak) or 0.0, peak) for peak in self.peakList.peaks] peakData.sort() heights = [] volumes = [] i = 0 for volume, peak in peakData: heights.append([i, getPeakHeight(peak) or 0.0]) volumes.append([i, volume]) i += 1
CcpNmr Graphical Widgets
■ A library for any developer to A library for any developer to useuse
ColorListColorList
PulldownMenuPulldownMenu
ScrolledMatrixScrolledMatrix
LabelFrameLabelFrame
CheckButtonCheckButton
ButtonButton
LabelLabel
EntryEntry
ButtonListButtonList
CcpNmr Mega Widgets
■ Build them into your own Build them into your own code!code!● ScrolledMatrixScrolledMatrix● ScrolledGraphScrolledGraph● StructureFrameStructureFrame
Ccp Stand-Alone AppTemplate
■ Menu SystemMenu System
■ Project handlingProject handling● NewNew● LoadLoad● SaveSave● BackupBackup
■ Popup templatePopup template● WidgetsWidgets● GeometryGeometry● PlumbingPlumbing
Popup Constructors and Notifiers
■ InitInit● Setup local variablesSetup local variables● Subclass popup windowSubclass popup window
■ BodyBody● Arrange Graphical elementsArrange Graphical elements● Set up Data Model notifiersSet up Data Model notifiers● Set initial stateSet initial state
■ UpdateUpdate● Process updated valuesProcess updated values● Redraw widgets based on statusRedraw widgets based on status
■ Widget callbackWidget callback● From entry, buttons etcFrom entry, buttons etc● User functionsUser functions● Data Model changeData Model change
Body
Update
Notifiers
WidgetsData
Model
ExternalInfluenceInitialisation
UserInfluence
Update Filter
Aftercare
■ www.ccpn.ac.ukwww.ccpn.ac.uk● DownloadsDownloads● Data Model documentationData Model documentation● Analysis documentationAnalysis documentation● TutorialsTutorials
■ Mailing ListMailing List● http://www.jiscmail.ac.uk/lists/CCPNMR.html http://www.jiscmail.ac.uk/lists/CCPNMR.html ● Quick responseQuick response● BugsBugs● RequestsRequests