예제 #1
0
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
파일: sa.c 프로젝트: AnnSeidel/genometools
void gth_sa_show(GthSA *sa, GthInput *input, GtFile *outfp)
{
  GthSAVisitor *sa_visitor;
  gt_assert(sa && input);
  gth_input_load_genomic_file(input, sa->gen_file_num, false);
  gth_input_load_reference_file(input, sa->ref_file_num, false);
  sa_visitor = gth_txt_sa_visitor_new(input,
                                      GTH_DEFAULT_GS2OUT,
                                      GTH_DEFAULT_DPMININTRONLENGTH,
                                      6, /* XXX */
                                      GTH_DEFAULT_SHOWINTRONMAXLEN,
                                      GTH_DEFAULT_TRANSLATIONTABLE,
                                      GTH_DEFAULT_SHOWSEQNUMS,
                                      outfp);
  gth_sa_visitor_visit_sa(sa_visitor, sa);
  gth_sa_visitor_delete(sa_visitor);
}