Sequence concatenation and assembly¶
Splice multiple DNA sequences or perform de-overlapping splicing based on precise overlapping regions.
1) Ordinary sequence splicing¶
- Purpose: Connect multiple DNA fragments in the input order, insert linker or structured gap at the junction, and return the coordinates of each fragment in the new sequence, suitable for constructing combined sequences.
- Method: Join fragments in input order, inserting the configured linker or Gap at each junction.
- API:
dnakit.ops.concat(sequences[required], linker[optional], gap[optional]). - Input: At least two
DNASequenceor normalized strings;linkerandgapcannot be used at the same time. - Output: Returns the concatenated
DNASequence. - Example code:
from dnakit import DNASequence
from dnakit.ops import concat
joined = concat(
[DNASequence("AA"), DNASequence("CC")],
linker="T",
)
print(joined.symbols)
- Example output:
2) Remove overlapping splicing¶
- Purpose: Complete the connection based on the overlapping relationship between the ends of two pieces of DNA, so that the matched overlapping region is retained only once, and the joint position and final sequence are reported.
- Method: Choose the longest exact left-suffix/right-prefix overlap and retain one copy; compare IUPAC symbols literally.
- API:
dnakit.ops.concat_overlap(sequences[required], min_overlap[optional], max_overlap[optional]). - Input: Must be two linear
DNASequences with no explicit gap or a normalized string.min_overlap=1by default;max_overlaplimits the overlap search. - Output: Returns the processed
DNASequence; read its symbols fromsymbols. - Example code:
from dnakit import DNASequence
from dnakit.ops import concat_overlap
joined = concat_overlap(
[DNASequence("AAACCC"), DNASequence("CCCGG")],
)
print(joined.symbols)
- Example output:
3) Design overlaps for Gibson assembly¶
- Purpose: Design overlaps for Gibson assembly.
- Method: Take overlaps of the requested length from neighboring fragment ends and append them to assembly parts.
- API:
dnakit.databases.dna_gibson_design(*, operation=None, fragments, overlap_length=None, verbose=True) - Input: Provide
fragments. - Output: Returns a mapping with
assembly_fragments,n_fragments,overlap_lengthand related fields. - Example code:
import dnakit
example_fragments = ['ATGGAGGAGCCGCAGTCAGATCCTAGCGTTGAATTCGGATCCAAGCTTACGTACGT',
'CGTACGTAAGCTTGGATCCGAATTCAAGCGATAGGATCTGACTGCGGCTCCTCCAT',
'TCCATGGAGGAGCCGCAGTCAGATCCTAGCGTTGAATTCGGATCCAAGCTTACGTACGT']
result = dnakit.databases.dna_gibson_design(
operation='gibson_design',
fragments=example_fragments,
overlap_length=20,
verbose=False,
)
print(result)
- Example output: The response has the following shape; records depend on the input and source.
Response-shape excerpt; <…> denotes type placeholders, not a captured query result.
{
"assembly_fragments": [
{
"name": "<string>",
"original_sequence": "<string>",
"with_overlaps": "<string>",
"left_overlap": "<string>",
"right_overlap": "<string>"
}
],
"n_fragments": "<integer>",
"overlap_length": "<integer>"
}
Full parameters and usage notes
4) Determine Golden Gate reaction products¶
- Purpose: Determine Golden Gate reaction products.
- Method: Simulate Type IIS digestion, discard fragments retaining recognition sites and ligate matching overhangs.
- API:
dnakit.databases.dna_golden_gate_assemble(*, operation=None, fragments, enzyme=None, circular=None, labels=None, verbose=True) - Input: Provide
fragments. - Output: Returns a mapping with
enzyme,product_length,num_fragments_assembled,assembly_orderand related fields. - Example code:
import dnakit
example_fragments = ['GGTCTCAAAACATGGAGGAGCCGCAGTCAGATCCTAGCGTTGAATTCGGATCCCTTTTGAGACC',
'GGTCTCAAAAGGGATCCAAGCTTACGTACGTATGGAGGAGCCGCAGTCAGATATTTTGAGACC',
'GGTCTCAAAATCCTAGCGTTGAATTCGGATCCAAGCTTACGTACGTATGGAGCGTTTGAGACC',
'GGTCTCAAACGATCGATCGATCGATCGATCGGTTTTGAGACC']
result = dnakit.databases.dna_golden_gate_assemble(
fragments=example_fragments,
enzyme='BsaI',
circular=True,
verbose=False,
)
print(result)
- Example output: The response has the following shape; records depend on the input and source.
Response-shape excerpt; <…> denotes type placeholders, not a captured query result.
{
"enzyme": "<string>",
"product_length": "<integer>",
"num_fragments_assembled": "<integer>",
"assembly_order": [
"<value>"
],
"unused_fragments": [
"<value>"
],
"product_sequence": "<string>"
}
Full parameters and usage notes
5) Design Golden Gate restriction sites and overhangs¶
- Purpose: Design Golden Gate restriction sites and overhangs.
- Method: Assign unique nonpalindromic four-base overhangs and add Type IIS recognition sites.
- API:
dnakit.databases.dna_golden_gate_design(*, operation=None, parts, enzyme=None, verbose=True) - Input: Provide
parts. - Output: Returns a mapping with
parts_with_overhangs,overhangs,enzyme,protocol_noteand related fields. - Example code:
import dnakit
example_parts = ['ATGGAGGAGCCGCAGTCAGATCCTAGCGTTGAATTCGGATCC',
'GGATCCAAGCTTACGTACGTATGGAGGAGCCGCAGTCAGAT',
'CCTAGCGTTGAATTCGGATCCAAGCTTACGTACGTATGGAG']
result = dnakit.databases.dna_golden_gate_design(
operation='golden_gate_design',
parts=example_parts,
enzyme='BsaI',
verbose=False,
)
print(result)
- Example output: The response has the following shape; records depend on the input and source.
Response-shape excerpt; <…> denotes type placeholders, not a captured query result.
{
"parts_with_overhangs": [
{
"name": "<string>",
"sequence": "<string>",
"left_overhang": "<string>",
"right_overhang": "<string>",
"full_sequence": "<string>"
}
],
"overhangs": [
"<string>"
],
"enzyme": "<string>",
"protocol_note": "<string>"
}
Full parameters and usage notes
6) Assemble reads with SPAdes¶
- Purpose: Assemble short reads or hybrid short/long reads into contigs.
- Method: Run SPAdes;
secondsupplies mate reads andnanoporesupplies hybrid long reads. - API:
dnakit.bioinformatics.ngs.assemble_reads(first, output_directory, second=None, nanopore=None, memory_gb=8) - Input: FASTQ input, SPAdes on PATH, a new output directory and sufficient memory for
memory_gb. - Output: Returns
ToolResultwithbackend, artifact paths inartifacts, and executionlog. - Example code:
from dnakit.bioinformatics.ngs import assemble_reads
result = assemble_reads("R1.fq.gz", "new_assembly", second="R2.fq.gz", memory_gb=8)
print(sorted(result.artifacts))
- Example output:
Returns ToolResult; artifacts lists SPAdes outputs such as contigs and scaffolds, with keys determined by actual outputs. This external-program example was not executed.
Dependencies and implementation notes.
7) Ligate duplex DNA fragments¶
- Purpose: Join duplex DNA fragments with compatible ends.
- Method: Check end polarity and complementarity, then join both strands.
- API:
dnakit.bioinformatics.cloning.Duplex.from_sequence(sequence, circular=False);Duplex.ligate(other) - Input: Two linear
Duplexobjects with compatible ends; this example cuts one molecule and ligates its fragments. - Output: Returns the ligated
Duplexwith its Watson strand and end information. - Example code:
from dnakit.bioinformatics.cloning import Duplex
molecule = Duplex.from_sequence("AACCGGTT")
left, right = molecule.cut(3, 5)
print(left.ligate(right).watson)
- Example output:
Dependencies and implementation notes.
8) Record cloning steps and intermediate products¶
- Purpose: Organize cloning operations into traceable named steps.
- Method: Register products with
add; useapplyto run functions and store parents and products. - API:
dnakit.bioinformatics.cloning.CloningPlan();CloningPlan.add(name, product);CloningPlan.apply(name, function, parents=(), **parameters) - Input: Python callables, parent-step names and operation parameters.
- Output: Returns a
CloningPlan; the example showsadd,apply,steps. - Example code:
from dnakit.bioinformatics.cloning import CloningPlan, Duplex
plan = CloningPlan()
plan.add("template", Duplex.from_sequence("AACCGGTT"))
cut = plan.apply("cut", lambda molecule: molecule.cut(3, 5), parents=["template"])
print([step.name for step in plan.steps])
print(len(cut.product))
- Example output:
Dependencies and implementation notes.
9) Assemble overlapping duplex fragments¶
- Purpose: Find linear or circular products assembled from overlapping fragments.
- Method: Use pydna to search assembly paths satisfying the minimum overlap length.
- API:
dnakit.bioinformatics.cloning.assemble_duplexes(fragments, circular=False, minimum_overlap=25, max_assemblies=50) - Input: A list of
Duplexfragments; requiresbio-assembly; set overlap length according to the experimental design. - Output: Returns a tuple of assembled
Duplexproducts. - Example code:
from dnakit.bioinformatics.cloning import Duplex, assemble_duplexes
fragments = [Duplex.from_sequence("TTATACGATGCTAGCTTACGGTCA"),
Duplex.from_sequence("AGCTTACGGTCACCTATGAGTCCA")]
products = assemble_duplexes(fragments, minimum_overlap=12)
longest = max(products, key=lambda product: len(product.watson))
print(longest.watson)
- Example output:
Dependencies and implementation notes.
10) Golden Gate part design¶
- Purpose: Assign unique non-palindromic junction overhangs and add BsaI/BbsI sites.
- Method: Assign unique non-palindromic overhangs and add BsaI/BbsI recognition sites.
- API:
dnakit.molbio.design_golden_gate(parts[required], enzyme[optional]) - Input: At least two canonical DNA values; design supports
BsaIandBbsI. - Output: Returns
ProviderResultwith query content indata, plusproviderand provenance. - Example code:
from dnakit import DNASequence
from dnakit.molbio import design_golden_gate
result = design_golden_gate(
(DNASequence("ATGGCTGAA"), DNASequence("GCCAAATAA")),
enzyme="BsaI",
)
print(result.data["parts_with_overhangs"])
- Example output: Left/right overhangs, full synthetic part sequences, and a protocol note.
Optional backend dependencies and return conventions
11) Golden Gate reaction assembly¶
- Purpose: Simulate Type IIS digestion and ligation by matching overhangs.
- Method: Simulate Type IIS digestion and join fragments by compatible overhangs.
- API:
dnakit.molbio.assemble_golden_gate(fragments[required], enzyme[optional], circular[optional], labels[optional]) - Input: At least two canonical DNA values carrying the selected Type IIS sites; BsaI, BbsI, Esp3I/BsmBI, and SapI are supported.
- Output: Returns
ProviderResultwith query content indata, plusproviderand provenance. - Example code:
from dnakit import DNASequence
from dnakit.molbio import assemble_golden_gate
result = assemble_golden_gate(
(
DNASequence("GGTCTCAAAACATGGAGGAGCCGCAGTCAGATCCTAGCGTTGAATTCGGATCCCTTTTGAGACC"),
DNASequence("GGTCTCAAAAGGGATCCAAGCTTACGTACGTATGGAGGAGCCGCAGTCAGATATTTTGAGACC"),
DNASequence("GGTCTCAAAATCCTAGCGTTGAATTCGGATCCAAGCTTACGTACGTATGGAGCGTTTGAGACC"),
DNASequence("GGTCTCAAACGATCGATCGATCGATCGATCGGTTTTGAGACC"),
),
labels=("vector", "insert-1", "insert-2", "insert-3"),
)
print(result.data["product_sequence"])
- Example output: Product sequence, length, assembly order, junction overhangs, and unused fragments.