Package cinfony :: Module jchem :: Class MoleculeData
[frames] | no frames]

Class MoleculeData

source code

object --+
         |
        MoleculeData

Store molecule data in a dictionary-type object

Required parameters:
  Molecule -- a JChem Molecule

Methods and accessor methods are like those of a dictionary except
that the data is retrieved on-the-fly from the underlying Molecule.

Example:
>>> mol = readfile("sdf", 'head.sdf').next()
>>> data = mol.data
>>> print data
{'Comment': 'CORINA 2.61 0041  25.10.2001', 'NSC': '1'}
>>> print len(data), data.keys(), data.has_key("NSC")
2 ['Comment', 'NSC'] True
>>> print data['Comment']
CORINA 2.61 0041  25.10.2001
>>> data['Comment'] = 'This is a new comment'
>>> for k,v in data.iteritems():
...    print k, "-->", v
Comment --> This is a new comment
NSC --> 1
>>> del data['NSC']
>>> print len(data), data.keys(), data.has_key("NSC")
1 ['Comment'] False

Instance Methods
 
__init__(self, Molecule)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
keys(self) source code
 
values(self) source code
 
items(self) source code
 
__iter__(self) source code
 
iteritems(self) source code
 
__len__(self) source code
 
__contains__(self, key) source code
 
__delitem__(self, key) source code
 
clear(self) source code
 
has_key(self, key) source code
 
update(self, dictionary) source code
 
__getitem__(self, key) source code
 
__setitem__(self, key, value) source code
 
__repr__(self)
repr(x)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, Molecule)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)