<p>@Matteo Ferla wrote in the comments,</p>
<blockquote>
<p>It sounds like you'd want a MSA of the whole set and not a set of pairwise ones. If global MSA is what you actually want, try ebi.ac.uk/Tools/msa/muscle. Then to trim the ends before phylogeny there are dozens of tools.</p>
</blockquote>
<blockquote>
<p>The reason is because Blast aligns locally, i.e. a window, while a global alignment is the whole entirety of the sequence</p>
</blockquote>

CC BY-SA 4.0
2023-09-12T23:17:13.713Z
2023-09-12T23:24:24.687Z
2023-09-12T23:24:24.687Z
M__
<p>BLAST isn't appropriate for multiple sequence alignment.
BLAST generates pairwise alignments. Furthermore, the aligning regions shown in a BLAST report only include subsets of the hit sequences.</p>
<p>To create multiple sequence alignment of hits you want to:</p>
<ul>
<li>run blast</li>
<li>extract the hit sequences</li>
<li>perform multiple-sequence-alignment (e.g., using MAFFT)</li>
</ul>
<p>Extracting hit sequences can be done using the command-line. Check the docs for <code>blastdbcmd</code>.</p>
<p>If you prefer a point-and-click interface, you can also do this using my lab's <a href="https://sequenceserver.com" rel="nofollow noreferrer">SequenceServer BLAST software</a> by simply selecting the hits that you want to retain, and in the <strong>Download</strong> section, clicking &quot;FASTA of selected hits&quot;. Or if you want all of them, click &quot;FASTA of all hits&quot;.</p>
<p><a href="https://sequenceserver.com/" rel="nofollow noreferrer"><img src="https://sequenceserver.com/img/blast-setup/normal-blast-result.png" alt="Download hits from BLAST report " /></a></p>

CC BY-SA 4.0
2021-12-20T18:10:20.783Z
Please add a statement stating that your lab created this software that you're posting about on multiple threads.
Ram RS
CC BY-SA 4.0
2021-12-19T01:22:07.263Z
2021-12-21T19:40:59.833Z
2021-12-21T19:40:59.833Z
Yannick Wurm
<p>To generate aligned protein sequence truncate to the same length, I use blastp in biopython for MSA. I have multiple queries and one subject sequence. However, the alignment never returns the same length.</p>
<p>How can I align all sequences altogether, thus resulting in a set of sequences of the same length?</p>

CC BY-SA 4.0
2023-09-12T23:20:01.400Z
Please consider accepting/upvoting the answers below.
M__
<python><blastp>
Blastp MSA to the same length
# Blastp MSA to the same length

(Asked by: username_0 on 2020-08-09)

To generate aligned protein sequence truncate to the same length, I use blastp in biopython for MSA. I have multiple queries and one subject sequence. However, the alignment never returns the same length.

How can I align all sequences altogether, thus resulting in a set of sequences of the same length?

**Tags:** python, blastp
> **Comments:**
> **username_1**: Please consider accepting/upvoting the answers below.  

---

## 2 answers

### Answer by username_1 on 2023-09-12. Score: -1 | Accepted answer

@Matteo Ferla wrote in the comments,

> It sounds like you'd want a MSA of the whole set and not a set of pairwise ones. If global MSA is what you actually want, try ebi.ac.uk/Tools/msa/muscle. Then to trim the ends before phylogeny there are dozens of tools.

> The reason is because Blast aligns locally, i.e. a window, while a global alignment is the whole entirety of the sequence


---

### Answer by username_2 on 2021-12-19. Score: 2

BLAST isn't appropriate for multiple sequence alignment.
BLAST generates pairwise alignments. Furthermore, the aligning regions shown in a BLAST report only include subsets of the hit sequences.

To create multiple sequence alignment of hits you want to:

* run blast
* extract the hit sequences
* perform multiple-sequence-alignment (e.g., using MAFFT)

Extracting hit sequences can be done using the command-line. Check the docs for `blastdbcmd`.

If you prefer a point-and-click interface, you can also do this using my lab's [SequenceServer BLAST software](https://sequenceserver.com) by simply selecting the hits that you want to retain, and in the **Download** section, clicking "FASTA of selected hits". Or if you want all of them, click "FASTA of all hits".

[![Download hits from BLAST report ](https://sequenceserver.com/img/blast-setup/normal-blast-result.png)](https://sequenceserver.com/)

> **Comments:**
> **username_3**: Please add a statement stating that your lab created this software that you're posting about on multiple threads.  

---

