JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for CCPNMR Archives


CCPNMR Archives

CCPNMR Archives


CCPNMR@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

CCPNMR Home

CCPNMR Home

CCPNMR  July 2004

CCPNMR July 2004

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: data model & formatConverter

From:

Wim Vranken <[log in to unmask]>

Reply-To:

CcpNmr software mailing list <[log in to unmask]>

Date:

Thu, 8 Jul 2004 14:38:07 +0100

Content-Type:

MULTIPART/MIXED

Parts/Attachments:

Parts/Attachments

TEXT/PLAIN (95 lines) , importCns.py (1 lines)

Hi Leigh,

Well first of all thanks for trying out the data model and the Format
Converter. Concerning the following then:

> I am currently writing a program which reads in CNS distance restraints
> and does some processing on them.  From the
> cpp.python.cns.distanceConstraintsIO docs, I can see the
> distanceConstraints class and its methods, and I have also looked at the
> python code for distanceConstraintsIO.py.  I can create an instance of
> CnsDistanceCOnstraintFile, and use it to read in my data.
>
> What I cannot find is a definition of the attributes used for a cns
> distance constraint.  If I look at the code (distanceConstraintsIO.py), I
> can see that there are attributes called targetDist, minusDist, etc.  But
> if i look at the data model cpp.app.nmr.abstractConstraint, there are no
> attributes called targetDist etc.  the same goes for the data model
> cpp.app.nmr.distanceconstraint.  Where are the data model definitions that
> formatConverter is using?  Or should I not be using the formatConverter
> routines at all, and just using the cpp.app.nmr.distanceconstraint data
> model and writing my own routines to do input and output?

The problem you are having is because the Format Converter itself works in
two layers:

- A parser layer (in ccp.format). This layer parses the CNS, NmrView, ...
files and puts the data in temporary classes, or writes out the data from
temporary classes to a file.

- A generic conversion layer (in ccpnmr.format.converters). Here classes
are defined to import the data from the parser layer into the Data Model,
and to export Data Model information to the parser layer classes. The main
class here is DataFormat, with format specific information defined in
CnsFormat, CyanaFormat, ... .

This distinction was made because a lot of the conversion code for
importing, for example, distance constraints into the Data Model is
generic - it doesn't matter whether you're importing CYANA or CNS data, a
lot of the operations are exactly the same.

So in response to your question, there's basically two ways you could
proceed:

- use only the parser layer for parsing (and writing) the CNS files, and
then use the temporary classes in there to do your processing. This way
you are not using the Data Model at all and your code will work only for
CNS.

- use the whole FormatConverter setup to import the CNS constraints into
the Data Model, then do your processing inside the Data Model, and export
the files in CNS again. This way your code works with the Data Model
itself, and can be used for any constraint list that's stored inside the
Data Model (this also means any other formats supported by the
FormatConverter (e.g. CYANA)).

We definitely recommend the second route - this way your code can be
directly used by anyone working with the Data Model.

Now how would you go about this? Attached is an example script that reads
in a CNS constraint list and a CNS sequence (from a coordinate file - you
can also import a sequence from any other supported format like XEasy or
Fasta). Note that all of this can be done via the FormatConverter GUI as
well (you can't customize it as well though).

After importing the sequence and constraints you have to run
'linkResonances' - this is essential when importing NMR or NMR-derived
data. Initially all NMR data is linked to 'Resonance' objects. This means
that you can store all the NMR information without knowing exactly which
atom the 'Resonance' corresponds to. This is also why you have to read in
a sequence in the example below - this creates 'Molecular System',
'Chain', 'Residues', and 'Atom' objects that describe the molecule(s)
you're studying. The 'linkResonances' script, then, allows you to
(semi-)automatically link the 'Resonance' to the 'Atom' objects (see
http://www.ebi.ac.uk/msd-srv/docs/NMR/NMRtoolkit/linkResonances.html for
some more information).

Once this is done, you can access the information inside the Data Model
proper - I've included some code for this in the attached example script.
You could also, for example, import coordinate files with the
FormatConverter and then write scripts to analyze your constraint lists
compared to the coordinates.

I hope this clarifies things - do get in touch if you're having problems
with the script or want more information. We are planning, by the way, to
clearly index the scripts we have written so far to do useful things
within the Data Model (e.g. making chemical shifts lists from peak lists,
...).

Bye,

Wim.





import Tkinter, os, string from ccpnmr.format.converters.CnsFormat import CnsFormat from memops.api import Implementation if __name__ == '__main__': # # Open a Tk window for handling the popups... # root = Tkinter.Tk() # # Create a CCPN Data Model Project (this is the root object within the # Data Model) # ccpnProject = Implementation.Project(name = 'My_project') # # Create the FormatConverter CnsFormat object # cnsFormat = CnsFormat(ccpnProject,root) # # Read in a sequence - this will create the molecular system with # all the atom information. # # Note that a lot of the popups can be avoided when the right information # is passed in (see ccpnmr.format.converters.DataFormat, the readSequence # function in the DataFormat class) # ccpnChains = cnsFormat.readSequence('my_coord_file.pdb') # # Read in a distance constraint list # ccpnConstraintList = cnsFormat.readDistanceConstraints('my_constraint_file.tbl') # # Do some preliminary Data Model navigation to get input parameter for # linkResonances # # An nmrConstraintHead links a group of constraint files # A structureGeneration links an nmrConstraintHead with a set of structures # nmrConstraintHead = ccpnConstraintList.nmrConstraintHead structureGeneration = nmrConstraintHead.structureGenerations[0] # # Run linkResonances (this will generate a lot of output to the shell) # # Many options are available - see ccpnmr.format.process.linkResonances # # The current options are the 'safest' to maintain the original information, # although bear in mind that here all atoms in the original list are # considered to be stereospecifically assigned # cnsFormat.linkResonances( globalStereoAssign = 1, setSingleProchiral = 1, setSinglePossEquiv = 1, strucGen = structureGeneration ) # # Save the CCPN project as XML files # # For default save it will use the <project_name>.xml file for the main # information and save other XML files in the <project_name> directory # if not os.path.exists(ccpnProject.name): os.mkdir(ccpnProject.name) ccpnProject.saveModified() # # Navigate the Data Model, get a list of atoms per constraint item # for distConstr in ccpnConstraintList.constraints: print "Constraint %d: %.1f-%.1f" % (distConstr.serial, distConstr.lowerLimit, distConstr.upperLimit) for constrItem in distConstr.items: # # Now list the atoms for each of the two resonances associated with this item # atomList = [] for resonance in constrItem.resonances: atomList.append([]) if resonance.resonanceSet: for atomSet in resonance.resonanceSet.atomSets: for atom in atomSet.atoms: atomList[-1].append("%d.%s" % (atom.residue.seqCode,atom.name)) atomList[-1].sort() atomList[-1] = string.join(atomList[-1],',') print " (%s) - (%s)" % (atomList[0],atomList[1]) print # # Finally, note that you can read a CCPN project back in as well... use # the following as an example: # # # from memops.general.Io import loadXmlProjectFile # # ccpnProject = loadXmlProjectFile(file = 'My_project.xml') # #

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

May 2024
April 2024
March 2024
February 2024
January 2024
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
December 2003
November 2003
October 2003
September 2003


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager