Unit 3 / 11

Sequence Analysis and Bioinformatics: DNA, RNA and Proteins

Gains:

  • Ability to print the code of basic sequence analysis operations such as FASTA reading, translation, alignment and BLAST and interpret the results
  • Ability to avoid incorrect conclusions by correctly interpreting concepts such as e-value, coverage rate and reading frame
  • Ability to understand the necessity of confirming the function claim of a sequence with official databases (NCBI, UniProt, Ensembl).

The most basic data of biology is the sequence: the sequence of DNA consisting of the letters A, T, G, C; A, U, G, C sequence of RNA; chain of 20 amino acid letters of protein. We understand what a gene is, how related two species are, and the relationship between a mutation (change in sequence) and disease through these sequences. In this unit, we will learn to use artificial intelligence as a code and interpretation assistant for sequence analysis: reading FASTA files, translating sequences, aligning (alignment: comparing two sequences letter by letter and seeing their similarities), and understanding tools such as BLAST.

Critical caveat from the start: AI does not "know" the actual function of a sequence; Only official databases (NCBI, UniProt, Ensembl) and empirical evidence say this.

Basic concepts and tools

  • FASTA: Text format that stores strings; Each array consists of a header line starting with > and subarray lines below it.
  • BLAST (Basic Local Alignment Search Tool): A tool that compares a sequence you have with millions of sequences in a giant database and finds the most similar ones. “What does this series look like?” standard answer to the question.
  • Alignment: Arranging two or more arrays so that similar regions are placed one under the other. It can be pairwise or multiple sequence alignment (MSA).
  • Translation: Converting the DNA/RNA coding sequence into an amino acid sequence via triple letter groups (codons).
  • Motif: A brief recurring pattern in the sequence that has functional meaning (e.g., a binding site).
Tip: You can't tell the AI ​​to "BLAST that series"; The model cannot access the BLAST database. But "How do I interpret my BLAST result, what does the e-value (E-value) mean?" You can ask, and even write code that calls BLAST programmatically with Biopython.

Step by step: investigating the identity of an array

  1. Obtain the sequence: save to file as FASTA.
  2. Basic check: Length, letter content (is it just A/T/G/C or is there an unknown “N”), GC ratio (percentage of guanine-cytosine: varies by species and region).
  3. BLAST: Search in the NCBI web interface or programmatically.
  4. Comment: Look at the e-value of the best match (the smaller it is, the less likely it is a coincidence) and the query coverage.
  5. Confirmation: Open the matching gene/protein in UniProt or NCBI and verify that it actually matches the function you are looking for.

AI helps you code in step 2 and comment in step 4; but the real data in steps 3 and 5 is provided by the tools themselves and you.

Copiable prompt templates

Role: You are a bioinformatics assistant. Task: Read a FASTA file (sequences.fasta) with Biopython. I want: write the name, length and GC ratio for each sequence into a table; save the result as CSV. Give working Python code with comments.

Translate the DNA sequence I have into a protein sequence. Use Biopython Seq.translate; show stop codon (*); indicate reading frame. Give code, explain.Sequence: [FASTA]

Interpret my BLAST result. Below are the value-value, identity percentage, and coverage rate of the top 5 matches. Explain to me which match is reliable and why, don't make exact function claims, tell me the steps I need to verify. Table: [data]

Align two protein sequences pairwise and find the percentage similarity. Use Biopython pairwise2 or Bio.Align; print the alignment readably. Give the code and explain the scoring scheme.

Weak prompt / Strong prompt

Weak: "Which gene is this sequence?"

Strong: "I have a human DNA sequence of 1,140 base pairs (FASTA below). I BLASTed this sequence myself; best match is TP53, e-value 0.0, identity 99.8%, coverage 100%. Explain why this result is strong evidence; however, tell me which 2 verifications I need to make before ascertaining its function."

Difference: In the strong prompt, the actual data (length, BLAST result) is provided to the model; You are asking the model to interpret the evidence you provide, not to "remember" it. He is forced to make up a model on a weak prompt.

three mini cases

Case 1 — Incorrect reading frame: A student translated the DNA sequence into protein, but from the beginning, without finding the correct start codon (ATG). The result was a meaningless, early stopping protein. When the model tried all three reading frames and wrote code that found the longest open reading frame (ORF) starting with ATG, the correct 380 amino acid protein emerged.

Case 2 — E-value fallacy: A technician reported a BLAST match with an e-value of 2.0 as "found". Whereas, an e-value greater than 1 indicates that the match is most likely a coincidence. The model explained this and reminded that e < 1e-5 is generally used as a reliable threshold.

