Transcription and Translation¶
Transcribe DNA sequences into RNA or translate into protein sequences according to the specified reading frame and code table.
1) Transcription¶
- Purpose: Convert thymine
Tin DNA to uracilUaccording to the specified chain direction to obtain an uppercase RNA sequence for checking transcript products. - Method: Replace T with U; reverse-strand transcription first takes the reverse complement.
- API:
dnakit.ops.transcribe(sequence[required], strand[optional]). - Input: One
DNASequenceis required;strandoptional"forward"or"reverse", forward chain is used by default. - Output: Returns the transcribed RNA string.
- Example code:
from dnakit import DNASequence
from dnakit.ops import transcribe
seq = DNASequence("ATGGGCTAA")
print(transcribe(seq))
- Example output:
2) Translation¶
- Purpose: Translate DNA or RNA into protein sequences according to the specified chain direction, reading frame and genetic code table, used to check coding regions and amino acid sequences.
- Method: Read codons in the selected frame and code table, applying stop and ambiguity policies.
- API:
dnakit.ops.translate(sequence[required], frame[optional], table[optional], strand[optional], stop_policy[optional], unknown_policy[optional], incomplete_policy[optional]). - Input: Required
DNASequenceor normalized uppercase DNA/RNA string; optionalstrand,frame,table, stop codon policy, ambiguous codon policy, and incomplete codon policy. - Output: Returns the translated amino-acid sequence as a string.
- Example code:
from dnakit import DNASequence
from dnakit.ops import translate
seq = DNASequence("ATGGGCTAA")
print(translate(seq))
- Example output:
3) Translate forward reading frames and find the longest ORF¶
- Purpose: Translate forward reading frames and find the longest ORF.
- Method: Translate the three forward frames with the standard genetic code and compare uninterrupted protein segments.
- API:
dnakit.databases.dna_translate_reading_frames(*, operation=None, sequence, frame=None, genetic_code=None, verbose=True) - Input: Provide
sequence. - Output: Returns a mapping with
sequence_length,frames,best_frame,best_orfand related fields. - Example code:
import dnakit
result = dnakit.databases.dna_translate_reading_frames(
operation='translate_reading_frames',
sequence='ATGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG',
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.