ARB
Macros | Functions
aditem.cxx File Reference
#include "gb_local.h"
#include <arbdbt.h>
#include <arb_strbuf.h>
Include dependency graph for aditem.cxx:

Go to the source code of this file.

Macros

#define GENERATE_ID(num)   sprintf(generated_id, "%s%zu", default_id, num);
 
#define MAX_NAME_LEN   20
 

Functions

GBDATA * GBT_find_or_create_item_rel_item_data (GBDATA *gb_item_data, const char *itemname, const char *id_field, const char *id, bool markCreated)
 
GBDATA * GBT_find_or_create_species_rel_species_data (GBDATA *gb_species_data, const char *name, bool markCreated)
 
GBDATA * GBT_find_or_create_species (GBDATA *gb_main, const char *name, bool markCreated)
 
GBDATA * GBT_find_or_create_SAI (GBDATA *gb_main, const char *name)
 
GBDATA * GBT_find_item_rel_item_data (GBDATA *gb_item_data, const char *id_field, const char *id_value)
 
GBDATA * GBT_expect_item_rel_item_data (GBDATA *gb_item_data, const char *id_field, const char *id_value)
 
GBDATA * GBT_get_species_data (GBDATA *gb_main)
 
GBDATA * GBT_first_marked_species_rel_species_data (GBDATA *gb_species_data)
 
GBDATA * GBT_first_marked_species (GBDATA *gb_main)
 
GBDATA * GBT_next_marked_species (GBDATA *gb_species)
 
GBDATA * GBT_first_species_rel_species_data (GBDATA *gb_species_data)
 
GBDATA * GBT_first_species (GBDATA *gb_main)
 
GBDATA * GBT_next_species (GBDATA *gb_species)
 
GBDATA * GBT_find_species_rel_species_data (GBDATA *gb_species_data, const char *name)
 
GBDATA * GBT_expect_species_rel_species_data (GBDATA *gb_species_data, const char *name)
 
GBDATA * GBT_find_species (GBDATA *gb_main, const char *name)
 
GBDATA * GBT_expect_species (GBDATA *gb_main, const char *name)
 
GBDATA * GBT_get_SAI_data (GBDATA *gb_main)
 
GBDATA * GBT_first_SAI_rel_SAI_data (GBDATA *gb_sai_data)
 
GBDATA * GBT_first_SAI (GBDATA *gb_main)
 
GBDATA * GBT_next_SAI (GBDATA *gb_sai)
 
GBDATA * GBT_find_SAI_rel_SAI_data (GBDATA *gb_sai_data, const char *name)
 
GBDATA * GBT_expect_SAI_rel_SAI_data (GBDATA *gb_sai_data, const char *name)
 
GBDATA * GBT_find_SAI (GBDATA *gb_main, const char *name)
 
GBDATA * GBT_expect_SAI (GBDATA *gb_main, const char *name)
 
static long GBT_get_item_count (GBDATA *gb_parent_of_container, const char *item_container_name)
 
long GBT_get_species_count (GBDATA *gb_main)
 
long GBT_get_SAI_count (GBDATA *gb_main)
 
static char * GBT_create_unique_item_identifier (GBDATA *gb_item_container, const char *id_field, const char *default_id)
 
char * GBT_create_unique_species_name (GBDATA *gb_main, const char *default_name)
 
long GBT_mark_all (GBDATA *gb_main, int flag)
 
long GBT_mark_all_that (GBDATA *gb_main, int flag, bool(*condition)(GBDATA *, void *), void *cd)
 
long GBT_count_marked_species (GBDATA *gb_main)
 
char * GBT_store_marked_species (GBDATA *gb_main, bool unmark_all)
 
NOT4PERL GB_ERROR GBT_with_stored_species (GBDATA *gb_main, const char *stored, species_callback doit, int *clientdata)
 
static GB_ERROR restore_mark (GBDATA *gb_species, int *)
 
