Beispiel #1
0
void prepareGraphForLocalCorrections(Graph * argGraph)
{
	IDnum nodes = nodeCount(argGraph);
	IDnum index;

	//Setting global params
	graph = argGraph;
	WORDLENGTH = getWordLength(graph);;
	// Done with global params

	velvetLog("Preparing to correct graph with cutoff %f\n",
	       MAXDIVERGENCE);

	// Allocating memory
	times = mallocOrExit(2 * nodes + 1, Time);
	previous = mallocOrExit(2 * nodes + 1, Node *);

	dheapNodes = mallocOrExit(2 * nodes + 1, DFibHeapNode *);

	dheap = newDFibHeap();

	fastSequence = newTightString(MAXREADLENGTH);
	slowSequence = newTightString(MAXREADLENGTH);

	for (index = 0; index < (2 * nodeCount(graph) + 1); index++) {
		times[index] = -1;
		dheapNodes[index] = NULL;
		previous[index] = NULL;
	}

	Fmatrix = callocOrExit(MAXREADLENGTH + 1, double *);
	for (index = 0; index < MAXREADLENGTH + 1; index++)
		Fmatrix[index] = callocOrExit(MAXREADLENGTH + 1, double);
	//Done with memory 
}
Beispiel #2
0
static TightString *readPositivePassageMarker(PassageMarkerI marker,
					      TightString ** seqs,
					      int WORDLENGTH)
{
	Coordinate index;
	Nucleotide nucleotide;
	TightString *tString =
	    seqs[getPassageMarkerSequenceID(marker) - 1];
	TightString *res = newTightString(getPassageMarkerLength(marker));

	for (index = 0; index < getLength(tString); index++) {
		nucleotide =
		    getNucleotide(getPassageMarkerStart(marker) + index +
				  WORDLENGTH - 1, tString);
		writeNucleotideAtPosition(nucleotide, index, res);
	}

	return res;
}
Beispiel #3
0
static TightString *readNegativePassageMarker(PassageMarkerI marker,
					      TightString ** seqs)
{
	Coordinate index;
	Nucleotide nucleotide;
	TightString *tString =
	    seqs[getAbsolutePassMarkerSeqID(marker) - 1];
	TightString *res = newTightString(getPassageMarkerLength(marker));

	for (index = 0; index < getPassageMarkerLength(marker); index++) {
		nucleotide =
		    getNucleotide(getPassageMarkerStart(marker) - index,
				  tString);
#ifndef COLOR
		writeNucleotideAtPosition(3 - nucleotide, index, res);
#else
		writeNucleotideAtPosition(nucleotide, index, res);
#endif
	}

	return res;
}