void PoaGraphImpl::threadFirstRead(std::string sequence, std::vector<Vertex>* outputPath)
{
    // first sequence in the alignment
    VD u = null_vertex, v;
    VD startSpanVertex = null_vertex, endSpanVertex;
    int readPos = 0;

    if (outputPath) {
        outputPath->clear();
    }

    for (const char base : sequence) {
        v = addVertex(base);
        if (outputPath) {
            outputPath->push_back(externalize(v));
        }
        if (readPos == 0) {
            add_edge(enterVertex_, v, g_);
            startSpanVertex = v;
        } else {
            add_edge(u, v, g_);
        }
        u = v;
        readPos++;
    }
    assert(startSpanVertex != null_vertex);
    assert(u != null_vertex);
    endSpanVertex = u;
    add_edge(u, exitVertex_, g_);  // terminus -> $
    tagSpan(startSpanVertex, endSpanVertex);
}
Esempio n. 2
0
File: str.c Progetto: sfrdmn/yrc
static int do_interned_pushv(yrc_str_t* str, const char* data, size_t sz) {
  size_t current;
  int i, j;
  int newsz;
  current = interned_size(str);
  newsz = current + sz;
  if (newsz >= kInternedSize) {
    return externalize(str, data, current, sz);
  }
  str->interned.flag = 1 | (newsz << 1);
  memcpy(str->interned.data, data, sz);
  return 0;
}