coral has 7 modules: analysis, constants, database, design, reaction, seqio, and sequence.
The modules have been split up by function - the activity that a user wants to execute. For example, anything related to accessing scientific databases is in the database module and activities related to designing sequences are in the design module.
The modules are explicitly organized via their __init__.py files. All this means is that anything available via coral.module.* is usable and hopefully useful. You can explore the functions and classes defined for each module by reading more of the ipython documentation, sphinx autodoc documentation, or interactively investigating modules in the ipython notebook using tab completion and ? documentation. coral follows the PEP 8 style guidelines on class and function names so that you can differentiate between them - classes use CamelCase and functions use lower_case with underscores.
In [1]:
import coral as cor # alternative you can import each module by itself e.g. from coral import design
dir(cor) # dir lists everything in a module/object. Ignore the double underscore items.
Out[1]:
In [2]:
dna = cor.DNA("ATGC")
print "DNA: {}".format(dna)
# You can also run methods on the object - in this case, check if the DNA is palindromic
print "Palindrome?: {}".format(dna.is_palindrome())
print
rna = cor.RNA("AUGC")
print "RNA: {}".format(rna)
print
pep = cor.Peptide("mlnp")
print "Peptide: {}".format(pep)
As you can see above, to make DNA, RNA, or Peptide objects you just invoke the correct sequence. command and give it a valid string as an argument. Case does not matter, but precision does - only unambiguous and valid DNA, RNA, or Peptide sequences are allowed. The sequence module also contains special cases of DNA objects (Primer, RestrictionSite, Feature), which are covered in detail later. You can treat DNA, RNA, and Peptide objects much like strings or lists in python, so addition, multiplication, slicing, and container logic are all defined.
The analysis module is focused on providing functions and classes for analyzing DNA, RNA, and Peptides, focusing on information inherent to the sequence (palindromes, repeats, melting temperatures), structural information (Vienna RNA and NUPACK classes), and sequencing (Sanger sequencing analysis).
In [3]:
# Example: finding the Tm of ATGCATGCATGCATGC according to the SantaLucia98 method.
cor.analysis.tm(dna * 4, parameters="santalucia98")
Out[3]:
The seqio module is for sequence input/output - reading and writing sequences. The module currently supports reading in individual sequences (fasta or genbank) using read_dna, reading in all the .ab1, .abi, and .seq files in a directory using read_sequencing, and writing DNA objects to file (fasta or genbank).