source: tags/ms_r18q1/ARBDB/adhashtools.cxx

Last change on this file was 8607, checked in by westram, 12 years ago

merge from e4fix [8135] [8136] [8137] [8138] [8139] [8140] [8141] [8142] [8143] [8144] [8222]
(this revives the reverted patches [8129] [8130] [8131] [8132]; see [8133])

  • fixes
    • some free/delete mismatches
    • wrong definition of ORF objects (Level was no bit value)
    • amino consensus (failed for columns only containing 'C')
  • rename
    • AA_sequence_term → orf_term
    • ED4_sequence_terminal_basic → ED4_abstract_sequence_terminal
  • cleaned up hierarchy dumps
  • tweaked is_terminal()/to_terminal()
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : adhashtools.cxx                                   //
4//   Purpose   : convenience functions for hashes                  //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11#include "gb_local.h"
12#include "arbdbt.h"
13
14static void GBT_add_item_to_hash(GBDATA *gb_item, GB_HASH *item_hash) {
15    GBS_write_hash(item_hash, GBT_read_name(gb_item), (long)gb_item);
16}
17
18typedef GBDATA *(*item_iterator)(GBDATA *);
19
20static GB_HASH *create_item_hash(long size, GBDATA *gb_start, item_iterator getFirst, item_iterator getNext) {
21    GB_HASH *item_hash = GBS_create_hash(size, GB_IGNORE_CASE);
22    GBDATA  *gb_item;
23
24    for (gb_item = getFirst(gb_start); gb_item; gb_item = getNext(gb_item)) {
25        GBT_add_item_to_hash(gb_item, item_hash);
26    }
27
28    return item_hash;
29}
30
31GB_HASH *GBT_create_species_hash_sized(GBDATA *gb_main, long species_count) {
32    return create_item_hash(species_count, gb_main, GBT_first_species, GBT_next_species);
33}
34
35GB_HASH *GBT_create_species_hash(GBDATA *gb_main) {
36    return GBT_create_species_hash_sized(gb_main, GBT_get_species_count(gb_main));
37}
38
39GB_HASH *GBT_create_marked_species_hash(GBDATA *gb_main) {
40    return create_item_hash(GBT_get_species_count(gb_main), gb_main, GBT_first_marked_species, GBT_next_marked_species);
41}
42
43GB_HASH *GBT_create_SAI_hash(GBDATA *gb_main) {
44    return create_item_hash(GBT_get_SAI_count(gb_main), gb_main, GBT_first_SAI, GBT_next_SAI);
45}
46
47GB_HASH *GBT_create_organism_hash(GBDATA *gb_main) {
48    return create_item_hash(GEN_get_organism_count(gb_main), gb_main, GEN_first_organism, GEN_next_organism);
49}
50
Note: See TracBrowser for help on using the repository browser.