Source documentation:

coral – Main Package

Coral, core modules for synthetic DNA design.

class coral.DNA(dna, circular=False, features=None, run_checks=True, bottom=None, name=None)

dsDNA sequence.

Parameters:
  • dna (str) – Input sequence (DNA).
  • circular (bool) – The topology of the DNA - True for circular DNA, False for linear DNA.
  • features (list) – List of annotated features.
  • run_checks (bool) – Check inputs / formats (disabling increases speed): alphabet check case
  • bottom (str) – String for the bottom sequence for manually setting overhangs, fast copying.
  • name (str) – Optional name field for your DNA sequence.
Returns:

coral.DNA instance.

Return type:

coral.DNA

Raises:

ValueError if an element of features isn’t of type coral.Feature. ValueError if top and bottom strands have different lengths. ValueError if top and bottom strands are not complementary.

ape(ape_path=None)

Open in ApE if ApE is in your command line path.

circularize()

Circularize linear DNA.

Returns:A circularized version of the current sequence.
Return type:coral.DNA
copy()

Create a copy of the current instance.

Returns:A safely-editable copy of the current sequence.
Return type:coral.DNA
display()

Display a visualization of the sequence in an IPython notebook.

excise(feature)

Removes feature from circular plasmid and linearizes. Automatically reorients at the base just after the feature. This operation is complementary to the .extract() method.

Parameters:feature_name (coral.Feature) – The feature to remove.
extract(feature, remove_subfeatures=False)

Extract a feature from the sequence. This operation is complementary to the .excise() method.

Parameters:
  • feature (coral.sequence.Feature) – Feature object.
  • remove_subfeatures (bool) – Remove all features in the extracted sequence aside from the input feature.
Returns:

A subsequence from start to stop of the feature.

flip()

Flip the DNA - swap the top and bottom strands.

Returns:Flipped DNA (bottom strand is now top strand, etc.).
Return type:coral.DNA
gc()

Find the frequency of G and C in the current sequence. Calculates the exact frequency of Gs and Cs in each strand, so overhangs are counted only once.

linearize(index=0)

Linearize circular DNA at an index.

Parameters:index (int) – index at which to linearize.
Returns:A linearized version of the current sequence.
Return type:coral.DNA
Raises:ValueError if the input is linear DNA.
locate(pattern)

Find sequences matching a pattern. For a circular sequence, the search extends over the origin.

Parameters:pattern (str or coral.DNA) – str or NucleicAcidSequence for which to find matches.
Returns:A list of top and bottom strand indices of matches.
Return type:list of lists of indices (ints)
Raises:ValueError if the pattern is longer than either the input sequence (for linear DNA) or twice as long as the input sequence (for circular DNA).
mw()

Calculate the molecular weight.

Returns:The molecular weight of the current sequence.
Return type:float
reverse_complement()

Reverse complement the DNA.

Returns:A reverse-complemented instance of the current sequence.
Return type:coral.DNA
rotate(n)

Rotate Sequence by n bases.

Parameters:n (int) – Number of bases to rotate.
Returns:The current sequence reoriented at index.
Return type:coral.DNA
Raises:ValueError if applied to linear sequence or index is negative.
rotate_to(index)

Orient DNA to index (only applies to circular DNA).

Parameters:index (int) – DNA position at which to re-zero the DNA.
Returns:The current sequence reoriented at index.
Return type:coral.DNA
Raises:ValueError if applied to linear sequence or index is negative.
rotate_to_feature(feature)

Reorient the DNA based on a feature it contains (circular DNA only).

Parameters:feature (coral.Feature) – A feature.
Returns:The current sequence reoriented at the start index of a unique feature matching featurename.
Return type:coral.DNA
Raises:ValueError if there is no feature of featurename or more than one feature matches featurename.
select_features(term, by='name', fuzzy=False)

Select features from the features list based on feature name, gene, or locus tag. :param term: Search term. :type term: str :param by: Feature attribute to search by. Options are ‘name’, ‘gene’, and ‘locus_tag’. :type by: str :param fuzzy: If True, search becomes case-insensitive and will also find substrings - e.g. if fuzzy search is enabled, a search for ‘gfp’ would return a hit for a feature named ‘GFP_seq’. :type fuzzy: bool :returns: A list of features matched by the search. :rtype: list

tm(parameters='cloning')

Find the melting temperature.

Parameters:parameters (str) – The tm method to use (cloning, santalucia98, breslauer86)
to_feature(name=None, feature_type='misc_feature')

Create a feature from the current object.

Parameters:
  • name (str) – Name for the new feature. Must be specified if the DNA instance has no .name attribute.
  • feature_type (str) – The type of feature (genbank standard).
transcribe()

Transcribe into RNA.

Returns:An RNA sequence transcribed from the current DNA sequence.
Return type:coral.RNA
class coral.Feature(name, start, stop, feature_type='misc_feature', gene='', locus_tag='', qualifiers=None, strand=0, gaps=None)

Represent an annotated feature - track sequence regions with metadata.

Parameters:
  • name (str) – Name of the feature. Used during feature extraction.
  • start (int) – Where the feature starts (0-indexed)
  • stop (int) – Where the feature stops (1-indexed, like slices)
  • feature_type – The type of the feature. Allowed types: ‘coding’, ‘primer’, ‘promoter’, ‘terminator’, ‘rbs’
  • strand (int) – Watson (0) or Crick (1) strand of the feature.
  • gaps (list of coordinates (2-tuple/list)) – Gap locations if the feature has gaps.
  • gene (str) – gene attribute (Genbank standard) - gene name (e.g. galK on MG1655 genome).
  • locus_tag (str) – locus_tag attribute (Genbank standard) - systematic locus name (e.g. b0757 for galK on MG1655 genome).
  • qualifiers (dict) – Complete Genbank qualifiers key:value pairs
Returns:

coral.Feature instance.

Raises:

ValueError if feature_type is not in coral.constants.genbank.TO_CORAL.

copy()

Return a copy of the Feature.

Returns:A safely editable copy of the current feature.
Return type:coral.Feature
move(bases)

Move the start and stop positions.

Parameters:bases (int) – bases to move - can be negative
class coral.Peptide(peptide, features=None, run_checks=True)

Peptide sequence.

Parameters:
  • peptide (str) – Input sequence (peptide).
  • run_checks (bool) – Check inputs / formats (disabling increases speed): alphabet check case
Returns:

coral.Peptide instance.

copy()

Create a copy of the current instance.

Returns:A safely editable copy of the current sequence.
Return type:coral.Peptide
class coral.Primer(anneal, tm=None, tm_method='cloning', overhang=None, name='', note='')

A DNA primer - ssDNA with tm, anneal, and optional overhang.

Parameters:
  • anneal (coral.ssDNA) – Annealing sequence
  • overhang (coral.ssDNA) – Overhang sequence
  • tm (float) – Melting temperature (allow manually setting the melting temp, auto-calculation won’t happen).
  • tm_method (str) – Method to use when calling cr.analysis.tm.
  • name (str) – Optional name of the primer. Used when writing to csv with seqio.write_primers.
  • note (str) – Optional description to associate with the primer. Used when writing to csv with seqio.write_primers.
Returns:

coral.Primer instance.

copy()

Generate a Primer copy.

Returns:A safely-editable copy of the current primer.
Return type:coral.DNA
primer()

Produce (ss) DNA of the overhang + anneal sequence.

Returns:The (ss) DNA sequence of the primer.
Return type:coral.ssDNA
to_ds()

Produces (ds) DNA of the overhang + anneal sequence.

Returns:The DNA sequence of the primer.
Return type:coral.DNA
class coral.RNA(rna, circular=False, run_checks=True)

ssRNA sequence.

Parameters:
  • rna (str) – Input sequence (RNA).
  • run_checks (bool) – Check inputs / formats (disabling increases speed): alphabet check case
