int gt_region_mapping_get_raw_sequence(GtRegionMapping *rm, const char **raw,
                                       GtStr *seqid, GtError *err)
{
  int had_err = 0;
  gt_error_check(err);
  gt_assert(rm && seqid);
  had_err = update_bioseq_if_necessary(rm, seqid, err);
  if (!had_err)
    *raw = gt_bioseq_get_raw_sequence(rm->bioseq);
  return had_err;
}
Exemple #2
0
static int extractseq_pos(GtFile *outfp, GtBioseq *bs,
                          unsigned long frompos, unsigned long topos,
                          unsigned long width, GtError *err)
{
  int had_err = 0;
  gt_error_check(err);
  gt_assert(bs);
  if (topos > gt_bioseq_get_raw_sequence_length(bs)) {
    gt_error_set(err,
              "argument %lu to option '-%s' is larger than sequence length %lu",
              topos, TOPOS_OPTION_STR, gt_bioseq_get_raw_sequence_length(bs));
    had_err = -1;
  }
  if (!had_err) {
    gt_fasta_show_entry(NULL, gt_bioseq_get_raw_sequence(bs) + frompos - 1,
                        topos - frompos + 1, width, outfp);
  }
  return had_err;
}