Пример #1
0
static int gt_csa_runner(GT_UNUSED int argc, const char **argv, int parsed_args,
                         void *tool_arguments, GtError *err)
{
  GtNodeStream *gff3_in_stream, *csa_stream, *gff3_out_stream;
  CSAArguments *arguments = tool_arguments;
  int had_err;

  gt_error_check(err);
  gt_assert(arguments);

  /* create the streams */
  gff3_in_stream  = gt_gff3_in_stream_new_sorted(argv[parsed_args]);
  if (arguments->verbose && arguments->outfp)
    gt_gff3_in_stream_show_progress_bar((GtGFF3InStream*) gff3_in_stream);
  csa_stream      = gt_csa_stream_new(gff3_in_stream, arguments->join_length);
  gff3_out_stream = gt_gff3_out_stream_new(csa_stream, arguments->outfp);

  /* pull the features through the stream and free them afterwards */
  had_err = gt_node_stream_pull(gff3_out_stream, err);

  /* free */
  gt_node_stream_delete(gff3_out_stream);
  gt_node_stream_delete(csa_stream);
  gt_node_stream_delete(gff3_in_stream);

  return had_err;
}
Пример #2
0
static int csa_stream_lua_new(lua_State *L)
{
  GtNodeStream **csa_stream, **in_stream;
  long join_length;
  in_stream = check_genome_stream(L, 1);
  if (lua_gettop(L) >= 2) {
    join_length = luaL_checklong(L, 2);
    luaL_argcheck(L, join_length >= 0, 2, "must be >= 0");
  }
  else
    join_length = GT_DEFAULT_JOIN_LENGTH;
  csa_stream = lua_newuserdata(L, sizeof (GtNodeStream*));
  gt_assert(csa_stream);
  *csa_stream = gt_csa_stream_new(*in_stream, join_length);
  luaL_getmetatable(L, GENOME_STREAM_METATABLE);
  lua_setmetatable(L, -2);
  return 1;
}