Beispiel #1
0
const GtCanvasClass* gt_canvas_class_new(size_t size,
                                         GtCanvasVisitLayoutFunc la_visit_pre,
                                         GtCanvasVisitLayoutFunc la_visit_post,
                                         GtCanvasVisitTrackFunc t_visit_pre,
                                         GtCanvasVisitTrackFunc t_visit_post,
                                         GtCanvasVisitLineFunc l_visit_pre,
                                         GtCanvasVisitLineFunc l_visit_post,
                                         GtCanvasVisitBlockFunc b_visit,
                                         GtCanvasVisitElementFunc e_visit,
                                         GtCanvasVisitCustomTrackFunc ct_visit,
                                         GtCanvasDrawRulerFunc draw_ruler_func,
                                         GtCanvasFreeFunc free)
{
  GtCanvasClass *c_class = gt_class_alloc(sizeof *c_class);
  c_class->size = size;
  c_class->visit_layout_pre   = la_visit_pre;
  c_class->visit_layout_post  = la_visit_post;
  c_class->visit_track_pre    = t_visit_pre;
  c_class->visit_track_post   = t_visit_post;
  c_class->visit_line_pre     = l_visit_pre;
  c_class->visit_line_post    = l_visit_post;
  c_class->visit_block        = b_visit;
  c_class->visit_element      = e_visit;
  c_class->visit_ct           = ct_visit;
  c_class->draw_ruler_func    = draw_ruler_func;
  c_class->free = free;
  return c_class;
}
Beispiel #2
0
const GtMatchClass* gt_match_class_new(size_t size,
                                       GtMatchFreeFunc free,
                                       GtMatchAcceptFunc accept)
{
  GtMatchClass *c_class;
  gt_assert(size);
  c_class = gt_class_alloc(sizeof *c_class);
  c_class->size = size;
  c_class->free = free;
  c_class->accept = accept;
  return c_class;
}
const GtMatchVisitorClass*
gt_match_visitor_class_new(size_t size,
                           GtMatchVisitorFreeFunc free,
                           GtMatchVisitorBlastFunc match_blast,
                           GtMatchVisitorOpenFunc match_open)
{
  GtMatchVisitorClass *c_class;
  gt_assert(size);
  c_class = gt_class_alloc(sizeof *c_class);
  c_class->size = size;
  c_class->free = free;
  c_class->match_blast = match_blast;
  c_class->match_open = match_open;
  return c_class;
}
Beispiel #4
0
const GtClusteredSetClass* gt_clustered_set_class_new(
  size_t size,
  GtClusteredSetNumberOfClustersFunc number_of_clusters,
  GtClusteredSetMergeClustersFunc merge_clusters,
  GtClusteredSetFreeFunc free,
  GtClusteredSetIteratorFunc iterator,
  GtClusteredSetNumberOfElementsFunc number_of_elements,
  GtClusteredSetClusterNumFunc cluster_num)
{
  GtClusteredSetClass  *c_class = gt_class_alloc(sizeof *c_class);
  c_class->size = size;
  c_class->number_of_clusters = number_of_clusters;
  c_class->merge_clusters = merge_clusters;
  c_class->free = free;
  c_class->iterator = iterator;
  c_class->number_of_elements = number_of_elements;
  c_class->cluster_num = cluster_num;
  return c_class;
}
const GtFeatureIndexClass* gt_feature_index_class_new(size_t size,
                                         GtFeatureIndexAddRegionNodeFunc
                                                 add_region_node,
                                         GtFeatureIndexAddFeatureNodeFunc
                                                 add_feature_node,
                                         GtFeatureIndexRemoveNodeFunc
                                                 remove_node,
                                         GtFeatureIndexGetFeatsForSeqidFunc
                                                 get_features_for_seqid,
                                         GtFeatureIndexGetFeatsForRangeFunc
                                                 get_features_for_range,
                                         GtFeatureIndexGetFirstSeqidFunc
                                                 get_first_seqid,
                                         GtFeatureIndexSaveFunc
                                                 save_func,
                                         GtFeatureIndexGetSeqidsFunc
                                                 get_seqids,
                                         GtFeatureIndexGetRangeForSeqidFunc
                                                 get_range_for_seqid,
                                         GtFeatureIndexGetOrigRangeForSeqidFunc
                                                 get_orig_range_for_seqid,
                                         GtFeatureIndexHasSeqidFunc
                                                 has_seqid,
                                         GtFeatureIndexFreeFunc
                                                 free)
{
  GtFeatureIndexClass *c_class = gt_class_alloc(sizeof *c_class);
  c_class->size = size;
  c_class->add_region_node = add_region_node;
  c_class->add_feature_node = add_feature_node;
  c_class->remove_node = remove_node;
  c_class->get_features_for_seqid = get_features_for_seqid;
  c_class->get_features_for_range = get_features_for_range;
  c_class->get_first_seqid = get_first_seqid;
  c_class->save_func = save_func;
  c_class->get_seqids = get_seqids;
  c_class->get_range_for_seqid = get_range_for_seqid;
  c_class->get_orig_range_for_seqid = get_orig_range_for_seqid;
  c_class->has_seqid = has_seqid;
  c_class->free = free;
  return c_class;
}
GtNodeVisitorClass*
gt_node_visitor_class_new(size_t size,
                          GtNodeVisitorFreeFunc free,
                          GtNodeVisitorCommentNodeFunc comment_node,
                          GtNodeVisitorFeatureNodeFunc feature_node,
                          GtNodeVisitorRegionNodeFunc region_node,
                          GtNodeVisitorSequenceNodeFunc sequence_node,
                          GtNodeVisitorEOFNodeFunc eof_node)
{
  GtNodeVisitorClass *c_class;
  gt_assert(size);
  c_class = gt_class_alloc(sizeof *c_class);
  c_class->size = size;
  c_class->free = free;
  c_class->comment_node = comment_node;
  c_class->feature_node = feature_node;
  c_class->region_node = region_node;
  c_class->sequence_node = sequence_node;
  c_class->eof_node = eof_node;
  return c_class;
}
Beispiel #7
0
const GtSeqColClass* gt_seq_col_class_new(size_t size,
                                          GtSeqColFreeFunc free,
                                          GtSeqColEnableMatchDescStartFunc
                                                        enable_match_desc_start,
                                          GtSeqColGrepDescFunc grep_desc,
                                          GtSeqColGrepDescDescFunc
                                                                 grep_desc_desc,
                                          GtSeqColGrepDescMD5Func grep_desc_md5,
                                          GtSeqColGrepDescSeqlenFunc
                                                               grep_desc_seqlen,
                                          GtSeqColMD5ToSeqFunc md5_to_seq,
                                          GtSeqColMD5ToDescFunc md5_to_desc,
                                          GtSeqColMD5ToSeqlenFunc md5_to_seqlen,
                                          GtSeqColNumFilesFunc num_files,
                                          GtSeqColNumSeqsFunc num_seqs,
                                          GtSeqColGetMD5Func get_md5,
                                          GtSeqColGetSeqFunc get_seq,
                                          GtSeqColGetDescFunc get_desc,
                                          GtSeqColGetSeqlenFunc get_seqlen)
{
  GtSeqColClass *c_class = gt_class_alloc(sizeof *c_class);
  c_class->size = size;
  c_class->free = free;
  c_class->enable_match_desc_start = enable_match_desc_start;
  c_class->grep_desc = grep_desc;
  c_class->grep_desc_desc = grep_desc_desc;
  c_class->grep_desc_md5 = grep_desc_md5;
  c_class->grep_desc_seqlen = grep_desc_seqlen;
  c_class->md5_to_desc = md5_to_desc;
  c_class->md5_to_seq = md5_to_seq;
  c_class->md5_to_seqlen = md5_to_seqlen;
  c_class->num_files = num_files;
  c_class->num_seqs = num_seqs;
  c_class->get_md5 = get_md5;
  c_class->get_seq = get_seq;
  c_class->get_desc = get_desc;
  c_class->get_seqlen = get_seqlen;
  return c_class;
}
Beispiel #8
0
const GthSeqConClass* gth_seq_con_class_new(size_t size,
                                            GthSeqConDemandOrigSeqFunc
                                            demand_orig_seq,
                                            GthSeqConGetOrigSeqFunc
                                            get_orig_seq,
                                            GthSeqConGetTranSeqFunc
                                            get_tran_seq,
                                            GthSeqConGetOrigSeqRCFunc
                                            get_orig_seq_rc,
                                            GthSeqConGetTranSeqRCFunc
                                            get_tran_seq_rc,
                                            GthSeqConGetDescriptionFunc
                                            get_description,
                                            GthSeqConEchoDescriptionFunc
                                            echo_description,
                                            GthSeqConNumOfSeqsFunc num_of_seqs,
                                            GthSeqConTotalLengthFunc
                                            total_length,
                                            GthSeqConGetRangeFunc get_range,
                                            GthSeqConGetAlphabetFunc
                                            get_alphabet,
                                            GthSeqConFreeFunc free)
{
  GthSeqConClass *c_class = gt_class_alloc(sizeof *c_class);
  c_class->size = size;
  c_class->demand_orig_seq = demand_orig_seq;
  c_class->get_orig_seq = get_orig_seq;
  c_class->get_tran_seq = get_tran_seq;
  c_class->get_orig_seq_rc = get_orig_seq_rc;
  c_class->get_tran_seq_rc = get_tran_seq_rc;
  c_class->get_description = get_description;
  c_class->echo_description = echo_description;
  c_class->num_of_seqs = num_of_seqs;
  c_class->total_length = total_length;
  c_class->get_range = get_range;
  c_class->get_alphabet = get_alphabet;
  c_class->free = free;
  return c_class;
}
    gt_assert(cstr_iterator->c_class != NULL);
    if (cstr_iterator->c_class->delete_func != NULL)
      cstr_iterator->c_class->delete_func(cstr_iterator);
    gt_free(cstr_iterator);
  }
}

GtCstrIteratorClass *
gt_cstr_iterator_class_new(size_t size,
                           GtCstrIteratorNextFunc next,
                           GtCstrIteratorResetFunc reset,
                           GtCstrIteratorDeleteFunc delete)
{
  GtCstrIteratorClass *cstr_iterator_c;
  gt_assert(size != 0);
  cstr_iterator_c = gt_class_alloc(sizeof (*cstr_iterator_c));
  cstr_iterator_c->size = size;
  cstr_iterator_c->next_func = next;
  cstr_iterator_c->reset_func = reset;
  cstr_iterator_c->delete_func = delete;
  return cstr_iterator_c;
}

GtCstrIterator *
gt_cstr_iterator_create(const GtCstrIteratorClass *cstr_iterator_c)
{
  GtCstrIterator *cstr_iterator;
  gt_assert(cstr_iterator_c && cstr_iterator_c->size);
  cstr_iterator = gt_calloc((size_t) 1, cstr_iterator_c->size);
  cstr_iterator->c_class = cstr_iterator_c;
  return cstr_iterator;