GtCodonIterator* gt_codon_iterator_simple_new(const char *seq,
                                              unsigned long length,
                                              GT_UNUSED GtError *err)
{
  GtCodonIteratorSimple *cis;
  GtCodonIterator *ci;
  gt_assert(seq && length >= GT_CODON_LENGTH);
  gt_error_check(err);
  ci = gt_codon_iterator_create(gt_codon_iterator_simple_class());
  cis = gt_codon_iterator_simple_cast(ci);
  cis->dnaseq = seq;
  ci->pvt->length = length;
  ci->pvt->curpos = 0;
  ci->pvt->startpos = 0;
  return ci;
}
Example #2
0
GtCodonIterator* gt_codon_iterator_encseq_new_with_readmode(GtEncseq *encseq,
                                                         unsigned long startpos,
                                                         unsigned long length,
                                                         GtReadmode readmode,
                                                         GT_UNUSED GtError *err)
{
  GtCodonIteratorEncseq *cie;
  GtCodonIterator *ci;
  gt_assert(encseq && startpos + length - 1 < gt_encseq_total_length(encseq));
  gt_error_check(err);
  ci = gt_codon_iterator_create(gt_codon_iterator_encseq_class());
  cie = gt_codon_iterator_encseq_cast(ci);
  cie->encseq = gt_encseq_ref(encseq);
  cie->readmode = readmode;
  ci->pvt->length = length;
  ci->pvt->curpos = 0;
  ci->pvt->startpos = startpos;
  return ci;
}