Skip to content

Latest commit

Β 

History

History
110 lines (77 loc) Β· 2.59 KB

File metadata and controls

110 lines (77 loc) Β· 2.59 KB

🧬 Sequence Alignment - Bioinformatics

Implementation of classic sequence alignment algorithms in Python for DNA sequence comparison.

πŸ“‹ Description

This project implements the two fundamental algorithms for biological sequence alignment:

  • Needleman-Wunsch (Global Alignment) - Aligns entire sequences end-to-end
  • Smith-Waterman (Local Alignment) - Finds the best matching subsequences

πŸš€ Features

  • βœ… Read sequences from FASTA files
  • βœ… Global alignment with Needleman-Wunsch algorithm
  • βœ… Local alignment with Smith-Waterman algorithm
  • βœ… Backtracking to extract optimal alignments
  • βœ… Score matrix visualization
  • βœ… Validated against EMBOSS Needle & Water tools

πŸ“ Project Structure

sequence-alignment-bioinformatics/
β”œβ”€β”€ alignment.py        # Main Python script with all algorithms
β”œβ”€β”€ sequences.fasta     # Sample DNA sequences in FASTA format
└── README.md           # This file

πŸ”§ Requirements

  • Python 3.x
  • NumPy
pip install numpy

πŸ’» Usage

python alignment.py

Example Output

SΓ©quence 1: ATGCGTACGTTAGC
SΓ©quence 2: ATGCCGTCGTTAGG

============================================================
         ALIGNEMENT GLOBAL (Needleman-Wunsch)
============================================================

Score final: 10

=== Alignement Global ===
Seq1: ATGCGTACGTTAGC
Seq2: ATGCCGTCGTTAGG

============================================================
          ALIGNEMENT LOCAL (Smith-Waterman)
============================================================

Score maximal: 10

=== Alignement Local ===
Seq1: ATGCGTACGTTAG
Seq2: ATGCCGTCGTTAG

βš™οΈ Parameters

Default scoring scheme:

Parameter Value
Match +1
Mismatch 0
Gap -1

You can modify these parameters in the function calls:

matrix = score_matrix_alignement_global(seq1, seq2, match=2, mismatch=-1, gap=-2)

πŸ“Š Algorithms

Needleman-Wunsch (Global)

  • Initializes borders with gap penalties
  • Fills matrix using dynamic programming
  • Backtracking from bottom-right corner

Smith-Waterman (Local)

  • Initializes borders with zeros
  • Minimum score is 0 (never goes negative)
  • Backtracking from maximum score position until reaching 0

πŸ”— Validation

Results validated against professional tools:

πŸ‘€ Author

EL ALEM YOUSSEF

πŸ“„ License

This project is for educational purposes - Bioinformatics TP3.