Returns:

coral.RNA instance.

reverse_transcribe()

Reverse transcribe to DNA.

Returns:The reverse transcribed (DNA) version of the current RNA.
Return type:coral.DNA
translate()

Translate sequence into a peptide.

Returns:A translated peptide from the current sequence.
Return type:coral.Peptide
class coral.RestrictionSite(recognition_site, cut_site, name=None)

Recognition site and properties of a restriction endonuclease.

Parameters:
  • recognition_site (coral.DNA) – Input sequence.
  • cut_site (2-tuple.) – 0-indexed indices where DNA is nicked (top, then bottom strand). For an n-sized recognition site, there are n + 1 positions at which to cut.
  • name (str) – Identifier of this restriction site
Returns:

instance of coral.RestrictionSite

copy()

Return copy of the restriction site.

Returns:A safely editable copy of the current restriction site.
Return type:coral.RestrictionSite
cuts_outside()

Report whether the enzyme cuts outside its recognition site. Cutting at the very end of the site returns True.

Returns:Whether the enzyme will cut outside its recognition site.
Return type:bool
is_palindrome()

Report whether sequence is palindromic.

Returns:Whether the restriction site is a palindrome.
Return type:bool
class coral.ssDNA(sequence, circular=False, run_checks=True)

ssDNA sequence.

coral.analysis – Sequence analysis

Analyze sequences.

coral.analysis.MAFFT(sequences, gap_open=1.53, gap_extension=0.0, retree=2)

A Coral wrapper for the MAFFT command line multiple sequence aligner.

Parameters:
  • sequences (List of homogeneous sequences (all DNA, or all RNA, etc.)) – A list of sequences to align.
  • gap_open (float) – –op (gap open) penalty in MAFFT cli.
  • gap_extension (float) – –ep (gap extension) penalty in MAFFT cli.
  • retree (int) – Number of times to build the guide tree.
class coral.analysis.NUPACK(nupack_home=None)

Run NUPACK functions on sequences.

Parameters:nupack_home (str) – NUPACK home dir. If the NUPACK commands aren’t in your path and the NUPACKHOME environment variable isn’t set, you can manually specify the NUPACK directory here (the directory that contains bin/).
class coral.analysis.Sanger(reference, results, method='needle', method_kwargs=None)

Align and analyze Sanger sequencing results.

Parameters:
  • reference (coral.DNA) – Reference sequence.
  • results (list of coral.DNA sequences) – Sequencing result string. A list of DNA objects is also valid.
  • method (str) – Alignment method to use. Options are: ‘needle’: Uses coral.analysis.needle_msa ‘MAFFT’: Uses coral.analysis.MAFFT
  • method_kwargs (dict) – Optional keyword arguments to send to the alignment function.
Returns:

