1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#include "muscle.h"
#include "seqvect.h"
#include "msa.h"
/***
Methionine hack.
Most proteins start with M.
This results in odd-looking alignments with the terminal Ms aligned followed
immediately by gaps.
Hack this by treating terminal M like X.
***/
static bool *M;
void MHackStart(SeqVect &v)
{
if (ALPHA_Amino != g_Alpha)
return;
const unsigned uSeqCount = v.Length();
M = new bool[uSeqCount];
memset(M, 0, uSeqCount*sizeof(bool));
for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex)
{
Seq &s = v.GetSeq(uSeqIndex);
if (0 == s.Length())
continue;
unsigned uId = s.GetId();
if (s[0] == 'M' || s[0] == 'm')
{
M[uId] = true;
s[0] = 'X';
}
}
}
void MHackEnd(MSA &msa)
{
if (ALPHA_Amino != g_Alpha)
return;
if (0 == M)
return;
const unsigned uSeqCount = msa.GetSeqCount();
const unsigned uColCount = msa.GetColCount();
for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex)
{
unsigned uId = msa.GetSeqId(uSeqIndex);
if (M[uId])
{
for (unsigned uColIndex = 0; uColIndex < uColCount; ++uColIndex)
{
if (!msa.IsGap(uSeqIndex, uColIndex))
{
msa.SetChar(uSeqIndex, uColIndex, 'M');
break;
}
}
}
}
delete[] M;
M = 0;
}
|