DnaWeaver Reference manual

DNA suppliers

class dnaweaver.DnaSupplier[source]

Base class for all DnaSuppliers, which are the elements of the supply networks used to define assembly problems in DnaWeaver.

get_best_lead_time_under_price_limit(sequence, max_price, time_resolution, with_assembly_plan=False)[source]

Return the quote with fastest lead time under the budget constraint/

Parameters
sequence (str)

The sequence submitted to the Dna Source for a quote.

max_price (float)

If provided, the quote returned is the least-lead-time quote whose price is below or equal to max_price. This is done using bisection and can be slow as it requires to re-compute the problem many times. Note that either this parameter or max_lead_time must be None.

with_assembly_plan

If True, the assembly plan is added to the quote.

time_resolution

Time resolution for the bisecting search if max_price is not None.

get_quote(sequence, max_lead_time=None, max_price=None, with_assembly_plan=False, time_resolution=1.0)[source]

Return a DnaQuote with price, lead time, etc. for a given sequence.

Parameters
sequence (str)

The sequence submitted to the Dna Source for a quote.

max_lead_time (float)

If provided, the quote returned is the best quote (price-wise) whose lead time is less or equal to max_lead_time.

max_price (float)

If provided, the quote returned is the least-lead-time quote whose price is below or equal to max_price. This is done using bisection and can be slow as it requires to re-compute the problem many times. Note that either this parameter or max_lead_time must be None.

with_assembly_plan

If True, the assembly plan is added to the quote.

time_resolution

Time resolution for the bisecting search if max_price is not None.

Returns
A DnaQuote object.
class dnaweaver.DnaSuppliersComparator(suppliers=(), memoize=False, sequence_constraints=(), return_first_accepted_quote=False, name='comparator')[source]

Special source that compares quotes from other DnaSuppliers.

Upon receiving a sequence, that source will submit the sequence to Downstream sources, which deliver each one optimal quote. The comparator then returns the one quote with the lowest price.

Parameters
suppliers

List of DnaSuppliers.

memoize

Whether the quotes should be kept in memory to avoid re-computing the same quote several times. Can accelerate computations but is RAM-expensive.

get_best_price(sequence, max_lead_time=None, with_assembly_plan=False)[source]

Returns a price-optimal DnaQuote for the given sequence.

Parameters
sequence (str)

The sequence submitted to the Dna Source for a quote.

max_lead_time (float)

If provided, the quote returned is the best quote (price-wise) whose lead time is less or equal to max_lead_time.

with_assembly_plan

If True, the assembly plan is added to the quote.

class dnaweaver.DnaAssemblyStation(name, assembly_method, supplier, memoize=False, decomposer_class=None, a_star_auto_multiplier=2, **solver_kwargs)[source]

DNA Assembly stations assemble together DNA fragments using a specific assembly method.

Parameters
name

Name of the station (appears on reports).

assembly_method

A DnaAssemblyMethod object specifying how the fragments are assembled, what sequences can be assembled, what fragments can be used, etc.

supplier
get_assembly_plan_for_sequence(sequence, max_lead_time=None, coarse_grain=1, fine_grain=1, cut_spread_radius=0, a_star_factor=0, logger=None)[source]

Return the plan {(seg, ment): quote, …} of the optimal strategy for the sequence’s decomposition.

get_assembly_plan_from_cuts(sequence, cuts, max_lead_time=None)[source]

Return a plan {segment: quote, …} based on the cut positions.

Where “segment” is of the form (start, end).

get_best_price(sequence, max_lead_time=None, with_assembly_plan=False)[source]

Returns a price-optimal DnaQuote for the given sequence.

Parameters
sequence (str)

The sequence submitted to the Dna Source for a quote.

max_lead_time (float)

If provided, the quote returned is the best quote (price-wise) whose lead time is less or equal to max_lead_time.

with_assembly_plan

If True, the assembly plan is added to the quote.

get_quote_for_sequence_segment(sequence, segment, max_lead_time=None, **kwargs)[source]

Return the cost of the segment.

Is used as the “cost” function for a segment during decomposition optimization.