Case 3 — Contamination: A BLAST of a bacterial sequence in a laboratory turned up human DNA as the best match. This was a sign of sample contamination. The AI ​​aroused the right suspicion by stating that “unexpected type of match could be indicative of contamination”; The technician repeated the example.

Comparison: the role of artificial intelligence

Quest

artificial intelligence

Tool/database

human

FASTA read, GC/length

writes code

Controls the output

Translation, ORF finding

writes code

Runs Biopython

Validates the frame

array id

Comments

BLAST/NCBI finds

confirms

Function claim

offers suggestions

UniProt gives proof

decides

Common mistakes

  • Asking the model to “remember” the string ID: The model does not memorize the strings; Use BLAST.
  • Misinterpreting e-value: Small is good, big is bad; Remember the threshold.
  • Not checking the reading frame: Wrong frame produces nonsense protein.
  • Ignoring coverage: High identity but low coverage means partial match.
  • Missing contamination: Unexpected species matching is a serious warning.
Caution: Just because a sequence is "99% similar to TP53" does not prove that that sequence carries TP53 function; It is a strong hypothesis. The function must be supported by empirical evidence and database descriptions. It is not enough for the AI ​​to simply say “this is a tumor suppressor.”

Multiple sequence alignment and basis of phylogeny

Aligning dozens of sequences together rather than just two is called multiple sequence alignment (MSA) and is the basis of many analyses: finding conserved regions (parts that have remained unchanged in evolution and therefore functionally important), building phylogenetic trees, identifying protein families. Tools like MAFFT, MUSCLE and Clustal do this job. The AI ​​writes the code that calls these tools from Python (via Biopython, for example) and helps you interpret the output; but the alignment itself makes the tool, not the model "by rote".

When interpreting an MSA, pay attention to conserved columns: an amino acid that remains the same across all sequences is most likely critical to the function of the protein (e.g., the active site of an enzyme). This gives a strong clue as to why a mutation might be harmful. But "preserved = significant" is a hypothesis; requires experimental verification.

Read my multiple alignment file (aligned.fasta), which is the MAFFT output, with Biopython. Calculate the retention rate for each column; List over 90% protected positions. Explain why these positions may be of functional importance, do not claim definitive function.

Mutation and variant interpretation trap

When you see a letter change (variant) in a string, it's a big leap to say it's "harmful". Most variants are neutral (ineffective). When interpreting the impact of a variant, one needs to look at dedicated variant databases (like ClinVar) and population frequency data (like gnomAD), not the AI's word. If the model claims that a variant is “pathogenic,” never write this into a clinical or research conclusion without confirming it with these sources.

Base databases for verification

Knowing the official sources to confirm every claim in the series analysis is your strongest shield against the fabrications of artificial intelligence. Most frequently used:

database

for what

Typical confirmation

NCBI GenBank/RefSeq

DNA/RNA sequences, gene records

String ID, length

UniProt

Protein sequences and functions

Function, number of amino acids

ensemble

Genome annotation, gene locations

Gene-chromosome mapping

ClinVar

Clinical significance of variants

Pathogenic/neutral decision

gnomAD

Variant frequency in the population

rare/common variant

AI can suggest which of these bases you should look at; But you make the query and you read the result. "The model said this is what UniProt says" is not a confirmation; Confirmation is opening the UniProt page yourself.

In summary

Sequence analysis is the heart of bioinformatics; FASTA, BLAST, alignment and translation are the basic operations. AI writes the code for these operations and helps you interpret their results, but tools (BLAST) and databases (NCBI, UniProt) provide the actual sequence identification. Correctly understanding concepts such as e-value, coverage, and reading frame is key to avoiding the wrong conclusion. A function claim always requires independent evidence.

Application task

Take a sample DNA sequence (or a gene you downloaded from NCBI). Have the AI ​​calculate the length and GC ratio with Biopython, then translate it in all three reading frames and print code that finds the longest ORF. Run the result. Then search for this sequence yourself in NCBI BLAST and have the model interpret the e-value and coverage rate of the best match. Confirm the model's functional claim in UniProt.

checklist

  • [ ] I checked the length and letter content before processing the string.
  • [ ] I used the correct reading frame in the translation.
  • [ ] I ran BLAST myself, I didn't "remind" the model.
  • [ ] I interpreted the e-value and coverage ratio correctly.
  • [ ] I evaluated the unexpected species match for contamination.
  • [ ] I confirmed the function claim with the official database.