GB_ERROR GBT_restore_marked_species (GBDATA *gb_main, const char *stored_marked)
 
GB_CSTR GBT_get_name_or_description (GBDATA *gb_item)
 
const char * GBT_get_name (GBDATA *gb_item)
 
NOT4PERL GB_CSTR GBT_read_name (GBDATA *gb_item)
 
GBDATA ** GBT_gen_species_array (GBDATA *gb_main, long *speciesCountPtr)
 

Macro Definition Documentation

#define GENERATE_ID (   num)    sprintf(generated_id, "%s%zu", default_id, num);
#define MAX_NAME_LEN   20

Referenced by GBT_with_stored_species().

Function Documentation

GBDATA* GBT_find_or_create_item_rel_item_data ( GBDATA *  gb_item_data,
const char *  itemname,
const char *  id_field,
const char *  id,
bool  markCreated 
)

Search for an existing or create a new, named item.

Parameters
gb_item_dataitem container
itemnamedescription of itemtype (for error messages)
id_fielditem-field containing ID (e.g. "name")
idthe ID itself (compare is case-insensitive)
markCreatedtrue -> mark item if it was created
Returns
found/created item or NULp if an error occurs (which is exported in that case)

Definition at line 18 of file aditem.cxx.

References error(), GB_await_error(), GB_create_container(), GB_end_transaction(), GB_export_errorf(), GB_push_transaction(), GB_write_flag(), GBT_find_item_rel_item_data(), GBT_write_string(), and NULp.

Referenced by EXP_find_or_create_experiment_rel_exp_data(), find_or_create_sync_value(), GBT_find_or_create_colorset(), GBT_find_or_create_SAI(), and GBT_find_or_create_species_rel_species_data().

GBDATA* GBT_find_or_create_species_rel_species_data ( GBDATA *  gb_species_data,
const char *  name,
bool  markCreated 
)
GBDATA* GBT_find_or_create_species ( GBDATA *  gb_main,
const char *  name,
bool  markCreated 
)
GBDATA* GBT_find_or_create_SAI ( GBDATA *  gb_main,
const char *  name 
)
GBDATA* GBT_find_item_rel_item_data ( GBDATA *  gb_item_data,
const char *  id_field,
const char *  id_value 
)

search for items starting at item container

Parameters
'gb_item_data'is a container containing items
'id_field'is a field containing a unique identifier for each item (e.g. 'name' for species)
'id_value'expected value of 'id_field'
Returns
a pointer to an item with 'id_field' containing 'id_value' or NULp (in this case an error MAY be exported)

Note: If you expect the item to exist, use GBT_expect_item_rel_item_data()

Definition at line 74 of file aditem.cxx.

References GB_find_string(), GB_get_father(), GB_IGNORE_CASE, NULp, and SEARCH_GRANDCHILD.

Referenced by EXP_find_experiment_rel_exp_data(), GBT_create_unique_item_identifier(), GBT_expect_item_rel_item_data(), GBT_find_colorset(), GBT_find_or_create_item_rel_item_data(), GBT_find_SAI(), GBT_find_SAI_rel_SAI_data(), GBT_find_species(), GBT_find_species_rel_species_data(), and GEN_find_gene_rel_gene_data().

GBDATA* GBT_expect_item_rel_item_data ( GBDATA *  gb_item_data,
const char *  id_field,
const char *  id_value 
)
GBDATA* GBT_get_species_data ( GBDATA *  gb_main)

Definition at line 105 of file aditem.cxx.

References GBT_find_or_create().

Referenced by addSpeciesToConcatenateList(), AP_tree_root::AP_tree_root(), ARB_main(), calc_and_update_alignment_errors_cb(), compress_sequence_tree(), concatenateFieldsCreateNewSpecies(), copy_move_del_alignment(), copy_SAI_to_species_cb(), create_new_species(), create_species_selection_button(), DI_create_matrix_variables(), experiment_field_selection_list_rescan(), export_to_DB(), gbl_findacc(), gbl_findspec(), GBT_begin_rename_session(), GBT_check_alignment(), GBT_check_data(), GBT_count_marked_species(), GBT_create_unique_species_name(), GBT_expect_species(), GBT_find_or_create_species(), GBT_find_species(), GBT_first_marked_species(), GBT_first_species(), GBT_gen_species_array(), GBT_mark_all(), gene_extract_handler(), gene_field_selection_list_rescan(), get_first_species_data(), ALI_ARBDB::get_sequence(), ALI_ARBDB::get_sequence_string(), ArbImporter::import_data(), launch_MapViewer_cb(), DI_MATRIX::load(), mark_action(), MERGE_sequences_simple(), mg_check_field_cb(), mg_get_first_species_data1(), mg_get_first_species_data2(), MG_merge_tagged_field_cb(), mg_transfer_listed_species(), mg_transfer_selected_species(), GroupSearch::perform_search(), probe_match_event(), PT_init_input_data(), PT_prepare_data(), ALI_ARBDB::put_sequence(), ALI_ARBDB::put_sequence_string(), ArbImporter::read_data(), ReadArbdb(), resort_data_base(), Aligner::run(), QUERY::search_duplicated_field_content(), species_create_handler(), species_field_selection_list_rescan(), transfer_field_of_listed_cb(), and ScopedTransporter::transferAllIn().

GBDATA* GBT_first_marked_species_rel_species_data ( GBDATA *  gb_species_data)

Definition at line 109 of file aditem.cxx.

References GB_first_marked().

Referenced by get_first_species(), DI_MATRIX::load(), probe_match_event(), and ReadArbdb().

GBDATA* GBT_first_marked_species ( GBDATA *  gb_main)
GBDATA* GBT_next_marked_species ( GBDATA *  gb_species)
GBDATA* GBT_first_species_rel_species_data ( GBDATA *  gb_species_data)
GBDATA* GBT_first_species ( GBDATA *  gb_main)
GBDATA* GBT_next_species ( GBDATA *  gb_species)
GBDATA* GBT_find_species_rel_species_data ( GBDATA *  gb_species_data,
const char *  name 
)
GBDATA* GBT_expect_species_rel_species_data ( GBDATA *  gb_species_data,
const char *  name 
)

Definition at line 136 of file aditem.cxx.

References GBT_expect_item_rel_item_data().

GBDATA* GBT_find_species ( GBDATA *  gb_main,
const char *  name 
)

Definition at line 139 of file aditem.cxx.

References GBT_find_item_rel_item_data(), and GBT_get_species_data().

Referenced by alignToNextRelative(), awt_create_select_filter_window_aw_cb(), awt_create_select_filter_window_gb_cb(), awt_openDefaultURL_on_selected_species(), awtc_nn_search(), AWTC_recreate_name(), build_reverse_complement(), calculateEndPosition(), create_primer_design_window(), EXP_item_type_species_selector::current(), FINAL_TYPE< SEQTYPE >::current(), GEN_item_type_species_selector::current(), di_mark_by_distance(), do_sth_with_species(), ed_submit_info_event(), EXP_get_first_experiment_data(), expect_species_selected(), extract_species_selection(), EDB_root_bact::fill_data(), find_species_by_id(), gbl_read_seq_sai_or_species(), GBT_with_stored_species(), GEN_find_organism(), GEN_get_current_organism(), GEN_get_local_gene_data(), GEN_root::GEN_root(), GEN_species_name_changed_cb(), MO_Liste::get_all_species(), get_selected_imported_species(), get_selected_species(), insert_new_species_terminal(), Structure3D::MapCurrentSpeciesToEcoliTemplate(), MG_create_remap(), mg_get_selected_species1(), mg_get_selected_species2(), MG_map_species(), MG_update_example(), move_species_to_extended(), nt_add(), NT_create_sai_from_pfold(), primer_design_event_go(), primer_design_event_init(), probe_design_event(), PV_WriteTranslatedSequenceToDB(), rerun_importTest_cb(), SpeciesSelector::select_first(), selectValidNameFromList(), st_ml_add_quality_string_to_species(), transfer_field_of_selected_cb(), TranslateGeneToAminoAcidSequence(), translateSAItoColors(), and update_exportTest_result_cb().

GBDATA* GBT_expect_species ( GBDATA *  gb_main,
const char *  name 
)

Definition at line 146 of file aditem.cxx.

References GBT_expect_item_rel_item_data(), and GBT_get_species_data().

Referenced by GetDisplayInfo().

GBDATA* GBT_get_SAI_data ( GBDATA *  gb_main)
GBDATA* GBT_first_SAI_rel_SAI_data ( GBDATA *  gb_sai_data)

Definition at line 159 of file aditem.cxx.

References GB_entry().

Referenced by GBT_check_alignment(), get_first_SAI(), and nt_build_sai_string().

GBDATA* GBT_first_SAI ( GBDATA *  gb_main)
GBDATA* GBT_next_SAI ( GBDATA *  gb_sai)
GBDATA* GBT_find_SAI_rel_SAI_data ( GBDATA *  gb_sai_data,
const char *  name 
)
GBDATA* GBT_expect_SAI_rel_SAI_data ( GBDATA *  gb_sai_data,
const char *  name 
)

Definition at line 174 of file aditem.cxx.

References GBT_expect_item_rel_item_data().

Referenced by saiHasDataInAli().

GBDATA* GBT_find_SAI ( GBDATA *  gb_main,
const char *  name 
)
GBDATA* GBT_expect_SAI ( GBDATA *  gb_main,
const char *  name 
)
static long GBT_get_item_count ( GBDATA *  gb_parent_of_container,
const char *  item_container_name 
)
static
long GBT_get_species_count ( GBDATA *  gb_main)
long GBT_get_SAI_count ( GBDATA *  gb_main)

Definition at line 211 of file aditem.cxx.

References GBT_get_item_count().

Referenced by CheckedConsistencies::CheckedConsistencies(), and GBT_create_SAI_hash().

static char* GBT_create_unique_item_identifier ( GBDATA *  gb_item_container,
const char *  id_field,
const char *  default_id 
)
static
char* GBT_create_unique_species_name ( GBDATA *  gb_main,
const char *  default_name 
)

Definition at line 287 of file aditem.cxx.

References GBT_create_unique_item_identifier(), and GBT_get_species_data().

Referenced by GBT_check_alignment(), and write_entry().

long GBT_mark_all ( GBDATA *  gb_main,
int  flag 
)
long GBT_mark_all_that ( GBDATA *  gb_main,
int  flag,
bool(*)(GBDATA *, void *)  condition,
void *  cd 
)
long GBT_count_marked_species ( GBDATA *  gb_main)
char* GBT_store_marked_species ( GBDATA *  gb_main,
bool  unmark_all 
)

stores the currently marked species in a string

Parameters
gb_maindatabase
unmark_allif true -> unmark species
Returns
';'-separated list of species names

Note: a faster (but less robust) way to temporarily store species marks, is to use the flag GB_USERFLAG_WASMARKED together with GB_write_user_flag

Definition at line 377 of file aditem.cxx.

References GBS_strstruct::cat(), GBS_strstruct::cut_tail(), GB_write_flag(), GBT_first_marked_species(), GBT_get_name(), GBT_next_marked_species(), GBS_strstruct::put(), and GBS_strstruct::release_memfriendly().

Referenced by EXP_get_first_experiment_data(), and GEN_get_first_gene_data().

