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; }
static int gthfilestat_process_files(GthFileStatInfo *file_stat_info, const GthPlugins *plugins, GtError *err) { GthSACollection *sa_collection; GthStat *stat; GthInput *input; GthPGLCollection *pgl_collection = NULL; int had_err = 0; gt_error_check(err); /* initialization */ sa_collection = gth_sa_collection_new(GTH_DC_NONE); input = gth_input_new(plugins->file_preprocessor, plugins->seq_con_new); stat = gth_stat_new(); gth_stat_enable_sa_stats(stat); gth_stat_enable_gthfilestat_mode(stat); if (file_stat_info->showverbose) file_stat_info->showverbose("process all intermediate output files"); /* build tree of alignments from intermediate files */ had_err = gth_build_sa_collection(sa_collection, input, file_stat_info->consensusfiles, file_stat_info->sa_filter, stat, file_stat_info->showverbose, err); if (!had_err && gth_sa_collection_contains_sa(sa_collection)) { /* compute PGLs */ pgl_collection = gth_pgl_collection_new(sa_collection, false); /* save statistics for PGLs */ gth_stat_increase_numofPGLs_stored(stat, gth_pgl_collection_size(pgl_collection)); } /* output statistics */ gth_stat_show(stat, false, false, NULL); /* free */ gth_sa_collection_delete(sa_collection); gth_input_delete_complete(input); gth_stat_delete(stat); gth_pgl_collection_delete(pgl_collection); return had_err; }