Пример #1
0
static Gtmaxcoordvalue *evaluateallLScolumns(LinspaceManagement *spacemanager,
                                             GtScoreHandler *scorehandler,
                                             const GtUchar *useq,
                                             GtUword ustart,
                                             GtUword ulen,
                                             const GtUchar *vseq,
                                             GtUword vstart,
                                             GtUword vlen)
{
  GtUword colindex;
  GtWord *Ltabcolumn;
  GtUwordPair *Starttabcolumn;
  Gtmaxcoordvalue *max;

  Ltabcolumn = gt_linspaceManagement_get_valueTabspace(spacemanager);
  Starttabcolumn = gt_linspaceManagement_get_rTabspace(spacemanager);

  firstLStabcolumn(Ltabcolumn, Starttabcolumn, ulen);

  max = gt_linspaceManagement_get_maxspace(spacemanager);
  for (colindex = 1UL; colindex <= vlen; colindex++)
  {
    nextLStabcolumn(Ltabcolumn, Starttabcolumn, scorehandler,
                    useq, ustart, ulen, vseq[vstart+colindex-1], colindex, max);
  }
  return max;
}
Пример #2
0
/* create an local alignment in square space, to use it in linear context you
 * have to generate an spacemanager before, in any other case it can be NULL */
GtWord alignment_in_square_space_local_generic(GtLinspaceManagement
                                               *spacemanager,
                                               GtAlignment *align,
                                               const GtUchar *useq,
                                               GtUword ustart,
                                               GtUword ulen,
                                               const GtUchar *vseq,
                                               GtUword vstart,
                                               GtUword vlen,
                                               const GtScoreHandler
                                               *scorehandler)
{
  GtWord score = 0, **Ltabcolumn;
  GtMaxcoordvalue *max;

  gt_assert(align != NULL);
  if (spacemanager == NULL)
  {
    /*use it in normally case*/
    gt_array2dim_malloc(Ltabcolumn, (ulen+1), (vlen+1));
    max = gt_max_new();
  }
  else
  {
    /*use it in lineraspace context*/
    Ltabcolumn = (GtWord **)
                 gt_linspaceManagement_change_to_square(spacemanager,ulen,vlen);
    max = gt_linspaceManagement_get_maxspace(spacemanager);
  }

  score = fillDPtab_in_square_space_local(Ltabcolumn, max, useq, ustart, ulen,
                                          vseq, vstart, vlen, scorehandler);

  /* reconstruct local alignment from 2dimarray Ltabcolumn */
  reconstructalignment_from_Ltab(align, Ltabcolumn, max,
                                 useq, ustart, ulen,
                                 vseq,vstart,vlen,scorehandler);

  if (gt_max_get_length_safe(max))
  {
    ustart = ustart+(gt_max_get_start(max)).a;
    vstart = vstart+(gt_max_get_start(max)).b;
    ulen = gt_max_get_row_length(max);
    vlen = gt_max_get_col_length(max);

    gt_alignment_set_seqs(align, &useq[ustart], ulen,
                                 &vseq[vstart], vlen);
  }

  if (spacemanager == NULL)
  {
    gt_array2dim_delete(Ltabcolumn);
    gt_max_delete(max);
  }
  return score;
}