Skip to content

This project explores three core computational challenges in bioinformatics using Python ๐Ÿ. It covers the application of the Viterbi algorithm for decoding hidden state sequences, game-theoretic strategies on DNA sequences, and advanced sequence-based games using combinatorial logic.

License

Notifications You must be signed in to change notification settings

AimiliosKourpas/bioinformatics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿงฌ Bioinformatics

๐Ÿ“ University of Piraeus ๐Ÿ“ Department of Informatics ๐Ÿ“… Academic Year: 2022 โ€“ 2023 ๐Ÿ“˜ Course: Bioinformatics ๐Ÿ“ˆ Semester: 6th


๐Ÿ“‚ Table of Contents


๐Ÿงช Topic 1: Decoding the Most Probable State Sequence in an HMM

๐Ÿ“œ Problem Statement

Given an HMM with two states, ฮฑ and ฮฒ:

  • State ฮฑ favors purines (A, G)
  • State ฮฒ favors pyrimidines (C, T) The goal is to decode the most probable state sequence (ฮฑ/ฮฒ) for the observed sequence GGCT using logarithmic scores instead of raw probabilities.

๐Ÿ›  Solution Overview

We apply the Viterbi algorithm ๐Ÿ›ค, which uses dynamic programming to find the most probable path of hidden states by:

  • Using logarithmic probabilities to avoid underflow
  • Tracking scores and backpointers for each state
  • Performing backtracking to reconstruct the optimal path

๐Ÿ’ป Implementation Details

  • Language: Python ๐Ÿ

  • Library: NumPy

  • Main Components:

    • emissions: list of emission symbols
    • states: list of states
    • transition_prob: NumPy matrix of transition probabilities
    • emission_prob: NumPy matrix of emission probabilities
    • initial_prob: initial state probabilities
    • scores, backpointers: dynamic programming tables
    • Viterbi: main function implementing the algorithm

โ–ถ๏ธ How to Run

1๏ธโƒฃ Install Python and NumPy (pip install numpy) 2๏ธโƒฃ Navigate to the directory containing 11_4.py 3๏ธโƒฃ Run:

python3 11_4.py

๐ŸŽฎ Topic 2: Winning Strategy in a Two-Sequence Game

๐Ÿ“œ Problem Statement

Two players play a game with two โ€œchromosomesโ€ of length n and m. On each turn, a player can:

  • Destroy one chromosome
  • Split the other into two non-empty parts The player who removes the last nucleotide wins.

๐Ÿ›  Solution Overview

  • Read sequences from .fna files
  • Use logical lists (canWin, winning) to track win conditions
  • Determine which moves lead to victory by simulating all possible splits
  • Print the winning splits and identify the winner

๐Ÿ’ป Implementation Details

  • Language: Python ๐Ÿ

  • Functions:

    • loadSeq: loads a sequence from a file
    • validateInput: checks user input
    • game: runs the main game loop

โ–ถ๏ธ How to Run

1๏ธโƒฃ Install Python 2๏ธโƒฃ Navigate to the directory containing 6_12.py 3๏ธโƒฃ Run:

python3 6_12.py

๐Ÿงฉ Topic 3: Advanced Two-Sequence Game Strategy

๐Ÿ“œ Problem Statement

Two players play with two sequences (n, m nucleotides). On each turn, a player removes:

  • Two nucleotides from one sequence
  • One nucleotide from the other The player who cannot make a move wins.

๐Ÿ›  Solution Overview

  • Read enzyme sequences from brain.fna and liver.fna
  • Simulate turns, alternating players
  • Identify winning strategies for all combinations of n and m

๐Ÿ’ป Implementation Details

  • Language: Python ๐Ÿ

  • Library: Biopython (pip install biopython)

  • Main Components:

    • liver_sequences, brain_sequences: loaded sequences
    • makeMove: function simulating each turn

โ–ถ๏ธ How to Run

1๏ธโƒฃ Install Python and Biopython (pip install biopython) 2๏ธโƒฃ Navigate to the directory containing 6_14.py 3๏ธโƒฃ Run:

python3 6_14.py

๐Ÿ“š References

Topic 1

Topic 2

  • Bioinformatics course notes, University of Piraeus
  • Introduction to Bioinformatics Algorithms, Neil C. Jones & Pavel A. Pevzner

Topic 3

About

This project explores three core computational challenges in bioinformatics using Python ๐Ÿ. It covers the application of the Viterbi algorithm for decoding hidden state sequences, game-theoretic strategies on DNA sequences, and advanced sequence-based games using combinatorial logic.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages