ARB
Macros | Functions | Variables
AP_consensus.cxx File Reference
#include "NT_local.h"
#include <aw_root.hxx>
#include <aw_msg.hxx>
#include <aw_awar.hxx>
#include <arbdbt.h>
#include <arb_strbuf.h>
#include <arb_defs.h>
#include <arb_progress.h>
#include <awt_config_manager.hxx>
#include <awt_misc.hxx>
#include <awt_sel_boxes.hxx>
#include <consensus.h>
#include <consensus_config.h>
#include <chartable.h>
Include dependency graph for AP_consensus.cxx:

Go to the source code of this file.

Macros

#define AWAR_MAX_FREQ_PREFIX   "tmp/CON_MAX_FREQ/"
 
#define AWAR_CONSENSUS_PREFIX   "consensus/"
 
#define AWAR_CONSENSUS_PREFIX_TMP   "tmp/" AWAR_CONSENSUS_PREFIX
 
#define AWAR_MAX_FREQ_IGNORE_GAPS   AWAR_MAX_FREQ_PREFIX "no_gaps"
 
#define AWAR_MAX_FREQ_SAI_NAME   AWAR_MAX_FREQ_PREFIX "sai_name"
 
#define AWAR_CONSENSUS_MARKED_ONLY   AWAR_CONSENSUS_PREFIX_TMP "marked_only"
 
#define AWAR_CONSENSUS_ALIGNMENT   AWAR_CONSENSUS_PREFIX_TMP "alignment"
 
#define AWAR_CONSENSUS_COUNTGAPS   AWAR_CONSENSUS_PREFIX "countgaps"
 
#define AWAR_CONSENSUS_GAPBOUND   AWAR_CONSENSUS_PREFIX "gapbound"
 
#define AWAR_CONSENSUS_GROUP   AWAR_CONSENSUS_PREFIX "group"
 
#define AWAR_CONSENSUS_CONSIDBOUND   AWAR_CONSENSUS_PREFIX "considbound"
 
#define AWAR_CONSENSUS_UPPER   AWAR_CONSENSUS_PREFIX "upper"
 
#define AWAR_CONSENSUS_LOWER   AWAR_CONSENSUS_PREFIX "lower"
 
#define AWAR_CONSENSUS_NAME   AWAR_CONSENSUS_PREFIX_TMP "name"
 
#define CONSENSUS_AWAR_SOURCE   CAS_NTREE
 

Functions

static int CON_insertSequences (GBDATA *gb_main, const char *aliname, long maxalignlen, bool onlymarked, BaseFrequencies &freqs)
 
static GB_ERROR CON_export (GBDATA *gb_main, const char *savename, const char *align, const char *result, bool onlymarked, long nrofspecies, const ConsensusBuildParams &BK)
 
static GB_ERROR CON_calculate (GBDATA *gb_main, const ConsensusBuildParams &BK, const char *aliname, bool onlymarked, const char *sainame)
 
static void CON_calculate_cb (AW_window *aw)
 
static void consensus_upper_lower_changed_cb (AW_root *awr, bool upper_changed)
 
void AP_create_consensus_var (AW_root *aw_root, AW_default aw_def)
 
AW_windowAP_create_con_expert_window (AW_root *aw_root)
 
static GB_ERROR CON_calc_max_freq (GBDATA *gb_main, bool ignore_gaps, const char *savename, const char *aliname)
 
static void CON_calc_max_freq_cb (AW_window *aw)
 
AW_windowAP_create_max_freq_window (AW_root *aw_root)
 

Variables

static AWT_config_mapping_def consensus_config_mapping []
 

Macro Definition Documentation

#define AWAR_MAX_FREQ_PREFIX   "tmp/CON_MAX_FREQ/"

Definition at line 30 of file AP_consensus.cxx.

#define AWAR_CONSENSUS_PREFIX   "consensus/"

Definition at line 31 of file AP_consensus.cxx.

#define AWAR_CONSENSUS_PREFIX_TMP   "tmp/" AWAR_CONSENSUS_PREFIX

