const char *gt_condenseq_description(const GtCondenseq *condenseq,
                                     GtUword *desclen,
                                     GtUword seqnum)
{
  gt_assert(condenseq != NULL);
  gt_assert(condenseq->orig_num_seq != 0);
  gt_assert(seqnum < condenseq->orig_num_seq);
  if (condenseq->id_len == GT_UNDEF_UWORD) {
    GtUword this = gt_intset_get(condenseq->sdstab, seqnum), previous;
    if (seqnum == 0) {
      *desclen = this;
      return condenseq->orig_ids;
    }
    previous = gt_intset_get(condenseq->sdstab, seqnum - 1);
    *desclen =  this - previous;
    return condenseq->orig_ids + previous;
  }
  else {
    const char *id = condenseq->orig_ids + seqnum * condenseq->id_len;
    *desclen = condenseq->id_len;
    while (id[*desclen - 1] == '\0')
      (*desclen)--;
    return condenseq->orig_ids + seqnum * condenseq->id_len;
  }
}
static GtUword condenseq_next_sep(const GtCondenseq *ces, GtUword pos)
{
  GtUword seqidx = gt_condenseq_pos2seqnum(ces, pos);
  if (seqidx < ces->orig_num_seq - 1)
    return gt_intset_get(ces->ssptab, seqidx);
  return 0;
}
GtUword gt_condenseq_seqlength(const GtCondenseq *condenseq, GtUword seqnum)
{
  GtUword start = 0;
  if (seqnum != 0)
    start = gt_intset_get(condenseq->ssptab, seqnum - 1) + 1;
  return condenseq_seqlength_help(condenseq, seqnum, start);
}
Beispiel #4
0
GtUword gt_condenseq_seqstartpos(const GtCondenseq *condenseq, GtUword seqnum)
{
  GtUword ret = 0;
  if (seqnum != 0)
    ret = gt_intset_get(condenseq->ssptab, seqnum - 1) + 1;
  return ret;
}
static inline GtUword condenseq_seqlength_help(const GtCondenseq *condenseq,
                                               GtUword seqnum,
                                               GtUword seqstart)
{
  GtUword end = condenseq->orig_length;
  if (seqnum < condenseq->orig_num_seq - 1)
    end = gt_intset_get(condenseq->ssptab, seqnum);
  return end - seqstart;
}