sequence completion¶
Reverse, complement, or reverse complement the DNA sequence to obtain a new sequence after the direction is reversed.
1) reverse order¶
- Purpose: Only reverse the character order of the DNA sequence without replacing the bases, used to check or construct the reverse position sequence.
- Method: Read bases from end to start without changing their symbols.
- API:
dnakit.ops.reverse(sequence[required]). - Input: One required
DNASequence; no additional required parameters. - Output: Returns the processed
DNASequence; read its symbols fromsymbols. - Example code:
from dnakit import DNASequence
from dnakit.ops import reverse
seq = DNASequence("AATCGC")
print(reverse(seq).symbols)
- Example output:
2) complementary¶
- Purpose: Replace each DNA base with a complementary base according to base pairing rules, but maintain the original position order, and use it to construct the corresponding complementary chain.
- Method: Replace each base with its DNA complement without reordering positions.
- API:
dnakit.ops.complement(sequence[required]). - Input: One required
DNASequence; no additional required parameters. - Output: Returns the processed
DNASequence; read its symbols fromsymbols. - Example code:
from dnakit import DNASequence
from dnakit.ops import complement
seq = DNASequence("AATCGC")
print(complement(seq).symbols)
- Example output:
3) Reverse complementation¶
- Purpose: Simultaneously reverse the sequence order and replace it with complementary bases to obtain a 5′→3′ representation of the other strand, which can be used for reverse strand search, direction unification and primer analysis.
- Method: Reverse and complement bases while remapping strand, features and per-base annotations.
- API:
dnakit.ops.reverse_complement(value, output_path=None, *, feature_policy="preserve", read_config=None, write_config=None, sequence_column=None, show_progress=True). - Input: DNA text, a file path, or one
DNA,DNASequence, orDNARecord. Text returns a string; files returnWriteResult. Input and output paths must differ; existing outputs are protected. FAQ: details. - Output: Returns a reverse-complemented
DNASequenceorDNA; file input can be written to the selected path. - Example code:
from dnakit import DNA
from dnakit.ops import reverse_complement
dna = DNA("AATCGC", id="seq-1")
print(reverse_complement(dna).symbols)
- Example output:
4) Compute a DNA reverse complement¶
- Purpose: Compute a DNA reverse complement.
- Method: Complement A↔T, C↔G and N↔N, then reverse the sequence.
- API:
dnakit.databases.sequence_reverse_complement(*, operation=None, sequence, verbose=True) - Input: Provide
sequence. - Output: Returns a mapping with
dataand related fields. - Example code:
import dnakit
result = dnakit.databases.sequence_reverse_complement(
operation='reverse_complement',
sequence='ATGCGATCG',
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.
Full parameters and usage notes
5) Reverse-complement duplex DNA¶
- Purpose: Reverse the orientation of duplex DNA while preserving its duplex and end structure.
- Method: Swap the Watson and Crick strands and adjust their relative offset.
- API:
dnakit.bioinformatics.cloning.Duplex.from_sequence(sequence, circular=False);Duplex.reverse_complement() - Input: A fully complementary duplex or A/C/G/T sequence; nicks, internal gaps and mismatches are unsupported.
- Output: Returns the reverse-complemented
Duplexwith both strands and end structures. - Example code:
from dnakit.bioinformatics.cloning import Duplex
molecule = Duplex.from_sequence("AACCGGTT")
print(molecule.reverse_complement().watson)
- Example output:
The example sequence equals its reverse complement.