36 if (needed>buffer_size) {
38 buffer_size = needed+10;
39 buffer =
new char[buffer_size];
41 memset(buffer,
' ', buffer_size-1);
42 buffer[buffer_size-1] = 0;
46 void ED4_consensus_sequence_terminal::draw() {
48 static size_t buffer_size = 0;
65 const char *no_data =
"No consensus data";
66 size_t len = strlen(no_data);
68 memcpy(buffer, no_data, len);
92 for (
int pos = index_range.
start(); pos <= index_range.
end(); ++pos) {
98 char c = cons[seq_pos-seq_range.
start()];
99 buffer[pos] = only_show_diff ? ref->convert(c, seq_pos) : c;
125 for (
long k=0;
size_t(k)<helixLen; k++) {
131 buffer[k] = helix->
get_symbol(helixBuffer[i], pairchar);
137 buffer[helixLen] = 0;
138 return device->
text(gc, buffer, pos);
158 (
const unsigned char *)pfoldBuffer,
169 buffer[pfoldLen] = 0;
170 return device->
text(gc, buffer, pos);
173 void ED4_orf_terminal::draw() {
177 static char **colored_strings =
NULp;
178 static int len_of_colored_strings = 0;
194 int max_seq_len = aaSeqLen;
203 const char *no_data =
"No sequence data";
209 if (index_range.
end() >= len_of_colored_strings) {
210 len_of_colored_strings = index_range.
end() + 256;
214 freeset(colored_strings[i], ARB_alloc<char>(len_of_colored_strings+1));
215 memset(colored_strings[i],
' ', len_of_colored_strings);
216 colored_strings[i][len_of_colored_strings] = 0;
223 memset(color_is_used, 0,
sizeof(color_is_used));
227 const unsigned char *aaSequence_u = (
const unsigned char *)aaSequence;
228 const unsigned char *aaColor_u = (
const unsigned char *)aaColor;
239 for (
int scr_pos=index_range.
start(); scr_pos <= index_range.
end(); scr_pos++) {
241 unsigned char c = aaSequence_u[seq_pos];
242 unsigned char cc = aaColor_u[seq_pos];
245 color_is_used[gc] = scr_pos+1;
246 colored_strings[gc][scr_pos] = char_2_char[
safeCharIndex(c)];
250 for (
int scr_pos=index_range.
start(); scr_pos <= index_range.
end(); scr_pos++) {
252 char c = aaSequence_u[seq_pos];
255 color_is_used[gc] = scr_pos+1;
256 colored_strings[gc][scr_pos] = char_2_char[
safeCharIndex(c)];
264 const int real_left = index_range.
start();
265 const int real_right = index_range.
end();
266 AW_pos x2 = text_x + width*real_left;
273 for (
int i = real_left; i <= real_right; i++, x2 += width) {
275 char base = aaSequence_u[new_pos];
277 if (isupper(base) || (base==
'*')) {
283 if ((gcChar>=0) && (gcChar<ED4_G_DRAG)) {
289 double rad_x = width*1.5;
290 double rad_y = height*0.7;
291 double center_x = x1+rad_x;
292 const int DRAW_DEG = 62;
307 if (color_is_used[gc] && (
int)strlen(colored_strings[gc]) >= color_is_used[gc]) {
309 memset(colored_strings[gc] + index_range.
start(),
' ', index_range.
size());
316 void ED4_sequence_terminal::draw() {
318 static char **colored_strings =
NULp;
319 static int len_of_colored_strings = 0;
321 #if defined(TRACE_REFRESH)
322 fprintf(stderr,
"ED4_sequence_terminal::draw for id='%s'\n",
id);
fflush(stderr);
343 int left = index_range.
start();
344 int right = index_range.
end();
349 if (right>max_seq_len) right = max_seq_pos;
354 const char *no_data =
"No sequence data";
361 if (right >= len_of_colored_strings) {
362 len_of_colored_strings = right + 256;
363 if (!colored_strings)
ARB_calloc(colored_strings, ED4_G_DRAG);
366 freeset(colored_strings[i], (
char *)malloc(
sizeof(
char) * (len_of_colored_strings+1)));
367 memset(colored_strings[i],
' ', len_of_colored_strings);
368 colored_strings[i][len_of_colored_strings] = 0;
376 memset(color_is_used, 0,
sizeof(color_is_used));
390 for (
int scr_pos=left; scr_pos <= right; scr_pos++) {
392 int c = db_pointer[seq_pos];
393 int gc = char_2_gc[c];
395 color_is_used[gc] = scr_pos+1;
396 colored_strings[gc][scr_pos] = char_2_char[only_show_diff ? ref->
convert(c, seq_pos) : c];
413 int is_marked =
GB_read_flag(spec_man->get_species_pointer());
422 const char *saiColors =
NULp;
432 if (statColors || searchColors || is_marked || is_selected || color_group || saiColors) {
435 int real_left = left;
436 int real_right = right;
437 AW_pos x2 = text_x + width*real_left;
450 if (is_selected && selection.is_unlimited()) {
454 for (i = real_left; i <= real_right; i++, x2 += width) {
460 if (searchColors && searchColors[new_pos]) {
461 color = searchColors[new_pos];
463 else if (is_selected && selection.contains(new_pos)) {
466 else if (statColors) {
470 else if (saiColors) {
471 color = saiColors[new_pos];
472 if (color < ED4_G_CBACK_0 || color >
ED4_G_CBACK_9) color = back_color;
478 if (color != old_color) {
499 if (shall_display_secstruct_info) {
535 if (!color_is_used[gc])
continue;
537 memset(colored_strings[gc] + left,
' ', right-left+1);
545 void ED4_sequence_info_terminal::draw() {
547 calc_world_coords(&x, &y);
564 strncpy(&buffer[1], this->
id, 8);
567 if (containing_species_manager()->is_highlighted()) {
590 GB_CSTR real_name = to_species_name_terminal()->get_displayed_text();
592 int height_of_char = -1;
594 bool is_marked =
false;
598 GBDATA *gbd = species_man->get_species_pointer();
607 #define MIN_MARK_BOX_SIZE 8
610 #undef MIN_MARK_BOX_SIZE
622 int xsize = (width_of_char*6)/10;
623 int ysize = (height_of_char*6)/10;
626 int bx =
int(text_x+xoff);
627 int by =
int(text_y-(yoff+ysize));
630 if (!is_marked && xsize>2 && ysize>2) {
636 ED4_flag_header_terminal *header_term = to_flag_header_terminal();
637 const char *
header_text = header_term->get_displayed_text();
656 ED4_terminal(spec_, temp_id, width, height, temp_parent)
bool is_pairpos(size_t pos) const
bool column_stat_activated
void ensure_buffer(char *&buffer, size_t &buffer_size, size_t needed)
int is_pure_text_terminal() const
AW_device * current_device()
const char * resolve_pointer_to_char_pntr(int *str_len=NULp) const FINAL_OVERRIDE
int screen_to_sequence(int screen_pos) const
bool only_show_diff_for(const ED4_sequence_terminal *term) const
const AW_bitset AW_SCREEN
CONSTEXPR_INLINE unsigned char safeCharIndex(char c)
const char * ED4_getSaiColorString(AW_root *awr, int start, int end)
ED4_SearchResults & results() const
virtual void clear_part(const AW::Rectangle &rect, AW_bitset filteri)
unsigned char ST_ML_Color
ExplicitRange clip_screen_range(PosRange screen_range) const
ED4_text_terminal(const ED4_objspec &spec_, GB_CSTR id, AW_pos width, AW_pos height, ED4_manager *parent)
int get_height(int gc) const
int is_flag_header_terminal() const
ED4_reference * reference
size_t opposite_position(size_t pos) const
size_t get_max_screen_pos() const
const AW_bitset AW_ALL_DEVICES
int get_width(int gc) const
char buffer[MESSAGE_BUFFERSIZE]
GB_ERROR GB_push_transaction(GBDATA *gbd)
void world_to_win_coords(AW_pos *xPtr, AW_pos *yPtr) const
const AW::Position & calc_world_coords() const
#define PFOLD_AWAR_MATCH_METHOD
Selected method for computing the match quality (see PFOLD_MATCH_METHOD).
#define MIN_MARK_BOX_SIZE
GB_ERROR GB_export_error(const char *error)
int SEQ_TERM_TEXT_YOFFSET
bool inside_species_seq_manager() const
int convert(char c, int pos) const
PosRange calc_update_interval()
GBDATA * get_gb_main() const
int sequence_to_screen(int sequence_pos) const
int GB_read_security_write(GBDATA *gbd)
int GBT_get_color_group(GBDATA *gb_item)
GB_BUFFER GB_give_buffer(size_t size)
#define AWAR_PROTVIEW_DISPLAY_OPTIONS
static void error(const char *msg)
void expand_to_length(int len)
char * buildColorString(const ED4_sequence_terminal *seq_terminal, int start, int end)
ED4_root_group_manager * root_group_man
static char * header_text
bool is_unlimited() const
PFOLD_MATCH_METHOD
Defines the methods for match computation. For details refer to ED4_pfold_calculate_secstruct_match()...
int GB_read_flag(GBDATA *gbd)
AW_awar * awar(const char *awar)
GB_ERROR GB_pop_transaction(GBDATA *gbd)
const ConsensusBuildParams & get_consensus_params()
static bool ED4_show_helix_on_device(AW_device *device, int gc, const char *helixBuffer, size_t helixStart, size_t helixLen, const AW::Position &pos, AW_CL cduser)
char get_symbol(char left, char right) const
bool visualizeSAI_allSpecies
TYPE * ARB_calloc(size_t nelem)
int MAXSEQUENCECHARACTERLENGTH
#define PFOLD_AWAR_ENABLE
Enable structure match.
bool AW_color_groups_active()
ED4_window * current_ed4w()
ED4_seq_colors * sequence_colors
const AW_bitset AW_ALL_DEVICES_UNSCALED
static bool ED4_show_protein_match_on_device(AW_device *device, int gc, const char *pfoldBuffer, size_t pfoldStart, size_t pfoldLen, const AW::Position &pos, AW_CL cl_protstruct)
void aw_message(const char *msg)
bool arc(int gc, AW::FillStyle filled, AW_pos x0, AW_pos y0, AW_pos xradius, AW_pos yradius, int start_degrees, int arc_degrees, AW_bitset filteri=AW_ALL_DEVICES_SCALED)
ED4_species_manager * containing_species_manager() const
bool ED4_get_highlighted_range(ED4_terminal *term, PosRange &range)
GB_alignment_type GetAliType() FINAL_OVERRIDE
const ED4_remap * remap() const
void build_consensus_string_to(char *consensus_string, ExplicitRange range, const ConsensusBuildParams &BK) const
char * resolve_pointer_to_string_copy(int *str_len=NULp) const FINAL_OVERRIDE
AP_tree * STAT_find_node_by_name(ST_ML *st_ml, const char *species_name)
GB_transaction ta(gb_var)
ST_ML_Color * STAT_get_color_string(ST_ML *st_ml, char *species_name, AP_tree *node, int start_ali_pos, int end_ali_pos)
bool box(int gc, AW::FillStyle filled, const AW::Rectangle &rect, AW_bitset filteri=AW_ALL_DEVICES_SCALED)
int INFO_TERM_TEXT_YOFFSET
GB_ERROR ED4_pfold_calculate_secstruct_match(const unsigned char *structure_sai, const unsigned char *structure_cmp, const int start, const int end, char *result_buffer, PFOLD_MATCH_METHOD match_method)
Compares a protein secondary structure with a primary structure or another secondary structure...
ED4_manager * get_parent(ED4_level lev) const
bool text(int gc, const SizedCstr &cstr, const AW::Position &pos, AW_pos alignment=0.0, AW_bitset filteri=AW_ALL_DEVICES_UNSCALED)
void set_vertical_font_overlap(bool allow)
int is_species_name_terminal() const
bool text_overlay(int gc, const SizedCstr &cstr, const AW::Position &pos, AW_pos alignment, AW_bitset filteri, TextOverlayCallback toc, AW_CL cduser=0)
Adds support for protein structure prediction, comparison of two protein secondary structures and of ...