コード例 #1
0
ファイル: gt_gthsplit.c プロジェクト: simongog/genometools
static int gthsplit_process_files(Gthsplitinfo *gthsplitinfo,
                                  const GthPlugins *plugins, GtError *err)
{
  Store_in_subset_file_data store_in_subset_file_data;
  GthInput *inputinfo;
  unsigned long i;
  int had_err;

  gt_error_check(err);

  /* initialization */
  inputinfo = gth_input_new(plugins->file_preprocessor, plugins->seq_con_new);
  store_in_subset_file_data.gthsplitinfo           = gthsplitinfo;
  store_in_subset_file_data.num_of_subset_files    = 100 / gthsplitinfo->range;
  store_in_subset_file_data.sa_filter              = gthsplitinfo->sa_filter;
  store_in_subset_file_data.current_outputfilename = NULL;
  store_in_subset_file_data.subset_files =
    gt_malloc(sizeof (GtFile*) *
              store_in_subset_file_data.num_of_subset_files);
  store_in_subset_file_data.subset_filenames =
    gt_malloc(sizeof (GtStr*) *
              store_in_subset_file_data.num_of_subset_files);
  store_in_subset_file_data.subset_file_sa_counter =
    gt_malloc(sizeof (unsigned long) *
              store_in_subset_file_data.num_of_subset_files);
  for (i = 0; i < store_in_subset_file_data.num_of_subset_files; i++) {
    store_in_subset_file_data.subset_files[i]           = NULL;
    store_in_subset_file_data.subset_filenames[i]       = NULL;
    store_in_subset_file_data.subset_file_sa_counter[i] = 0;
  }
  store_in_subset_file_data.sa_visitor = gth_xml_inter_sa_visitor_new(inputinfo,
                                                                      0, NULL);

  if (gthsplitinfo->showverbose)
    gthsplitinfo->showverbose("process all intermediate output files");

  /* split up intermediate files */
  had_err = gth_process_intermediate_files(inputinfo,
                                           gthsplitinfo->consensusfiles,
                                           store_in_subset_file,
                                           &store_in_subset_file_data,
                                           gthsplitinfo->showverbose, err);

  /* close the split files */
  close_output_files(&store_in_subset_file_data);

  /* free */
  gth_sa_visitor_delete(store_in_subset_file_data.sa_visitor);
  gth_input_delete_complete(inputinfo);
  gt_free(store_in_subset_file_data.current_outputfilename);
  gt_free(store_in_subset_file_data.subset_files);
  gt_free(store_in_subset_file_data.subset_filenames);
  gt_free(store_in_subset_file_data.subset_file_sa_counter);

  return had_err;
}
コード例 #2
0
ファイル: intermediate.c プロジェクト: AnnSeidel/genometools
int gth_build_sa_collection(GthSACollection *sa_collection, GthInput *input,
                            GtStrArray *consensusfiles, GthSAFilter *sa_filter,
                            GthStat *stat, GthShowVerbose showverbose,
                            GtError *err)
{
  SACollectionData sa_collection_data;
  gt_error_check(err);
  sa_collection_data.sa_collection = sa_collection;
  sa_collection_data.sa_filter = sa_filter;
  sa_collection_data.stat = stat;

  return gth_process_intermediate_files(input, consensusfiles,
                                        store_in_sa_collection,
                                        &sa_collection_data, showverbose, err);
}