boolean replicateIsComplete(struct sqlConnection *conn, struct replicate *r) /* Return TRUE only if have enough to process replicate. If this returns true * then the head of the bamList will point to a pipeline generated alignment, * and the bigWig/narrow/broad lists will start with files generated from it. */ { // Rule out obviously incomplete ones, missing an expected part. if (r->broadList == NULL || r->narrowList == NULL || r->bigWigList == NULL || r->bamList == NULL) return FALSE; // Now we know all we have all the pieces. Sadly we don't know if they all fit together. // Figure if there is a way that has taken the analysis pipeline the whole way from // bwa->hotspot. // We start with broad peaks because they are relatively rare, only generated by hotspot struct vFile *vf; for (vf = r->broadList; vf != NULL; vf = vf->next) { unsigned runId = vf->eapOutput->runId; struct vFile *parentBam = findParentInList(conn, runId, r->bamList); uglyf(" fileId %u, runId %u, parentBam %p\n", vf->file->id, runId, parentBam); if (parentBam != NULL) { struct vFile *bigWig = findChildInList(conn, runId, r->bigWigList); struct vFile *narrow = findChildInList(conn, runId, r->narrowList); uglyf(" parent->runId %u, bigWig %p, narrow %p\n", runId, bigWig, narrow); if (bigWig != NULL && narrow != NULL) { // We found a compatable way. Move all players to the head of their respective lists. r->bamList = moveToHead(parentBam, r->bamList); r->bigWigList = moveToHead(bigWig, r->bigWigList); r->narrowList = moveToHead(narrow, r->narrowList); r->broadList = moveToHead(vf, r->broadList); return TRUE; } } } return FALSE; }
int get(int key) { /* not found, return -1 exist, return value, move to head */ //map<int, node*>::iterator p = dllist.begin(); // not found if(dllist.find(key) == dllist.end()) { return -1; } else { node *p = dllist[key]; // find the node moveToHead(p); return p->value; } }