Definition at line 32 of file AP_consensus.cxx.

#define AWAR_MAX_FREQ_IGNORE_GAPS   AWAR_MAX_FREQ_PREFIX "no_gaps"
#define AWAR_MAX_FREQ_SAI_NAME   AWAR_MAX_FREQ_PREFIX "sai_name"
#define AWAR_CONSENSUS_MARKED_ONLY   AWAR_CONSENSUS_PREFIX_TMP "marked_only"
#define AWAR_CONSENSUS_ALIGNMENT   AWAR_CONSENSUS_PREFIX_TMP "alignment"
#define AWAR_CONSENSUS_COUNTGAPS   AWAR_CONSENSUS_PREFIX "countgaps"

Definition at line 39 of file AP_consensus.cxx.

Referenced by AP_create_con_expert_window(), and AP_create_consensus_var().

#define AWAR_CONSENSUS_GAPBOUND   AWAR_CONSENSUS_PREFIX "gapbound"

Definition at line 40 of file AP_consensus.cxx.

Referenced by AP_create_con_expert_window(), and AP_create_consensus_var().

#define AWAR_CONSENSUS_GROUP   AWAR_CONSENSUS_PREFIX "group"

Definition at line 41 of file AP_consensus.cxx.

Referenced by AP_create_con_expert_window(), and AP_create_consensus_var().

#define AWAR_CONSENSUS_CONSIDBOUND   AWAR_CONSENSUS_PREFIX "considbound"

Definition at line 42 of file AP_consensus.cxx.

Referenced by AP_create_con_expert_window(), and AP_create_consensus_var().

#define AWAR_CONSENSUS_UPPER   AWAR_CONSENSUS_PREFIX "upper"
#define AWAR_CONSENSUS_LOWER   AWAR_CONSENSUS_PREFIX "lower"
#define AWAR_CONSENSUS_NAME   AWAR_CONSENSUS_PREFIX_TMP "name"
#define CONSENSUS_AWAR_SOURCE   CAS_NTREE

Definition at line 47 of file AP_consensus.cxx.

Function Documentation

static int CON_insertSequences ( GBDATA gb_main,
const char aliname,
long  maxalignlen,
bool  onlymarked,
BaseFrequencies freqs 
)
static

read sequence data and fill into 'freqs'

Parameters
gb_maindatabase
alinamename of alignment
maxalignlenlength of alignment
onlymarkedtrue -> marked only
freqssequences are inserted here (has to be empty)
Returns
number of inserted sequences

Definition at line 52 of file AP_consensus.cxx.

References BaseFrequencies::added_sequences(), arb_progress::auto_subtitles(), arb_progress::done(), GB_read_char_pntr(), GB_read_string_count(), GBS_global_string(), GBT_count_marked_species(), GBT_find_sequence(), GBT_first_marked_species(), GBT_first_species(), GBT_get_species_count(), GBT_message(), GBT_next_marked_species(), GBT_next_species(), length, and nt_assert.

Referenced by CON_calc_max_freq(), and CON_calculate().

static GB_ERROR CON_export ( GBDATA gb_main,
const char savename,
const char align,
const char result,
bool  onlymarked,
long  nrofspecies,
const ConsensusBuildParams BK 
)
static

writes consensus SAI to DB

Parameters
gb_maindatabase
savenamename of SAI to save to
alignalignment name
resultSAI data to write
onlymarkedtrue -> was calculated on marked only (used for SAI comment)
nrofspeciesnumber of used sequences (used for SAI comment; if less than 20 -> add an explicit list to field '_SPECIES')
BKparameters used for consensus calculation (used for SAI comment)
Returns
error if something goes wrong

Definition at line 90 of file AP_consensus.cxx.

References buffer, GBS_strstruct::cat(), ConsensusBuildParams::considbound, ConsensusBuildParams::countgaps, ConsensusBuildParams::gapbound, GB_delete(), GB_FIND, GB_get_father(), GB_read_char_pntr(), GB_search(), GB_STRING, GB_write_string(), GBS_global_string(), GBT_add_data(), GBT_find_or_create_SAI(), GBT_find_sequence(), GBT_first_marked_species(), GBT_first_species(), GBT_next_marked_species(), GBT_next_species(), GBT_write_string(), GBS_strstruct::get_data(), ConsensusBuildParams::group, ConsensusBuildParams::lower, GBS_strstruct::put(), and ConsensusBuildParams::upper.

