static void show_spliced_alignment(GthSA *sa, GthInput *input, bool gs2out,
                                   GtUword minintronlength,
                                   GtUword widthforgenpos,
                                   GtUword showintronmaxlen,
                                   GtUword translationtable,
                                   bool showseqnums, GtFile *outfp)
{
  bool wildcardimplosion = false;

  showdelimiterline(outfp);

  if (gs2out) {
    /* all wildcards (N,S,Y,W,R,K,V,B,D,H,M) will be replaced by the wildcard N
       makes only sense for a DNA alphabet */
    wildcardimplosion = true;
    showgs2referenceinformation(sa, outfp);
    gth_sa_echo_reference_sequence(sa, input, true, outfp);
  }
  else {
    showgthreferenceinformation(sa, input, showseqnums, outfp);
    gth_sa_echo_reference_sequence(sa, input, true, outfp);
    showgthgenomicinformation(sa, input, showseqnums, outfp);
  }

  showalignmentheader(sa, gs2out, widthforgenpos, minintronlength, outfp);

  gt_file_xprintf(outfp,
                     "Alignment (genomic DNA sequence = upper lines):\n\n");

  gth_sa_echo_alignment(sa, showintronmaxlen, translationtable,
                        wildcardimplosion, input, outfp);
}
示例#2
0
static void xml_final_show_spliced_alignment(GthSA *sa, GthInput *input,
                                             unsigned long minintronlength,
                                             unsigned long translationtable,
                                             unsigned int indentlevel,
                                             GtFile *outfp)
{
  unsigned char *first_line, *second_line, *third_line;
  GT_UNUSED bool reverse_subject_pos = false;
  unsigned long cols;

  gt_assert(sa && input);

  gth_indent(outfp, indentlevel);
  gt_file_xprintf(outfp,
                  "<spliced_alignment xmlns=\"http://www.genomethreader.org/"
                  "GTH_output/alignment_module/spliced_alignment/\">\n");
  indentlevel++;

  /* If the reverse complement of the genomic DNA is considered, this
     opition is needed for correct output of the genomic sequence positions
     by the function showalignmentgeneric() */
  if (!gth_sa_gen_strand_forward(sa))
    reverse_subject_pos = true;

  xml_showgthreferenceinformation(sa, input, indentlevel, outfp);

  indentlevel++;
  gth_indent(outfp, indentlevel);
  gt_file_xprintf(outfp, "<seq>");
  gth_sa_echo_reference_sequence(sa, input, false, outfp);
  gt_file_xprintf(outfp, "</seq>\n");
  indentlevel--;

  gth_indent(outfp, indentlevel);
  gt_file_xprintf(outfp, "</reference>\n");
  xml_showgthgenomicinformation(sa, input, indentlevel, outfp);

  xml_showalignmentheader(sa, minintronlength, indentlevel, outfp);

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

  /* compute the alignment lines */
  cols = gth_sa_get_alignment_lines(sa, &first_line, &second_line, &third_line,
                                    translationtable, input);

  indentlevel++;
  gth_indent(outfp, indentlevel);
  gt_file_xprintf(outfp, "<genome_strand>");
  showconcreteline(first_line, cols, outfp);
  gt_file_xprintf(outfp, "</genome_strand>\n");
  gth_indent(outfp, indentlevel);
  switch (gth_sa_alphatype(sa)) {
    case DNA_ALPHA:
      gt_file_xprintf(outfp, "<mrna_strand>");
      showconcreteline(second_line, cols, outfp);
      gt_file_xprintf(outfp, "</mrna_strand>\n");
      break;
    case PROTEIN_ALPHA:
      gt_file_xprintf(outfp, "<genomeProt>");
      showconcreteline(second_line, cols, outfp);
      gt_file_xprintf(outfp, "</genomeProt>\n");
      gth_indent(outfp, indentlevel);
      gt_file_xprintf(outfp, "<queryProt>");
      showconcreteline(third_line, cols, outfp);
      gt_file_xprintf(outfp, "</queryProt>\n");

      break;
    default: gt_assert(0);
  }

  indentlevel--;
  gth_indent(outfp, indentlevel);
  gt_file_xprintf(outfp, "</alignment>\n");
  indentlevel--;
  gth_indent(outfp, indentlevel);
  gt_file_xprintf(outfp, "</predicted_gene_structure>\n");
  indentlevel--;
  gth_indent(outfp, indentlevel);
  gt_file_xprintf(outfp, "</spliced_alignment>\n");

  /* free */
  gt_free(first_line);
  gt_free(second_line);
  gt_free(third_line);
}