Example #1
0
static Locus *extractConnectedComponents(IDnum locusCount)
{
	Locus *loci = allocateLocusArray(locusCount);
	Locus *locus;
	IDnum index;
	IDnum locusIndex = 0;
	IDnum nodeIndex;
	Node *node;

	resetNodeStatus(graph);

	for (index = 1; index <= nodeCount(graph); index++) {
		node = getNodeInGraph(graph, index);
		if (!getNodeStatus(node) && getUniqueness(node)) {
			locus = getLocus(loci, locusIndex++);
			clearLocus(locus);

			// Long contigs
			fillUpComponent(node);
			setLongContigCount(locus, countMarkedNodes());
			while (existsMarkedNode()) 
				addContig(locus, popNodeRecord());

			// Secondary contigs
			extendComponent(locus);
			setContigCount(locus, getLongContigCount(locus) + countMarkedNodes());
			while (existsMarkedNode())
				addContig(locus, popNodeRecord());

			// Mark primary nodes so that their twins are not reused
			for (nodeIndex = 0;
			     nodeIndex < getLongContigCount(locus);
			     nodeIndex++)
				setNodeStatus(getContig(locus, nodeIndex), true);

			// Unmark secondary nodes so that they are available to other loci
			for (nodeIndex = getLongContigCount(locus);
			     nodeIndex < getContigCount(locus); nodeIndex++)
				setNodeStatus(getContig(locus, nodeIndex), false);
		}
	}

	return loci;
}
Example #2
0
void getFillContig(struct cnFill *fill)
{
struct liftSpec *lift, *prevLift = NULL;
struct hashEl *el;

//uglyf("fill->qName=%s, fill->qStart=%d\n", fill->qName, fill->qStart);
if ((el = hashLookup(chromHash, fill->qName)) == NULL)
    errAbort("Unknown chrom: %s\n", fill->qName);
for (lift = (struct liftSpec *)el->val; lift != NULL; prevLift = lift, lift = lift->next)
    {
    //uglyf("lift->oldName=%s, lift->offset=%d\n", lift->oldName, lift->offset);
    if (fill->qStart < lift->offset)
        {
        addContig(prevLift->oldName);
        break;
        }
    }
    /* last contig */
    addContig(prevLift->oldName);
}
Example #3
0
bool MIQPSolver::addContigs(const DataStore &store)
{
	ContigCount = store.ContigCount;
	len.resize(ContigCount);
	U.resize(ContigCount);
	T.resize(ContigCount);
	X.resize(ContigCount);
	optimized.resize(ContigCount);
	for (int i = 0; i < ContigCount; i++)
		if (!addContig(store[i]))
			return false;
	return true;
}