Referenced by CON_calculate().

static GB_ERROR CON_calculate ( GBDATA gb_main,
const ConsensusBuildParams BK,
const char aliname,
bool  onlymarked,
const char sainame 
)
static

calculates the consensus and writes it to SAI 'sainame' Description how consensus is calculated: ../HELP_SOURCE/source/consensus_def.hlp

Parameters
gb_maindatabase
BKparameters for consensus calculation
alinamealignment name
onlymarkedtrue -> use marked sequences only
sainamename of destination SAI
Returns
error if something goes wrong

Definition at line 168 of file AP_consensus.cxx.

References arb_assert, BaseFrequencies::build_consensus_string(), CON_export(), CON_insertSequences(), error(), GB_append_exportedError(), GB_AT_UNKNOWN, GB_await_error(), GB_end_transaction(), GB_push_transaction(), GBT_get_alignment_len(), GBT_get_alignment_type(), ConsensusBuildParams::lower, NULp, result, BaseFrequencies::setup(), and ConsensusBuildParams::upper.

Referenced by CON_calculate_cb().

static void CON_calculate_cb ( AW_window aw)
static
static void consensus_upper_lower_changed_cb ( AW_root awr,
bool  upper_changed 
)
static
void AP_create_consensus_var ( AW_root aw_root,
AW_default  aw_def 
)
AW_window* AP_create_con_expert_window ( AW_root aw_root)
static GB_ERROR CON_calc_max_freq ( GBDATA gb_main,
bool  ignore_gaps,
const char savename,
const char aliname 
)
static

calculates the maximum frequency for each column and write to SAI

Parameters
gb_maindatabase
ignore_gapstrue -> ignore gaps; see ../HELP_SOURCE/source/max_freq.hlp
savenamename of destination SAI
alinamename of alignment to use
Returns
error if something goes wrong

Definition at line 368 of file AP_consensus.cxx.

References arb_assert, GB_transaction::close(), CON_insertSequences(), error(), GB_append_exportedError(), GB_AT_UNKNOWN, GB_await_error(), GB_have_error(), GB_STRING, GB_write_string(), GBS_global_string(), GBT_add_data(), GBT_find_or_create_SAI(), GBT_get_alignment_len(), GBT_get_alignment_type(), BaseFrequencies::max_frequency_at(), NULp, BaseFrequencies::setup(), ta, and type.

Referenced by CON_calc_max_freq_cb().

static void CON_calc_max_freq_cb ( AW_window aw)
static
AW_window* AP_create_max_freq_window ( AW_root aw_root)

Variable Documentation

AWT_config_mapping_def consensus_config_mapping[]
static
Initial value:
= {
{ AWAR_CONSENSUS_MARKED_ONLY, "marked_only" },
{ AWAR_CONSENSUS_NAME, "name" },
{ NULp, NULp }
}
#define AWAR_CONSENSUS_GAPBOUND
#define AWAR_CONSENSUS_NAME
#define AWAR_CONSENSUS_MARKED_ONLY
#define CONSENSUS_CONFIG_COUNTGAPS
#define AWAR_CONSENSUS_GROUP
#define CONSENSUS_CONFIG_GROUP
#define CONSENSUS_CONFIG_GAPBOUND
#define AWAR_CONSENSUS_CONSIDBOUND
#define CONSENSUS_CONFIG_CONSIDBOUND
#define CONSENSUS_CONFIG_UPPER
#define AWAR_CONSENSUS_LOWER
#define AWAR_CONSENSUS_UPPER
#define AWAR_CONSENSUS_COUNTGAPS
#define NULp
Definition: cxxforward.h:116
#define CONSENSUS_CONFIG_LOWER

Definition at line 272 of file AP_consensus.cxx.