NOT4PERL GB_ERROR GBT_with_stored_species ( GBDATA *  gb_main,
const char *  stored,
species_callback  doit,
int *  clientdata 
)

call a function with each species of a list

Parameters
gb_maindatabase
stored';'-separated list of species names
doitfunction to call with each species in 'stored'
clientdatais passed to 'doit'
Returns
error if sth goes wrong (or if 'doit' reports error)

Definition at line 404 of file aditem.cxx.

References error(), gb_assert, GBT_find_species(), MAX_NAME_LEN, and NULp.

Referenced by EXP_get_first_experiment_data(), GBT_restore_marked_species(), and GEN_get_first_gene_data().

static GB_ERROR restore_mark ( GBDATA *  gb_species,
int *   
)
static

Definition at line 441 of file aditem.cxx.

References GB_write_flag(), and NULp.

Referenced by GBT_restore_marked_species().

GB_ERROR GBT_restore_marked_species ( GBDATA *  gb_main,
const char *  stored_marked 
)

restores marked species.

Parameters
gb_maindatabase
stored_markedcontains a ';'-separated list of species names to mark (as returned by GBT_store_marked_species)
Returns
error if sth goes wrong

Definition at line 446 of file aditem.cxx.

References GBT_mark_all(), GBT_with_stored_species(), NULp, and restore_mark().

Referenced by exp_restore_old_species_marks(), and gen_restore_old_species_marks().

GB_CSTR GBT_get_name_or_description ( GBDATA *  gb_item)

returns the value of the "name" field of any database item or "<unnamed_item>" or similar.

See also
GBT_get_name

Definition at line 459 of file aditem.cxx.

References GB_read_key_pntr(), GBS_global_string(), GBT_read_char_pntr(), and result.

Referenced by adaptCopiedAlignment(), aed_start_naligning(), ALI_realign_marked(), alignToNextRelative(), appendNameAndUsedBasePositions(), are_not_in_tree(), auto_select_pseudo_species(), awt_add_sequences_to_list(), awtc_mark_hits(), AP_sequence::bind_to_species(), concatenateAlignments(), QUERY::copy_selection_list_2_query_box(), AP_sequence::do_lazy_load(), dot_sequence_by_consensus(), ED4_get_marked_from_menu(), ED4_pfold_select_SAI_and_update_option_menu(), EXP_get_experiment_id(), expect_entry(), FastAligner_delete_temp_entries(), SAI_selection::fill(), MO_Liste::fill_marked_bakts(), filter_columnstat_SAIs(), find_SAI_candidates(), find_species_candidates(), gbl_findgene(), GBT_convert_changekey(), GBT_read_name(), gbt_rename_alignment_of_item(), gde_filter_weights(), gen_extract_gene_2_pseudoSpecies(), gen_get_gene_id(), GEN_global_gene_identifier(), GEN_organism_not_found(), gene_requires(), get_SAI_description(), export_sequence_data::get_seq_data(), launch_MapViewer_cb(), ListDisplayRow::ListDisplayRow(), PHDATA::load(), mergeSimilarSpecies(), mg_check_field_cb(), MG_export_fields(), MP_mark_probes_in_tree(), nt_add_partial(), NT_fix_gene_data(), perform_query_cb(), PT_prepare_species_sequence(), PV_AddOrfTerminalsToLoadedSpecies(), PV_ManageTerminals(), readCompactedSequence(), reverseComplement(), set_marks_of(), species_requires(), trackAlignmentChanges(), ScopedTransporter::transferAllIn(), translate_getInfo(), FilteredExport::write_fasta(), and writeStringToAlignment().

const char* GBT_get_name ( GBDATA *  gb_item)
NOT4PERL GB_CSTR GBT_read_name ( GBDATA *  gb_item)

Definition at line 477 of file aditem.cxx.

References GBT_get_name_or_description().

GBDATA** GBT_gen_species_array ( GBDATA *  gb_main,
long *  speciesCountPtr 
)