Esempio n. 1
0
void gthclusterSAstoPGLs(GtArray *pgls, GthSACollection *sa_collection)
{
  GtUword forwardgen_file_num,   /* the genomic file number of the
                                            current forward cluster */
                forwardmaxright,         /* the maximal right position of the
                                            current forward cluster */
                forward_currentPGLindex, /* the current forward PGL index */
                reversegen_file_num,   /* the genomic file number of the
                                            current reverse cluster */
                reversemaxright,         /* the maximal right position of the
                                            current reverse cluster */
                reverse_currentPGLindex; /* the current reverse PGL index */
  GthSACollectionIterator *iterator;
  GthSA *sa;
  gt_assert(sa_collection);

  /* init */
  forwardgen_file_num   = GT_UNDEF_UWORD;
  forwardmaxright         = GT_UNDEF_UWORD;
  forward_currentPGLindex = GT_UNDEF_UWORD;
  reversegen_file_num   = GT_UNDEF_UWORD;
  reversemaxright         = GT_UNDEF_UWORD;
  reverse_currentPGLindex = GT_UNDEF_UWORD;

  /* cluster the SAs */
  iterator = gth_sa_collection_iterator_new(sa_collection);
  while ((sa = gth_sa_collection_iterator_next(iterator))) {
    if (gth_sa_gen_strand_forward(sa)) {
      saveSAtoPGLs(&forwardgen_file_num, &forwardmaxright,
                   &forward_currentPGLindex, pgls, sa);
    }
    else {
      saveSAtoPGLs(&reversegen_file_num, &reversemaxright,
                   &reverse_currentPGLindex, pgls, sa);
    }
  }
  gth_sa_collection_iterator_delete(iterator);

  /* cluster is consistent */
  gt_assert(cluster_is_consistent(pgls));
}
Esempio n. 2
0
void gthcalcSAdistributions(bool exondistri, bool introndistri,
                            GtDiscDistri *exondistribution,
                            GtDiscDistri *introndistribution,
                            GthSACollection *sa_collection)
{
  GthSACollectionIterator *iterator;
  GthSA *sa;
  gt_assert(sa_collection);

  /* calculate distribution, if necessary */
  if (exondistri || introndistri) {
    iterator = gth_sa_collection_iterator_new(sa_collection);
    while ((sa = gth_sa_collection_iterator_next(iterator))) {
      if (exondistri)
        addSAtoexondistribution(exondistribution, sa);
      if (introndistri)
        addSAtointrondistribution(introndistribution, sa);
    }
    gth_sa_collection_iterator_delete(iterator);
  }
}