instance of coral.analysis.Sanger (contains alignment and provides analysis/visualization methods

nonmatches()

Report mismatches, indels, and coverage.

plot()

Make a summary plot of the alignment and highlight nonmatches.

class coral.analysis.StructureWindows(dna)

Evaluate windows of structure and plot the results.

Parameters:dna (coral.DNA) – DNA sequence to analyze.
plot()

Plot the results of the run method.

windows(window_size=60, context_len=90, step=10)

Walk through the sequence of interest in windows of window_size, evaluate free (unbound) pair probabilities.

Parameters:
  • window_size (int) – Window size in base pairs.
  • context_len (int) – The number of bases of context to use when analyzing each window.
  • step (int) – The number of base pairs to move for each new window.
coral.analysis.anneal(template, primer, min_tm=50.0, min_len=10)

Simulates a primer binding event. Will find the maximum subset of bases in the primer that binds to the template, including overhang sequences. Note: Primer binding locations indicate the 3’ end of the primer, not the begining of the annealing sequence.

Parameters:
  • template (coral.DNA) – DNA template for which to bind a primer.
  • primer (coral.Primer) – Primer to bind to template.
  • min_tm (float) – The cutoff melting temperature for primer binding - a binder with a lower Tm will be rejected.
  • min_len (int) – The cutoff for bases required for binding - a binder with fewer bases will be rejected.
Returns:

A length 2 list (top and bottom strands) of matches. Each match is itself a 2-tuple indicating (1) the location on the template of the 3’ end of the primer binding site and (2) the length of the match (number of bases), e.g. [[(25, 15)],[]] would indicate a single top-strand match at template position 25 with 15 bases of 3’ primer homology.

Return type:

list

Raises:

PrimerLengthError if primer length is too small. AnnealError if inputs are of the wrong type.

coral.analysis.dimers(primer1, primer2, concentrations=[5e-07, 3e-11])

Calculate expected fraction of primer dimers.

Parameters:
  • primer1 (coral.DNA) – Forward primer.
  • primer2 (coral.DNA) – Reverse primer.
  • template (coral.DNA) – DNA template.
  • concentrations (list) – list of concentrations for primers and the template. Defaults are those for PCR with 1kb template.
Returns:

Fraction of dimers versus the total amount of primer added.

Return type:

float

coral.analysis.needle(reference, query, gap_open=-15, gap_extend=0, matrix=<coral.analysis._sequencing.substitution_matrices.substitution_matrix.SubstitutionMatrix object>)

Do a Needleman-Wunsch alignment.

Parameters:
  • reference (coral.DNA) – Reference sequence.
  • query (coral.DNA) – Sequence to align against the reference.
  • gapopen (float) – Penalty for opening a gap.
  • gapextend (float) – Penalty for extending a gap.
  • matrix (str) – Matrix to use for alignment - options are DNA_simple (for DNA) and BLOSUM62 (for proteins).
Returns:

(aligned reference, aligned query, score)

Return type:

tuple of two coral.DNA instances and a float

coral.analysis.needle_msa(reference, results, gap_open=-15, gap_extend=0, matrix=<coral.analysis._sequencing.substitution_matrices.substitution_matrix.SubstitutionMatrix object>)

Create a multiple sequence alignment based on aligning every result sequence against the reference, then inserting gaps until every aligned reference is identical

coral.analysis.needle_multi(references, queries, gap_open=-15, gap_extend=0, matrix=<coral.analysis._sequencing.substitution_matrices.substitution_matrix.SubstitutionMatrix object>)

Batch process of sequencing split over several cores. Acts just like needle but sequence inputs are lists.

Parameters:
  • references (coral.DNA list) – References sequence.
  • queries (coral.DNA list) – Sequences to align against the reference.
  • gap_open (float) – Penalty for opening a gap.
  • gap_extend (float) – Penalty for extending a gap.
  • matrix (str) – Matrix to use for alignment - options are DNA_simple (for DNA) and BLOSUM62 (for proteins).
Returns:

a list of the same output as coral.sequence.needle

Return type:

list

coral.analysis.nupack_multi(seqs, material, cmd, arguments, report=True)

Split Nupack commands over processors.

Parameters:
  • inputs – List of sequences, same format as for coral.analysis.Nupack.
  • material (str) – Input material: ‘dna’ or ‘rna’.
  • cmd (str) – Command: ‘mfe’, ‘pairs’, ‘complexes’, or ‘concentrations’.
  • arguments (str) – Arguments for the command.
Returns:

A list of the same return value you would get from cmd.

Return type:

list

coral.analysis.repeats(seq, size)

Count times that a sequence of a certain size is repeated.

Parameters:
  • seq (coral.DNA or coral.RNA) – Input sequence.
  • size (int) – Size of the repeat to count.
Returns:

Occurrences of repeats and how many

Return type:

tuple of the matched sequence and how many times it occurs

coral.analysis.tm(seq, dna_conc=50, salt_conc=50, parameters='cloning')

Calculate nearest-neighbor melting temperature (Tm).

Parameters:
  • seq (coral.DNA) – Sequence for which to calculate the tm.
  • dna_conc (float) – DNA concentration in nM.
  • salt_conc (float) – Salt concentration in mM.
  • parameters (str) – Nearest-neighbor parameter set. Available options: ‘breslauer’: Breslauer86 parameters ‘sugimoto’: Sugimoto96 parameters ‘santalucia96’: SantaLucia96 parameters ‘santalucia98’: SantaLucia98 parameters ‘cloning’: breslauer without corrections ‘cloning_sl98’: santalucia98 fit to ‘cloning’
Returns:

Melting temperature (Tm) in °C.

Return type:

float

Raises:

ValueError if parameter argument is invalid.

coral.constants – Data and constants

Convenient data files for use in other modules.

coral.database – Scientific database access

class coral.database.Rebase

Retrieve restriction enzymes from rebase database.

get(name)

Retrieve enzyme by name.

Parameters:name (str) – Name of the restriction enzyme, e.g. EcoRV.
Returns:Restriction site matching the input name.
Return type:coral.RestrictionSite
Raises:Exception when enzyme is not found in the database.
update()

Update definitions.

coral.database.fetch_genome(genome_id)

Acquire a genome from Entrez

coral.database.fetch_yeast_locus_sequence(locus_name, flanking_size=0)

Acquire a sequence from SGD http://www.yeastgenome.org.

Parameters:
  • locus_name (str) – Common name or systematic name for the locus (e.g. ACT1 or YFL039C).
  • flanking_size (int) – The length of flanking DNA (on each side) to return
coral.database.get_yeast_gene_location(gene_name)

Acquire the location of a gene from SGD http://www.yeastgenome.org :param gene_name: Name of the gene. :type gene_name: string :returns location: [int: chromosome, int:biostart, int:bioend, int:strand] :rtype location: list

coral.database.get_yeast_promoter_ypa(gene_name)

Retrieve promoter from Yeast Promoter Atlas (http://ypa.csbb.ntu.edu.tw).

Parameters:gene_name (str) – Common name for yeast gene.
Returns:Double-stranded DNA sequence of the promoter.
Return type:coral.DNA
coral.database.get_yeast_sequence(chromosome, start, end, reverse_complement=False)

Acquire a sequence from SGD http://www.yeastgenome.org :param chromosome: Yeast chromosome. :type chromosome: int :param start: A biostart. :type start: int :param end: A bioend. :type end: int :param reverse_complement: Get the reverse complement. :type revervse_complement: bool :returns: A DNA sequence. :rtype: coral.DNA

coral.design – Design sequences, primers, etc

Cloning design classes and functions.

class coral.design.OligoAssembly(dna, tm=72, length_range=(80, 200), require_even=True, start_5=True, oligo_number=None, overlap_min=20, min_exception=False)

Split a sequence into overlapping oligonucleotides.

Parameters:
  • dna (coral.DNA) – Sequence to split into overlapping oligos.
  • primers (bool) – Design cloning primers that bind the termini of the input sequence.
  • primer_tm (float) – Ideal Tm for the cloning primers, if applicable.
  • length_range (int 2-tuple) – Maximum oligo size (e.g. 60bp price point cutoff) range - lower bound only matters if oligo_number parameter is set.
  • require_even (bool) – Require that the number of oligonucleotides is even.
  • start_5 (bool) – Require that the first oligo’s terminal side is 5’.
  • oligo_number (bool) – Attempt to build assembly with this many oligos, starting with length_range min and incrementing by 10 up to length_range max.
  • overlap_min (int) – Minimum overlap size.
  • min_exception (bool) – In order to meet tm and overlap_min requirements, allow overlaps less than overlap_min to continue growing above tm setpoint.
Returns:

coral.design.OligoAssembly instance.

design_assembly()

Design the overlapping oligos.

Returns:Assembly oligos, and the sequences, Tms, and indices of their overlapping regions.
Return type:dict
primers(tm=60)

Design primers for amplifying the assembled sequence.

Parameters:tm (float) – melting temperature (lower than overlaps is best).
Returns:Primer list (the output of coral.design.primers).
Return type:list
write(path)

Write assembly oligos and (if applicable) primers to csv.

Parameters:path (str) – path to csv file, including .csv extension.
write_map(path)

Write genbank map that highlights overlaps.

Parameters:path (str) – full path to .gb file to write.
coral.design.gibson(seq_list, circular=True, overlaps='mixed', overlap_tm=65, maxlen=80, terminal_primers=True, primer_kwargs=None)

Design Gibson primers given a set of sequences

Parameters:
  • seq_list (list containing coral.DNA) – List of DNA sequences to stitch together
  • circular (bool) – If true, designs primers for making a circular construct. If false, designs primers for a linear construct.
  • splits (str or list of str) – Specifies locations of overlap. Must be either a single entry of the same type as the ‘split’ parameter in gibson_primers or a list of those types of the appropriate length (for circular construct, len(seq_list), for linear construct, len(seq_list) - 1)
  • overlap_tm (float) – Minimum Tm of overlap
  • maxlen (int) – Maximum length of each primer.
  • terminal_primers (bool) – If the output is not circular, will design non-Gibson primers for amplifying the first and last fragments sans homology. If False, there will be one less set of primers returned.
  • primer_kwargs (dict) – keyword arguments to pass to design.primer
Returns:

Forward and reverse primers for amplifying every fragment.

Return type:

a list of sequence.Primer tuples

Raises:

ValueError if split parameter is an invalid string or wrong size.

coral.design.gibson_primers(dna1, dna2, overlap='mixed', maxlen=80, overlap_tm=65.0, insert=None, primer_kwargs=None)

Design Gibson primers given two DNA sequences (connect left to right)

Parameters:
  • dna1 (coral.DNA) – First piece of DNA for which to design primers. Once Gibsoned, would be connected at its right side to dna2.
  • dna2 (coral.DNA) – First piece of DNA for which to design primers. Once Gibsoned, would be connected at its right side to dna2.
  • overlap (str) – Specifies location of overlap. ‘left’ puts it on the ‘dna1’ side (i.e. the primer to amplify dna2). ‘right’ puts it on the dna2 side, and ‘mixed’ does a ~50:50 split
  • maxlen (int) – Maximum length of each primer.
  • overlap_tm (float) – Minimum Tm of overlap
  • insert (coral.DNA) – A DNA insert to add with primers and use as assembly homology. This overrides the ‘split’ argument.
  • primer_kwargs (dict) – keyword arguments to pass to design_primer()
Returns:

Reverse, then forward primer for bridging the two sequences. Note that the forward primer binds dna2, reverse dna1.

Return type:

A sequence.Primer tuple

Raises:

ValueError if split parameter is an invalid string.

coral.design.primer(dna, tm=65, min_len=10, tm_undershoot=1, tm_overshoot=3, end_gc=False, tm_parameters='cloning', overhang=None, structure=False)

Design primer to a nearest-neighbor Tm setpoint.

Parameters:
  • dna (coral.DNA) – Sequence for which to design a primer.
  • tm (float) – Ideal primer Tm in degrees C.
  • min_len (int) – Minimum primer length.
  • tm_undershoot (float) – Allowed Tm undershoot.
  • tm_overshoot (float) – Allowed Tm overshoot.
  • end_gc (bool) – Obey the ‘end on G or C’ rule.
  • tm_parameters (string) – Melting temp calculator method to use.
  • overhang (str) – Append the primer to this overhang sequence.
  • structure (bool) – Evaluate primer for structure, with warning for high structure.
Returns:

A primer.

Return type:

coral.Primer

Raises:

ValueError if the input sequence is lower than the Tm settings allow. ValueError if a primer ending with G or C can’t be found given the Tm settings.

coral.design.primers(dna, tm=65, min_len=10, tm_undershoot=1, tm_overshoot=3, end_gc=False, tm_parameters='cloning', overhangs=None, structure=False)

Design primers for PCR amplifying any arbitrary sequence.

Parameters:
  • dna (coral.DNA) – Input sequence.
  • tm (float) – Ideal primer Tm in degrees C.
  • min_len (int) – Minimum primer length.
  • tm_undershoot (float) – Allowed Tm undershoot.
  • tm_overshoot (float) – Allowed Tm overshoot.
  • end_gc (bool) – Obey the ‘end on G or C’ rule.
  • tm_parameters (string) – Melting temp calculator method to use.
  • overhangs (tuple) – 2-tuple of overhang sequences.
  • structure (bool) – Evaluate each primer for structure, with warning for high structure.
Returns:

A list primers (the output of primer).

Return type:

list

coral.design.random_codons(peptide, frequency_cutoff=0.0, weighted=False, table=None)

Generate randomized codons given a peptide sequence.

Parameters:
  • peptide (coral.Peptide) – Peptide sequence for which to generate randomized codons.
  • frequency_cutoff – Relative codon usage cutoff - codons that are rarer will not be used. Frequency is relative to average over all codons for a given amino acid.
  • frequency_cutoff – Codon frequency table to use.
  • weighted (bool) – Use codon table
  • table (dict) –

    Codon frequency table to use. Table should be organized by amino acid, then be a dict of codon: frequency. Only relevant if weighted=True or frequency_cutoff > 0. Tables available:

    constants.molecular_bio.CODON_FREQ_BY_AA[‘sc’] (default)

Returns:

Randomized sequence of codons (DNA) that code for the input peptide.

Return type:

coral.DNA

Raises:

ValueError if frequency_cutoff is set so high that there are no codons available for an amino acid in the input peptide.

coral.design.random_dna(n)

Generate a random DNA sequence.

Parameters:n (int) – Output sequence length.
Returns:Random DNA sequence of length n.
Return type:coral.DNA

coral.reaction – Cloning and molecular genetics reactions

Reactions for simulating and designing cloning reactions and assemblies.

coral.reaction.assemble_oligos(dna_list, reference=None)

Given a list of DNA sequences, assemble into a single construct. :param dna_list: List of DNA sequences - they must be single-stranded. :type dna_list: coral.DNA list :param reference: Expected sequence - once assembly completed, this will be used to reorient the DNA (assembly could potentially occur from either side of a linear DNA construct if oligos are in a random order). If this fails, an AssemblyError is raised. :type reference: coral.DNA :raises: AssemblyError if it can’t assemble for any reason. :returns: A single assembled DNA sequence :rtype: coral.DNA

coral.reaction.bind_unique(reference, query_list, min_overlap=12, right=True)

(5’ or 3’ region on reference sequence that uniquely matches the reverse complement of the associated (5’ or 3’) region of one sequence in a list of query sequences.

Parameters:
  • reference (coral.DNA) – Reference sequence.
  • query_list (coral.DNA list) – List of query sequences.
  • min_overlap (int) – Minimum overlap for a match (in bp).
  • right (bool) – Check right side of sequence (3’). False results in 5’ check.
Returns:

Tuple of the indices of any matches and the size of the match in bp.

Return type:

tuple of ints

Raises:

AssemblyError if more than one match is found.

coral.reaction.coding_sequence(rna)

Extract coding sequence from an RNA template.

Parameters:
  • seq (coral.RNA) – Sequence from which to extract a coding sequence.
  • material (str) – Type of sequence (‘dna’ or ‘rna’)
Returns:

The first coding sequence (start codon -> stop codon) matched from 5’ to 3’.

Return type:

coral.RNA

Raises:

ValueError if rna argument has no start codon. ValueError if rna argument has no stop codon in-frame with the first start codon.

coral.reaction.digest(dna, restriction_enzyme)

Restriction endonuclease reaction.

Parameters:
Returns:

list of digested DNA fragments.

Return type:

coral.DNA list

coral.reaction.five_resect(dna, n_bases)

Remove bases from 5’ end of top strand.

Parameters:
  • dna (coral.DNA) – Sequence to resect.
  • n_bases (int) – Number of bases cut back.
Returns:

DNA sequence resected at the 5’ end by n_bases.

Return type:

coral.DNA

coral.reaction.gibson(seq_list, linear=False, homology=10, tm=63.0)

Simulate a Gibson reaction.

Parameters:
  • seq_list (list of coral.DNA) – list of DNA sequences to Gibson
  • linear (bool) – Attempt to produce linear, rather than circular, fragment from input fragments.
  • homology_min (int) – minimum bp of homology allowed
  • tm (float) – Minimum tm of overlaps
Returns:

coral.reaction.Gibson instance.

Raises:

ValueError if any input sequences are circular DNA.

coral.reaction.pcr(template, primer1, primer2, min_tm=50.0, min_primer_len=14)

Simulate a PCR.

Parameters:
  • template (coral.DNA) – DNA template from which to PCR.
  • primer1 (coral.Primer) – First PCR primer.
  • primer2 (coral.Primer) – First PCR primer.
  • min_tm (float) – Minimum melting temperature (Tm) at which primers must bind to the template.
  • min_primer_len (int) – Minimum amount of template homology required at the 3’ end of each primer.
Returns:

A dsDNA Amplicon.

Return type:

coral.DNA

Raises:

PrimingError if a primer binds more than once on the template, primers bind in overlapping sequence of the template, there are no forward primer binding sites or reverse priming sites, or if the PCR would work only on a circular version of the template (if template is linear).

coral.reaction.reverse_transcribe(rna)

Reverse transcribe RNA to DNA.

Parameters:rna (coral.RNA) – Sequence to reverse transcribe (RNA).
Returns:Reverse-transcribed sequence - a DNA sequence.
Return type:coral.DNA
coral.reaction.three_resect(dna, n_bases)

Remove bases from 3’ end of top strand.

Parameters:
  • dna (coral.DNA) – Sequence to resect.
  • n_bases (int) – Number of bases cut back.
Returns:

DNA sequence resected at the 3’ end by n_bases.

Return type:

coral.DNA

coral.reaction.transcribe(dna)

Transcribe DNA to RNA (no post-transcriptional processing).

Parameters:seq (coral.DNA) – Sequence to transcribe (DNA).
Returns:Transcribed sequence - an RNA sequence.
Return type:coral.RNA
coral.reaction.translate(rna)

Translate RNA to peptide.

Parameters:rna (coral.RNA) – Sequence to translate (RNA).
Returns:Translated sequence - a peptide.
Return type:coral.Peptide

coral.seqio – Read and write sequences

Read and write cloning-relevant formats (sequences, chromatograms, etc).

coral.seqio.read_dna(path)

Read DNA from file. Uses BioPython and coerces to coral format.

Parameters:path (str) – Full path to input file.
Returns:DNA sequence.
Return type:coral.DNA
coral.seqio.read_sequencing(directory)

Read .seq and .abi/.ab1 results files from a dir.

Parameters:directory (str) – Path to directory containing sequencing files.
Returns:A list of DNA sequences.
Return type:coral.DNA list
coral.seqio.write_dna(dna, path)

Write DNA to a file (genbank or fasta).

Parameters:
  • dna (coral.DNA) – DNA sequence to write to file
  • path (str) – file path to write. Has to be genbank or fasta file.
coral.seqio.write_primers(primer_list, path, names=None, notes=None)

Write a list of primers out to a csv file. The first three columns are compatible with the current IDT order form (name, sequence, notes). By default there are no notes, which is an optional parameter.

Parameters:
  • primer_list (coral.Primer list) – A list of primers.
  • path (str) – A path to the csv you want to write.
  • names (str list) – A list of strings to name each oligo. Must be the same length as the primer_list.
  • notes (str list) – A list of strings to provide a note for each oligo. Must be the same length as the primer_list.