void convertMAlignment2SecVect(SeqVect& sv, const MultipleSequenceAlignment& ma, bool fixAlpha) { sv.Clear(); MuscleContext *ctx = getMuscleContext(); ctx->fillUidsVectors(ma->getNumRows()); unsigned i=0; unsigned seq_count = 0; foreach(const MultipleSequenceAlignmentRow& row, ma->getMsaRows()) { Seq *ptrSeq = new Seq(); QByteArray name = row->getName().toLocal8Bit(); ptrSeq->FromString(row->getCore().constData(), name.constData()); //stripping gaps, original Seq::StripGaps fails on MSVC9 Seq::iterator newEnd = std::remove(ptrSeq->begin(), ptrSeq->end(), U2Msa::GAP_CHAR); ptrSeq->erase(newEnd, ptrSeq->end()); if (ptrSeq->Length()!=0) { ctx->tmp_uIds[seq_count] = ctx->input_uIds[i]; sv.push_back(ptrSeq); seq_count++; } i++; } if (fixAlpha) { sv.FixAlpha(); } }
static void SeqVectFromMSACols(const MSA &msa, unsigned uColFrom, unsigned uColTo, SeqVect &v) { v.Clear(); const unsigned uSeqCount = msa.GetSeqCount(); for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex) { Seq s; SeqFromMSACols(msa, uSeqIndex, uColFrom, uColTo, s); v.AppendSeq(s); } }
void SeqVectFromMSA(const MSA &msa, SeqVect &v) { v.Clear(); const unsigned uSeqCount = msa.GetSeqCount(); for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex) { Seq s; msa.GetSeq(uSeqIndex, s); s.StripGaps(); //if (0 == s.Length()) // continue; const char *ptrName = msa.GetSeqName(uSeqIndex); s.SetName(ptrName); v.AppendSeq(s); } }