예제 #1
0
static off_t index_size(const char *prefix, const char *suffix)
{
 off_t size = 0;
 GtStr *index_name = gt_str_new_cstr(prefix);
 gt_str_append_cstr(index_name, suffix);
 if (gt_file_exists(gt_str_get(index_name))) {
   size = gt_file_size(gt_str_get(index_name));
 }
 gt_str_delete(index_name);
 return size;
}
예제 #2
0
off_t gt_file_size_with_suffix(const char *path, const char *suffix)
{
  GtStr *tmpfilename;
  off_t tmpsize;

  gt_assert(path && suffix);

  tmpfilename = gt_str_new_cstr(path);
  gt_str_append_cstr(tmpfilename, suffix);
  tmpsize = gt_file_size(gt_str_get(tmpfilename));
  gt_str_delete(tmpfilename);
  return tmpsize;
}
예제 #3
0
static void show_encoded_statistics(GtStrArray *infiles, const char *indexname)
{
  int i;
  off_t orig_size = 0, enc_size = 0;
  const char *seqfile;
  gt_assert(infiles);
  for (i=0; i < gt_str_array_size(infiles);i ++) {
    seqfile = gt_str_array_get(infiles, i);
    orig_size += gt_file_size(seqfile);
  }
  enc_size += index_size(indexname, GT_ALPHABETFILESUFFIX);
  enc_size += index_size(indexname, GT_ENCSEQFILESUFFIX);
  enc_size += index_size(indexname, GT_SSPTABFILESUFFIX);
  enc_size += index_size(indexname, GT_DESTABFILESUFFIX);
  enc_size += index_size(indexname, GT_SDSTABFILESUFFIX);
  enc_size += index_size(indexname, GT_OISTABFILESUFFIX);
  printf("encoded sequence file(s) are %.1f%% of original file size\n",
         ((double) enc_size / orig_size) * 100.0);
}