Pre-defined Sequence Alignment Score Settings

Q

How to Use Pre-defined Sequence Alignment Score Settings?

✍: FYIcenter.com

A

Biopython provides 3 Pre-defined Sequence Alignment Score Settings: "blastn" and "megablast" for nucleotide alignments, and "blastp" for protein alignments.

Here is an example on how to "blastp" score settings.

fyicenter$ python
>>> from Bio import Align
>>> aligner = Align.PairwiseAligner(scoring="blastp")

>>> print(aligner)
Pairwise sequence aligner with parameters
  substitution_matrix: <Array object at 0x111404eb0>
  target_internal_open_gap_score: -12.000000
  target_internal_extend_gap_score: -1.000000
  target_left_open_gap_score: -12.000000
  target_left_extend_gap_score: -1.000000
  target_right_open_gap_score: -12.000000
  target_right_extend_gap_score: -1.000000
  query_internal_open_gap_score: -12.000000
  query_internal_extend_gap_score: -1.000000
  query_left_open_gap_score: -12.000000
  query_left_extend_gap_score: -1.000000
  query_right_open_gap_score: -12.000000
  query_right_extend_gap_score: -1.000000
  mode: global

>>> target = "AEPNAATNYATEAMDSLKTQAIDLISQTWPVVTTVVVAGLVIRLFKKFSSKA"
>>> query =  "DGTSTATSYATEAMNSLKTQATDLIDQTWPVVTSVAVAGLAIRLFKKFS"
>>> alignments = aligner.align(target, query)
>>> print(len(alignments))
1

>>> print(alignments[0])
target  0 AEPNAATNYATEAMDSLKTQAIDLISQTWPVVTTVVVAGLVIRLFKKFSSKA 52
        0 .....||.||||||.||||||.|||.|||||||.|.||||.||||||||--- 52
query   0 DGTSTATSYATEAMNSLKTQATDLIDQTWPVVTSVAVAGLAIRLFKKFS--- 49

>>> print(alignments.score)
166.0

As you see "blastp" score settings eliminated the alignment that has an internal gap, because the internal gap score is set to -12.0, much lower than left or right gaps.

Eliminated alignment:
target  0 AEPNAATNYATEAMDSLKTQAIDLISQTWPVVTTVVVAGLVIRLFKKFSSKA 52
        0 .....||.||||||.||||||.|||.|||||||.|.||||.|||||||-|-- 52
query   0 DGTSTATSYATEAMNSLKTQATDLIDQTWPVVTSVAVAGLAIRLFKKF-S-- 49

 

Get Help Documentation with Biopython

Too Many Results from align() Function

Biopython - Tools for Biological Computation

⇑⇑ OBF (Open Bioinformatics Foundation) Tools

2023-08-03, 429🔥, 0💬