2

我有一个这样的字符串序列:["123-5", "1-45", "--345"]. 结果是完美的得到12345。所以有时我知道在某个位置我有符号,但不知道是哪个。从示例中我得到了这段代码。

typedef String<char> TSequence;                 // sequence type
typedef Align<TSequence, ArrayGaps> TAlign;     // align type

unsigned int plate_count = plates.size();

TAlign align;
resize(rows(align), plate_count);
for (unsigned int i = 0; i < plate_count; ++i)
    assignSource(row(align, i), plates[i]);

globalMsaAlignment(align, SimpleScore(5, -3, -1, -3));

// create the profile string
String<ProfileChar<char> > profile;
resize(profile, length(row(align, 0)));
for (unsigned rowNo = 0; rowNo < plate_count; ++rowNo)
    for (unsigned i = 0; i < length(row(align, rowNo)); ++i)
        profile[i].count[ordValue(row(align, rowNo)[i])] += 1;

// call consensus from this string
String<char> consensus;
for (unsigned i = 0; i < length(profile); ++i)
{
    char idx = (char)getMaxIndex(profile[i]);
    if (idx == '-') {
       int bck = profile[i].count[ordValue('-')];
       profile[i].count[ordValue('-')] = 0;
       idx = (char)getMaxIndex(profile[i]);
       if (profile[i].count[ordValue(idx)] == 1) { // ignore single recognitions
          idx = '@';
       }
       profile[i].count[ordValue('-')] = bck;
    }
    appendValue(consensus, idx);
}

return string(toCString(consensus));

如何判断Seqan特定位置有符号?

4

0 回答 0