---
tags: N-exo
title: Align, trim, and tree example
---
# Align, trim, and tree example
## Env setup
```bash
# installing mamba if not there yet (enables faster conda installations)
conda install -n base -c conda-forge mamba
mamba create -n align-trim-and-tree -c conda-forge -c bioconda -c defaults muscle=5.1 trimal=1.4.1 iqtree=2.2.0_beta
conda activate align-trim-and-tree
```
## Test sequences
Making file holding test sequences (copy and paste whole codeblock into command-line):
```bash
printf ">UOY43881.1 epoxyqueuosine reductase QueH [Enterobacter roggenkampii]
MTTAPFIRPQLTLPNGADKLLLHSCCAPCSGEVMEAIQASGIEYTIFFYNPNIHPQKEYLIRKEENIRFA
EKHGVPFVDADYDTDNWFERAKGMEWEPERGVRCTMCFDMRFERTALYAAENGFSVISSSLGISRWKNMQ
QINDCGQRAAARYPGMVYWDYNWRKQGGSSRMIEISKREQFYQQEYCGCVYSLRDSNLHRKSQGRPLIRI
GKLFYGQDDNEK
>WP_112144455.1 epoxyqueuosine reductase QueH [Faecalibacterium hattorii]
MISMSKQLNFAQQMDEVLKTLGDARPKLLLHACCGPCSSAVLEQLCAHFEITVLYYNPNTWPAEEYHRRG
EELERFVAAAHPLGVTVIEDRYDPQEFYSAVAGLENEPERGSRCTVCYRLRMRRAAQYAAEHGFQWFTTT
LSISPHKDAKRINEIGQELEAEFGVKHLPSDFKKHNGYLRSLQLSEEYGLYRQDYCGCEFSARARQAPQT
HTGPHRG
>WP_245392219.1 epoxyqueuosine reductase QueH [Salinicola halophyticus]
MSTADERQALRLPEGHAKLLLHSCCAPCSGEVMEALHASGIDYAIFFYNPNIHPKKEYLLRKEENIRFAE
QHGIEFIDADYDTDNWFARAKGMEFEPERGIRCTMCFDMRFERTALYAKENGYTLISSSLGISRWKDMNQ
INDCGHRAAAPYEGIEYWDYNWRKKGGSKRMIEISKRERFYQQEYCGCVYSLRDSTSTARRRAAT
>WP_200559745.1 epoxyqueuosine reductase QueH [Erwinia sp. S43]
MSTVERDKLTLPKGANKLLLHSCCAPCSGEVMEALQVSGIDYTIFFYNPNIHPQKEYLLRKEENIRFAEQHGIPFVDADY
DTDNWFARAKGMEWEPERGVRCTMCFDMRFERTALYAYENGFPVISSSLGISRWKNMQQINDCGDRAAAPYEGISYWDYN
WRKKGGAARMIEISKRERFYQQEYCGCVYSLRDSNLHRKSQGRPLIKLGVLYYGDEDAEGKS
" > test-seqs.faa
```
## Aligning
```bash
muscle -align test-seqs.faa -output test-seqs-aligned.faa
```
## Trimming
```bash
trimal -in test-seqs-aligned.faa -out test-seqs-aligned-trimmed.faa -automated1
```
## Treeing
```bash
iqtree -T 4 -m MFP -B 1000 -s test-seqs-aligned-trimmed.faa -pre iqtree-out
```
## Output tree
The primary output tree file is "iqtree-out.treefile", which is what we'd give to the iToL site. We can rename that like this:
```bash
mv iqtree-out.treefile test-seqs.tre
```
And unless we have some reason to dig into them, we can get rid of all of the intermediate files produced by iqtree like this:
```bash
rm iqtree-*
```