bool Aligner::Align(const char* query, const Filter& filter, Alignment* alignment) const { if (!translation_matrix_) return false; if (reference_length_ == 0) return false; int query_len = strlen(query); if (query_len == 0) return false; int8_t* translated_query = new int8_t[query_len]; TranslateBase(query, query_len, translated_query); const int8_t score_size = 2; s_profile* profile = ssw_init(translated_query, query_len, score_matrix_, score_matrix_size_, score_size); uint8_t flag = 0; SetFlag(filter, &flag); s_align* s_al = ssw_align(profile, translated_reference_, reference_length_, static_cast<int>(gap_opening_penalty_), static_cast<int>(gap_extending_penalty_), flag, filter.score_filter, filter.distance_filter, query_len); alignment->Clear(); ConvertAlignment(*s_al, query_len, alignment); alignment->mismatches = CalculateNumberMismatch(&*alignment, translated_reference_, translated_query, query_len); // Free memory delete [] translated_query; align_destroy(s_al); init_destroy(profile); return true; }
// ********************************************************************* // InitFromCategory() // ********************************************************************* void GdiLabelDrawer::InitFromCategory(CLabelOptions* options) { _penFontOutline.CreatePen(PS_SOLID, options->fontOutlineWidth, options->fontOutlineColor); _penFrameOutline.CreatePen(options->frameOutlineStyle, options->frameOutlineWidth, options->frameOutlineColor); double haloWidth = fabs(options->fontSize / 16.0 * options->haloSize); _penHalo.CreatePen(PS_SOLID, (int)haloWidth, options->haloColor); // we can select brush at once because it's the only one to use _brushFrameBack.CreateSolidBrush(options->frameBackColor); _oldBrush = _dc->SelectObject(&_brushFrameBack); _alignment = ConvertAlignment(options->inboxAlignment); _dc->SetTextColor(options->fontColor); }