A lightweight Python tool to analyze DNA sequences β directly from a file or user input β and get insights like base composition, GC content, transcription, translation, and reverse complement.
- β DNA Validation β Ensures the input contains only valid bases: A, T, G, C
- π’ Base Counting β Counts total occurrences and percentage of each nucleotide
- π§ͺ GC Content Calculation β Measures GC richness of the sequence
- π Reverse Complement β Generates the reverse complement strand
- π¬ Transcription β Converts DNA to RNA by replacing T with U
- 𧬠Translation β Translates DNA into a protein sequence using a codon table
- Python 3.x
(No external libraries required)
You can analyze DNA from:
-
A text file (
.txt)
Format: Plain sequence (A/T/G/C only), optionally multiline -
Manual input
Just paste your DNA sequence when prompted
Run the script: python dna_analyzer.py
Then follow the interactive prompt: π Do you have a file? (yes/no): yes π Enter your DNA file path or name (.txt): my_sequence.txt
Sample output: β DNA is valid!
π§Ύ Base Count: {'A': 22, 'T': 20, 'G': 18, 'C': 15} π Base Percentage: {'A': '29.33%', 'T': '26.67%', 'G': '24.00%', 'C': '20.00%'}
π§ͺ GC Content: 44.0%
π RNA Sequence: AUGCGUUAAG...
𧬠Protein Sequence: Met-Arg-Stop...
𧬠Reverse Complement: TTACGCTA...