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