コード例 #1
0
ファイル: bioseq.c プロジェクト: ggonnella/genometools
void gt_bioseq_show_seqlengthdistri(GtBioseq *bs, GtFile *outfp)
{
  GtDiscDistri *d;
  GtUword i;
  gt_assert(bs);
  d = gt_disc_distri_new();
  for (i = 0; i < gt_bioseq_number_of_sequences(bs); i++)
    gt_disc_distri_add(d, gt_bioseq_get_sequence_length(bs, i));
  gt_file_xprintf(outfp, "sequence length distribution:\n");
  gt_disc_distri_show(d, outfp);
  gt_disc_distri_delete(d);
}
コード例 #2
0
ファイル: sfx-lcpvalues.c プロジェクト: kowsky/genometools
void gt_Outlcpinfo_delete(GtOutlcpinfo *outlcpinfo)
{
  if (outlcpinfo == NULL)
  {
    return;
  }
  gt_turningwheel_delete(outlcpinfo->turnwheel);
  if (outlcpinfo->lcpsubtab.lcp2file != NULL)
  {
    if (!outlcpinfo->swallow_tail_lcpvalues &&
        outlcpinfo->lcpsubtab.lcp2file->countoutputlcpvalues <
        outlcpinfo->numsuffixes2output)
    {
      outlcpinfo->lcpsubtab.lcp2file->countoutputlcpvalues
        += outmany0lcpvalues(outlcpinfo->numsuffixes2output -
                             outlcpinfo->lcpsubtab.lcp2file
                                                  ->countoutputlcpvalues,
                             outlcpinfo->lcpsubtab.lcp2file->outfplcptab);
    }
    gt_assert(outlcpinfo->swallow_tail_lcpvalues ||
              outlcpinfo->lcpsubtab.lcp2file->countoutputlcpvalues ==
              outlcpinfo->numsuffixes2output);
    GT_FREEARRAY(&outlcpinfo->lcpsubtab.lcp2file->largelcpvalues,
                 Largelcpvalue);
    gt_fa_fclose(outlcpinfo->lcpsubtab.lcp2file->outfplcptab);
    gt_fa_fclose(outlcpinfo->lcpsubtab.lcp2file->outfpllvtab);
    gt_free(outlcpinfo->lcpsubtab.lcp2file->reservoir);
    outlcpinfo->lcpsubtab.lcp2file->smalllcpvalues = NULL;
    outlcpinfo->lcpsubtab.lcp2file->reservoir = NULL;
    outlcpinfo->lcpsubtab.lcp2file->sizereservoir = 0;
    gt_free(outlcpinfo->lcpsubtab.lcp2file);
  } else
  {
    gt_free(outlcpinfo->lcpsubtab.tableoflcpvalues.bucketoflcpvalues);
#ifndef NDEBUG
    gt_free(outlcpinfo->lcpsubtab.tableoflcpvalues.isset);
#endif
  }
  gt_free(outlcpinfo->lcpsubtab.lcpprocess);
  outlcpinfo->lcpsubtab.tableoflcpvalues.bucketoflcpvalues = NULL;
#ifndef NDEBUG
  outlcpinfo->lcpsubtab.tableoflcpvalues.isset = NULL;
#endif
  outlcpinfo->lcpsubtab.tableoflcpvalues.numofentries = 0;
  if (outlcpinfo->lcpsubtab.distlcpvalues != NULL)
  {
    gt_disc_distri_show(outlcpinfo->lcpsubtab.distlcpvalues,NULL);
    gt_disc_distri_delete(outlcpinfo->lcpsubtab.distlcpvalues);
  }
  gt_free(outlcpinfo);
}
コード例 #3
0
ファイル: stat.c プロジェクト: 9beckert/TIR
void gth_stat_show(GthStat *stat, bool show_full_stats, bool xmlout,
                   GtFile *outfp)
{
  char *timestring;

  gt_assert(stat);

  /* begin XML comment */
  if (xmlout)
    gt_file_xprintf(outfp, "<!--\n");

  /* output exon length distribution */
  if (stat->exondistri) {
    gt_file_xprintf(outfp, "%c length distribution of all exons:\n",
                    COMMENTCHAR);
    gt_disc_distri_show(stat->exondistribution, outfp);
  }

  /* output intron length distribution */
  if (stat->introndistri) {
    if (stat->exondistri)
      gt_file_xprintf(outfp, "%c\n", COMMENTCHAR);
    gt_file_xprintf(outfp, "%c length distribution of all introns:\n",
                    COMMENTCHAR);
    gt_disc_distri_show(stat->introndistribution, outfp);
  }

  /* output match number distribution */
  if (stat->matchnumdistri) {
    if (stat->exondistri || stat->introndistri)
      gt_file_xprintf(outfp, "%c\n", COMMENTCHAR);
    gt_file_xprintf(outfp, "%c distribution of match numbers (per genomic "
                    "file, per reference sequence:\n", COMMENTCHAR);
    gt_disc_distri_show(stat->matchnumdistribution, outfp);
  }

  /* output reference sequence coverage distribution */
  if (stat->refseqcovdistri) {
    if (stat->exondistri || stat->introndistri || stat->matchnumdistri)
      gt_file_xprintf(outfp, "%c\n", COMMENTCHAR);
    gt_file_xprintf(outfp, "%c reference sequence coverage distribution (of "
                    "global chains):\n", COMMENTCHAR);
    gt_disc_distri_show(stat->refseqcoveragedistribution, outfp);
  }

  /* output spliced alignment statistics */
  if (stat->sa_stats) {
    if (stat->exondistri     || stat->introndistri ||
        stat->matchnumdistri || stat->refseqcovdistri) {
      gt_file_xprintf(outfp, "%c\n", COMMENTCHAR);
    }
    INFOCHAR;
    gt_file_xprintf(outfp,
                       "spliced alignment alignment score distribution:\n");
    gt_disc_distri_show(stat->sa_alignment_score_distribution, outfp);
    INFOCHAR;
    gt_file_xfputc('\n', outfp);
    INFOCHAR;
    gt_file_xprintf(outfp, "spliced alignment coverage distribution:\n");
    gt_disc_distri_show(stat->sa_coverage_distribution, outfp);
  }

  /* output general statistics */
  outputgeneralstatistics(stat, show_full_stats, outfp);
  INFOCHAR;
  gt_file_xfputc('\n', outfp);

  /* output the memory statistics */
  outputmemorystatistics(stat, show_full_stats, outfp);

  /* output time */
  INFOCHAR;
  gt_file_xfputc('\n', outfp);
  INFOCHAR;
  timestring = gth_get_time();
  gt_file_xprintf(outfp, "date finished: %s\n", timestring);
  gt_free(timestring);

  /* output important messages */
  if (stat->numofremovedzerobaseexons         ||
      stat->numofautointroncutoutcalls        ||
      stat->numofunsuccessfulintroncutoutDPs  ||
      stat->numoffailedDPparameterallocations ||
      stat->numoffailedmatrixallocations      ||
      stat->numofundeterminedSAs              ||
      stat->numoffilteredpolyAtailmatches) {
    gt_file_xprintf(outfp, "%c\n", COMMENTCHAR);
    gt_file_xprintf(outfp, "%c important messages:\n", COMMENTCHAR);
    if (stat->numofremovedzerobaseexons > 0) {
      gt_file_xprintf(outfp, "%c %lu removed zero base exons\n",
                         COMMENTCHAR, stat->numofremovedzerobaseexons);
    }
    if (stat->numofautointroncutoutcalls > 0) {
      gt_file_xprintf(outfp, "%c %lu times the intron cutout technique was "
                         "used automatically\n", COMMENTCHAR,
                         stat->numofautointroncutoutcalls);
    }
    if (stat->numofunsuccessfulintroncutoutDPs > 0) {
      gt_file_xprintf(outfp, "%c %lu unsuccessful DP calls using intron "
                         "cutout technique\n", COMMENTCHAR,
                         stat->numofunsuccessfulintroncutoutDPs);
    }
    if (stat->numoffailedDPparameterallocations > 0) {
      gt_file_xprintf(outfp, "%c %lu DP parameter allocations failed\n",
                         COMMENTCHAR, stat->numoffailedDPparameterallocations);
    }
    if (stat->numoffailedmatrixallocations > 0) {
      gt_file_xprintf(outfp, "%c %lu matrix allocations failed\n",
                         COMMENTCHAR, stat->numoffailedmatrixallocations);
    }
    if (stat->numofundeterminedSAs > 0) {
      gt_file_xprintf(outfp, "%c %lu undetermined spliced alignments\n",
                         COMMENTCHAR, stat->numofundeterminedSAs);
    }
    if (stat->numoffilteredpolyAtailmatches > 0) {
      gt_file_xprintf(outfp,
                      "%c %lu matches containing a poly(A) tail filtered\n",
                         COMMENTCHAR, stat->numoffilteredpolyAtailmatches);
    }
  }

  /* end XML comment */
  if (xmlout)
    gt_file_xprintf(outfp, "-->\n");
}
コード例 #4
0
ファイル: stat_visitor.c プロジェクト: 9beckert/TIR
void gt_stat_visitor_show_stats(GtNodeVisitor *nv, GtFile *outfp)
{
    GtStatVisitor *sv = stat_visitor_cast(nv);
    if (sv->number_of_sequence_regions) {
        gt_file_xprintf(outfp, "sequence regions: %lu (total length: %llu)\n",
                        sv->number_of_sequence_regions,
                        sv->total_length_of_sequence_regions);
    }
    if (sv->number_of_multi_features) {
        gt_file_xprintf(outfp, "multi-features: %lu\n",
                        sv->number_of_multi_features);
    }
    if (sv->number_of_genes)
        gt_file_xprintf(outfp, "genes: %lu\n", sv->number_of_genes);
    if (sv->number_of_protein_coding_genes) {
        gt_file_xprintf(outfp, "protein-coding genes: %lu\n",
                        sv->number_of_protein_coding_genes);
    }
    if (sv->number_of_mRNAs)
        gt_file_xprintf(outfp, "mRNAs: %lu\n", sv->number_of_mRNAs);
    if (sv->number_of_protein_coding_mRNAs) {
        gt_file_xprintf(outfp, "protein-coding mRNAs: %lu\n",
                        sv->number_of_protein_coding_mRNAs);
    }
    if (sv->number_of_exons)
        gt_file_xprintf(outfp, "exons: %lu\n", sv->number_of_exons);
    if (sv->number_of_CDSs)
        gt_file_xprintf(outfp, "CDSs: %lu\n", sv->number_of_CDSs);
    if (sv->number_of_LTR_retrotransposons) {
        gt_file_xprintf(outfp, "LTR_retrotransposons: %lu\n",
                        sv->number_of_LTR_retrotransposons);
    }
    if (sv->gene_length_distribution) {
        gt_file_xprintf(outfp, "gene length distribution:\n");
        gt_disc_distri_show(sv->gene_length_distribution, outfp);
    }
    if (sv->gene_score_distribution) {
        gt_file_xprintf(outfp, "gene score distribution:\n");
        gt_disc_distri_show(sv->gene_score_distribution, outfp);
    }
    if (sv->exon_length_distribution) {
        gt_file_xprintf(outfp, "exon length distribution:\n");
        gt_disc_distri_show(sv->exon_length_distribution, outfp);
    }
    if (sv->exon_number_distribution) {
        gt_file_xprintf(outfp, "exon number distribution:\n");
        gt_disc_distri_show(sv->exon_number_distribution, outfp);
    }
    if (sv->intron_length_distribution) {
        gt_file_xprintf(outfp, "intron length distribution:\n");
        gt_disc_distri_show(sv->intron_length_distribution, outfp);
    }
    if (sv->cds_length_distribution) {
        gt_file_xprintf(outfp, "CDS length distribution:\n");
        gt_disc_distri_show(sv->cds_length_distribution, outfp);
    }
    if (sv->used_sources) {
        GtStrArray *sources;
        unsigned long i;
        gt_file_xprintf(outfp, "used source tags:\n");
        sources = gt_cstr_table_get_all(sv->used_sources);
        for (i = 0; i < gt_str_array_size(sources); i++)
            gt_file_xprintf(outfp, "%s\n", gt_str_array_get(sources, i));
        gt_str_array_delete(sources);
    }
}