コード例 #1
0
static void storeSAincurrentPGL(GtArray *pgls, GtUword currentPGLindex,
                                GthSA *sa)
{
  GtUword leftgenomicexonborder, rightgenomicexonborder;
  GthPGL *currentPGL;

  /* the current PGL index is defined */
  gt_assert(currentPGLindex != GT_UNDEF_UWORD);

  currentPGL = *(GthPGL**) gt_array_get(pgls, currentPGLindex);

  /* update maxrange */
  leftgenomicexonborder  = gth_sa_get_exon(sa, 0)
                           ->leftgenomicexonborder;
  rightgenomicexonborder = gth_sa_get_exon(sa,
                                           gth_sa_num_of_exons(sa)-1)
                           ->rightgenomicexonborder;

  if (leftgenomicexonborder < currentPGL->maxrange.start)
    currentPGL->maxrange.start = leftgenomicexonborder;
  if (rightgenomicexonborder > currentPGL->maxrange.end)
    currentPGL->maxrange.end = rightgenomicexonborder;

  /* save SA */
  gth_pgl_add_sa(currentPGL, sa);
}
コード例 #2
0
ファイル: sa.c プロジェクト: AnnSeidel/genometools
GtUword gth_sa_intron_length(const GthSA *sa, GtUword intron)
{
  Exoninfo *left_exon, *right_exon;
  gt_assert(sa);
  left_exon  = gth_sa_get_exon(sa, intron);
  right_exon = gth_sa_get_exon(sa, intron + 1);
  return right_exon->leftgenomicexonborder - left_exon->rightgenomicexonborder
         - 1;
}
コード例 #3
0
ファイル: gthsadistri.c プロジェクト: oeigenbrod/genometools
static void addSAtointrondistribution(GtDiscDistri *introndistribution,
                                      GthSA *sa)
{
  unsigned long i;

  /* add values to introndistribution */
  for (i = 0; i < gth_sa_num_of_introns(sa); i++) {
    gt_disc_distri_add(introndistribution,
                       gth_sa_get_exon(sa, i+1)
                       ->leftgenomicexonborder -
                       gth_sa_get_exon(sa, i)
                       ->rightgenomicexonborder - 1);
  }
}
コード例 #4
0
static void storeSAinnewPGL(GtArray *pgls, GtUword *currentPGLindex,
                            GthSA *sa)
{
  GthPGL *pgl;

  pgl = gth_pgl_new(gth_sa_gen_strand_forward(sa));
  pgl->maxrange.start = gth_sa_get_exon(sa, 0)->leftgenomicexonborder;
  pgl->maxrange.end = gth_sa_get_exon(sa,gth_sa_num_of_exons(sa)-1)
                      ->rightgenomicexonborder;

  gth_pgl_add_sa(pgl, sa);
  gt_array_add(pgls, pgl);

  /* set the current PGL index */
  *currentPGLindex = gt_array_size(pgls) - 1;
}
コード例 #5
0
ファイル: sa.c プロジェクト: AnnSeidel/genometools
GtUword gth_sa_genomic_exon_length(const GthSA *sa, GtUword exon)
{
  Exoninfo *exoninfo;
  gt_assert(sa);
  exoninfo = gth_sa_get_exon(sa, exon);
  return exoninfo->rightgenomicexonborder - exoninfo->leftgenomicexonborder + 1;
}
コード例 #6
0
ファイル: sa.c プロジェクト: AnnSeidel/genometools
double gth_sa_exon_score(const GthSA *sa, GtUword exon)
{
  Exoninfo *exoninfo;
  gt_assert(sa);
  exoninfo = gth_sa_get_exon(sa, exon);
  return exoninfo->exonscore;
}
コード例 #7
0
ファイル: sa.c プロジェクト: AnnSeidel/genometools
GtUword gth_sa_right_intron_border(const GthSA *sa, GtUword intron)
{
  Exoninfo *exoninfo;
  gt_assert(sa);
  exoninfo = gth_sa_get_exon(sa, intron + 1);
  return SHOWGENPOS(sa->gen_strand_forward,
                    sa->gen_total_length,
                    sa->gen_offset,
                    exoninfo->leftgenomicexonborder - 1);
}
コード例 #8
0
ファイル: gthsadistri.c プロジェクト: oeigenbrod/genometools
static void addSAtoexondistribution(GtDiscDistri *exondistribution,
                                    GthSA *sa)
{
  Exoninfo *exoninfo;
  unsigned long i;

  /* add values to exondistribution */
  for (i = 0; i < gth_sa_num_of_exons(sa); i++) {
    exoninfo = gth_sa_get_exon(sa, i);
    gt_disc_distri_add(exondistribution, exoninfo->rightgenomicexonborder -
                                         exoninfo->leftgenomicexonborder + 1);
  }
}
コード例 #9
0
static void showexons(GthSA *sa, unsigned int indentlevel,
                      GtFile *outfp)
{
  Exoninfo *exoninfo;
  GtUword i;

  for (i = 0; i < gth_sa_num_of_exons(sa); i++) {
    exoninfo = gth_sa_get_exon(sa, i);

    gth_indent(outfp, indentlevel);
    gt_file_xprintf(outfp, "<exoninfo>\n");
    indentlevel++;

    gth_indent(outfp, indentlevel);
    gt_file_xprintf(outfp,
                    "<leftgenomicexonborder>"GT_WU"</leftgenomicexonborder>\n",
                    exoninfo->leftgenomicexonborder);
    gth_indent(outfp, indentlevel);
    gt_file_xprintf(outfp, "<rightgenomicexonborder>"GT_WU
                    "</rightgenomicexonborder>\n",
                    exoninfo->rightgenomicexonborder);
    gth_indent(outfp, indentlevel);
    gt_file_xprintf(outfp, "<leftreferenceexonborder>"GT_WU
                    "</leftreferenceexonborder>\n",
                    exoninfo->leftreferenceexonborder);
    gth_indent(outfp, indentlevel);
    gt_file_xprintf(outfp, "<rightreferenceexonborder>"GT_WU
                    "</rightreferenceexonborder>\n",
                    exoninfo->rightreferenceexonborder);
    gth_indent(outfp, indentlevel);
    gt_file_xprintf(outfp, "<exonscore>%.*f</exonscore>\n", PRECISION,
                    exoninfo->exonscore);

    indentlevel--;
    gth_indent(outfp, indentlevel);
    gt_file_xprintf(outfp, "</exoninfo>\n");
  }
}
コード例 #10
0
ファイル: xml_final_sa_visitor.c プロジェクト: 9beckert/TIR
static void xml_showalignmentheader(GthSA *sa,
                                    unsigned long minintronlength,
                                    unsigned int indentlevel, GtFile *outfp)
{
  unsigned long i, leftreferenceexonborder, rightreferenceexonborder,
                referenceexonlength;
  GthDbl exonscore, donorsitescore, acceptorsitescore;
  GthFlt donorsiteprobability, acceptorsiteprobability;
  Exoninfo *exoninfo;
  Introninfo *introninfo;

  gth_indent(outfp, indentlevel);
  gt_file_xprintf(outfp, "<predicted_gene_structure>\n");
  indentlevel++;
  gth_indent(outfp, indentlevel);
  gt_file_xprintf(outfp, "<exon-intron_info>\n");
  indentlevel++;

  for (i = 0; i < gth_sa_num_of_exons(sa); i++) {
    exoninfo = gth_sa_get_exon(sa, i);
    leftreferenceexonborder  = exoninfo->leftreferenceexonborder;
    rightreferenceexonborder = exoninfo->rightreferenceexonborder;
    referenceexonlength      = rightreferenceexonborder
                               - leftreferenceexonborder + 1;
    exonscore                = exoninfo->exonscore;

    if (i > 0) {
      introninfo = gth_sa_get_intron(sa, i-1);
      donorsiteprobability    = introninfo->donorsiteprobability;
      donorsitescore          = introninfo->donorsitescore;
      acceptorsiteprobability = introninfo->acceptorsiteprobability;
      acceptorsitescore       = introninfo->acceptorsitescore;

      gth_indent(outfp, indentlevel);
      gt_file_xprintf(outfp, "<intron i_serial=\"%lu\">\n",
                      i - 1 + OUTPUTOFFSET);
      indentlevel++;
      gth_indent(outfp, indentlevel);
      gt_file_xprintf(outfp,
                      "<gDNA_intron_boundary i_start=\"%lu\" i_stop=\"%lu\" "
                      "i_length=\"%lu\">\n",
                      gth_sa_left_intron_border(sa, i-1),
                      gth_sa_right_intron_border(sa, i-1),
                      gth_sa_intron_length(sa, i-1));
      indentlevel++;
      gth_indent(outfp, indentlevel);
      gt_file_xprintf(outfp, "<donor d_prob=\"%.3f\"", donorsiteprobability);
      if (gth_sa_alphatype(sa) == DNA_ALPHA)
        gt_file_xprintf(outfp, " d_score=\"%.2f\"", donorsitescore);
      gt_file_xprintf(outfp, "/>\n");
      gth_indent(outfp, indentlevel);
      gt_file_xprintf(outfp, "<acceptor a_prob=\"%.3f\"",
                      acceptorsiteprobability);
      if (gth_sa_alphatype(sa) == DNA_ALPHA)
        gt_file_xprintf(outfp, " a_score=\"%.2f\"", acceptorsitescore);
      gt_file_xprintf(outfp, "/>\n");
      indentlevel--;
      gth_indent(outfp, indentlevel);
      gt_file_xprintf(outfp, "</gDNA_intron_boundary>\n");

      /* if the intron is shorter or equal than the minimal intron length an
         additional tag is shown */
      if (gth_sa_intron_length(sa, i-1) <= minintronlength) {
        gth_indent(outfp, indentlevel);
        gt_file_xprintf(outfp, "<shorter_than_min_intron_len/>\n");
      }

      indentlevel--;
      gth_indent(outfp, indentlevel);
      gt_file_xprintf(outfp, "</intron>\n");
    }

    gth_indent(outfp, indentlevel);
    gt_file_xprintf(outfp, "<exon e_serial=\"%lu\">\n", i + OUTPUTOFFSET);
    indentlevel++;
    gth_indent(outfp, indentlevel);
    gt_file_xprintf(outfp, "<gDNA_exon_boundary g_start=\"%lu\" g_stop="
                    "\"%lu\" g_length=\"%lu\"/>\n",
                    gth_sa_left_genomic_exon_border(sa, i),
                    gth_sa_right_genomic_exon_border(sa, i),
                    gth_sa_genomic_exon_length(sa, i));
    gth_indent(outfp, indentlevel);
    gt_file_xprintf(outfp,
                    "<reference_exon_boundary r_type=\"%s\" r_start=\"%lu\" "
                    "r_stop=\"%lu\" r_length=\"%lu\" r_score=\"%5.3f\"/>\n",
                    gth_sa_alphastring(sa),
                    leftreferenceexonborder  + OUTPUTOFFSET ,
                    rightreferenceexonborder + OUTPUTOFFSET ,
                    referenceexonlength, exonscore);
    indentlevel--;
    gth_indent(outfp, indentlevel);
    gt_file_xprintf(outfp, "</exon>\n");
  }

  indentlevel--;
  gth_indent(outfp, indentlevel);
  gt_file_xprintf(outfp, "</exon-intron_info>\n");

  /* showing PPA line (if an poly-A tail was determined) */
  if (gth_sa_alphatype(sa) == DNA_ALPHA)
    xml_showppaline(sa, indentlevel, outfp);

  /* showing MATCH line */
  xml_showmatchline(sa, indentlevel, outfp);

  /* showing PGS line */
  xml_showpgsline(sa, indentlevel, outfp);
}
コード例 #11
0
static void showalignmentheader(GthSA *sa, bool gs2out, int widthforgenpos,
                                GtUword minintronlength, GtFile *outfp)
{
  GtUword i, leftreferenceexonborder, rightreferenceexonborder,
                referenceexonlength;
  GthDbl exonscore, donorsitescore, acceptorsitescore;
  GthFlt donorsiteprobability, acceptorsiteprobability;
  Exoninfo *exoninfo;
  Introninfo *introninfo;

  gt_file_xprintf(outfp, "Predicted gene structure");
  if (gs2out) {
    gt_file_xprintf(outfp, " (within gDNA segment "GT_WU" to "GT_WU"):\n",
                       gth_sa_gen_dp_start_show(sa),
                       gth_sa_gen_dp_end_show(sa));
  }
  else
    gt_file_xprintf(outfp, ":\n");
  gt_file_xfputc('\n', outfp);

  for (i = 0; i < gth_sa_num_of_exons(sa); i++) {
    exoninfo = gth_sa_get_exon(sa, i);
    leftreferenceexonborder  = exoninfo->leftreferenceexonborder;
    rightreferenceexonborder = exoninfo->rightreferenceexonborder;
    referenceexonlength      = rightreferenceexonborder
                               - leftreferenceexonborder + 1;
    exonscore                = exoninfo->exonscore;

    if (i > 0) {
      introninfo = gth_sa_get_intron(sa, i-1);
      donorsiteprobability    = introninfo->donorsiteprobability;
      donorsitescore          = introninfo->donorsitescore;
      acceptorsiteprobability = introninfo->acceptorsiteprobability;
      acceptorsitescore       = introninfo->acceptorsitescore;

      gt_file_xprintf(outfp, "  Intron %2" GT_WUS " %*" GT_WUS " %*" GT_WUS
                      " (%4" GT_WUS " n); ",
                      i - 1 + OUTPUTOFFSET, widthforgenpos,
                      gth_sa_left_intron_border(sa, i-1), widthforgenpos,
                      gth_sa_right_intron_border(sa, i-1),
                      gth_sa_intron_length(sa, i-1));

      gt_file_xprintf(outfp, "Pd: %5.3f ", donorsiteprobability);
      if (gth_sa_alphatype(sa) == DNA_ALPHA) {
        if (donorsitescore == 0.0)
          gt_file_xprintf(outfp, "(s:    0), ");
        else
          gt_file_xprintf(outfp, "(s: %4.2f), ", donorsitescore);
      }
      else
        gt_file_xprintf(outfp, "  ");
      gt_file_xprintf(outfp, "Pa: %5.3f ", acceptorsiteprobability);
      if (gth_sa_alphatype(sa) == DNA_ALPHA) {
        if (acceptorsitescore == 0.0)
          gt_file_xprintf(outfp, "(s:    0)");
        else
          gt_file_xprintf(outfp, "(s: %4.2f)", acceptorsitescore);
      }
      /* if the intron is shorter or equal than the minimum intron length two
         question marks are shown at the end of the line */
      if (gth_sa_intron_length(sa, i-1) <= minintronlength)
        gt_file_xprintf(outfp, " ??");
      gt_file_xfputc('\n', outfp);
    }

    gt_file_xprintf(outfp,
                    " Exon %2" GT_WUS " %*" GT_WUS " %*" GT_WUS " (%4" GT_WUS
                    " n);  %s %6" GT_WUS " %6" GT_WUS " (%4" GT_WUS " %s); "
                    "score: %5.3f\n", i + OUTPUTOFFSET, widthforgenpos,
                    gth_sa_left_genomic_exon_border(sa, i), widthforgenpos,
                    gth_sa_right_genomic_exon_border(sa, i),
                    gth_sa_genomic_exon_length(sa, i), gth_sa_alphastring(sa),
                    leftreferenceexonborder  + OUTPUTOFFSET,
                    rightreferenceexonborder + OUTPUTOFFSET,
                    referenceexonlength,
                    gth_sa_alphatype(sa) == DNA_ALPHA ? "n" : "aa", exonscore);
  }

  /* showing PPA line (if an poly-A tail was determined) */
  if (gth_sa_alphatype(sa) == DNA_ALPHA)
    showppaline(sa, outfp);
  gt_file_xfputc('\n', outfp);

  /* showing MATCH line */
  showmatchline(sa, outfp);

  /* showing PGS line */
  showpgsline(sa, outfp);
}