If you wish to construct it as part of a new development to store your contact information, you might find the following helpful.
1. How to create a :obj:`~conkit.core.contact.Contact`?
>>> from conkit.core import Contact
>>> contact = Contact(1, 10, 1.0)
The example above creates a contact between residues 1
and 10
and assigns a raw_score
of 1.0
to it. By default, this contact has many more default attributes assigned, such as the distance value often seen in columns 3 and 4 in the Casp RR format.
2. How to create a :obj:`~conkit.core.contactmap.ContactMap`?
>>> from conkit.core import ContactMap
>>> cmap = ContactMap('example')
This example shows you how to create a ContactMap
which can store a Contact
.
3. How to create a :obj:`~conkit.core.contactfile.ContactFile`?
>>> from conkit.core import ContactFile
>>> cmap = ContactFile('example')
This example shows you how to create a ContactFile
which can store a ContactMap
.
Above is an outline for the different contact-related Entity
classes. Each higher entity allows you to store one or more lower-level ones, i.e. you can store one or more ContactMap
entities in a single ContactFile
. Similarly, you could many Contact
entities in a ContactMap
; however, be aware that all must have unique IDs.
To illustrate how you can combine the Entity
classes, look at the following:
>>> from conkit.core import Contact, ContactMap, ContactFile
>>> cfile = ContactFile('example_file')
>>> cmap = ContactMap('example_map')
>>> contact = Contact(1, 10, 1.0)
>>> # Add the contact to the contact map
>>> cmap.add(contact)
>>> # Add the contact map to the contact file
>>> cfile.add(cmap)
Note, the order in which you add Entity
instances does not matter. We could also add the cmap
to the cfile
before adding the contact
to the cmap
.
Once you have constructed your hierarchy, all related functions are available to you.