RIMD, Osaka Univ. Osaka Univ.
MAFFT version 7

Multiple alignment program for amino acid or nucleotide sequences

--add: Adding unaligned full-length sequence(s) into an existing alignment

--add
--add
% mafft --add new_sequences --reorder existing_alignment > output

--addfragments: Adding unaligned fragmentary sequence(s) into an existing alignment

--add
--addfragments

% mafft --auto --addfragments fragments --reorder --thread -1 existing_alignment > output

Example

When existing_alignment is
>seq1
ACCDEFGHI-K
>seq2
A--DEFGHI-K
and a sequence to be added (newseq) is
>newseq
ACCDPQRSTEFG
then the result of   mafft --addfull (and mafft --addfragments, mafft --add) is
% mafft --addfull newseq existing_alignment

seq1            ACCD-----EFGHIK
seq2            A--D-----EFGHIK
newseq          ACCDPQRSTEFG---
                *  *     ***
The alignment length is changed (11→15) in this case, as PQRST is inserted (+5) and a gap-only column (between I and K) is removed (-1).

With the --keeplength option, the insertion PQRST is removed and the alignment length is kept unchanged (11→11).

% mafft --addfull newseq --keeplength existing_alignment

seq1            ACCDEFGHI-K
seq2            A--DEFGHI-K
newseq          ACCDEFG----
                *  ****

With the --mapout option, a correspondence table of positions is output to the newseq.map file.

% mafft --addfull newseq --mapout existing_alignment
% cat newseq.map

>newseq
# letter, position in the original sequence, position in the reference alignment
A, 1, 1
C, 2, 2
C, 3, 3
D, 4, 4
P, 5, -
Q, 6, -
R, 7, -
S, 8, -
T, 9, -
E, 10, 5
F, 11, 6
G, 12, 7

The --compactmapout option outputs the same information in a more compact form.  Available in versions 7.496 and higher. 2021/Dec

% mafft --addfull newseq --compactmapout existing_alignment
% cat newseq.map

# Insertions in the added sequences > Position in reference
>newseq
5P - 9T > 4v5

The --mapout and --compactmapout options automatically turn on the --keeplength option, to keep the consistency of the numbering of positions in the reference.

BUG!! Bug information: Versions ≤7.154 had a bug in --addfragments.  When the sequences in the reference alignment were almost identical to each other, an incorrect result was occasionally returned due to this bug.  This bug has been fixed in version 7.157 (2014/Jun/10).
BUG!! Bug information: Versions 6.923 - 6.950 had a bug in the combination of --addfragments and --reorder.  The order of sequences in the output was incorrect.  This bug has been fixed in version 6.951 (2012/Oct/18).
BUG!! Bug information: Versions ≤6.815 had a problem in processing partial sequences.  When the new sequence has domains A and B but a part of sequences in the existing alignment lack domain B, domain B was sometimes not aligned.  This problem has been fixed in version 6.817 (2010/Aug/14).

Possible misalignment by versions ≤6.815:
existing alignment: AAAAAAAA---------BBBBBBBBB
existing alignment: AAAAAAAA---------BBBBBBBBB
existing alignment: AAAAAAAA------------------
new sequence:       AAAAAAAABBBBBBBBB---------

Fixed in versions ≥6.817:

existing alignment: AAAAAAAABBBBBBBBB
existing alignment: AAAAAAAABBBBBBBBB
existing alignment: AAAAAAAA---------
new sequence:       AAAAAAAABBBBBBBBB

Adding aligned sequences (profile) into an existing alignment

% mafft --addprofile aligned_sequences existing_alignment > output

Difference from the --seed option

--seed

Difference from the mafft-profile program

The --addprofile option covers all the situations where the mafft-profile program was used.  Morever, the former is applicable to larger datasets than the latter.  Therefore, the mafft-profile program will be deleted in future releases. 

The mafft-profile program assumes that each profile separately forms a monophyletic cluster.
mafft-profile