Пример #1
0
Boolean FcloneNode::processEdge(void){	

	Ptr DEREF;
	long IDvertex;	
	DEREF=v&v->cv;
	IDvertex=v->xGetID(DEREF,IDslot);
	v-v->cv;
	if(IDvertex<IDchild){
		//virgin, edge is maximal
		vClone->e=v->e;
		vClone->V();
		virginCloneVertex(v->cv,vClone->cv);
	}
	else if(IDvertex==IDchild){
		//child, edge is a basis edge
		GLref clone;
		vClone->e=v->e;
		getClone(v->cv,clone);
		vClone->cv=clone;
		vClone->Lnk();
	}
	else if(IDvertex==IDadult){
		if(SameAddr(v->bv,v->cv)){
			if(v->e>0){
				//loop, edge is a basis edge
				vClone->e=v->e;
				vClone->cv=vClone->bv;
				vClone->Lnk();
			}
		}
	}
	else nodeErr(12);
	return(TRUE);
}
Пример #2
0
/** This is a generic routine. It creates a new alignment by making a copy of the old one.
 */
void ImplAlignment::insertCol(
		const Position & from,
		const Position & residues )
{
	debug_func_cerr( 5 );
	if (from >= getColTo()) return;
	Position p = std::max( from, getColFrom());

	const HAlignment copy = getClone();

	AlignmentIterator it     = copy->begin();
	AlignmentIterator it_end = copy->end();

	clear();

	mScore = copy->getScore();

	for (; it != it_end && (*it).mCol < p; ++it)
		addPair( ResiduePair(*it) );

	for (; it != it_end; ++it)
	{
		addPair( ResiduePair(it->mRow, it->mCol+residues, it->mScore) );
	}

	updateBoundaries();
	setChangedLength();
	return;
}
Пример #3
0
Boolean FcloneNode::processVertex(){
	
	Ptr DEREF;
	GLref bvClone,ref;
	childVertices->Pop(ref);
	v->bv=ref;
	Boolean locked;
	if(isNull(v->bv)){
		return finish();
	}
	getClone(v->bv,bvClone);
	vClone->bv=bvClone;
	DEREF=v&v->bv;			
	v->xPutID(DEREF,IDslot,IDadult);
	entryPoint=firstEdge;
	v-v->bv;
	return(TRUE);
}	
Пример #4
0
/** switch row and column in the alignment. Use more efficient implementations in derived classes.
 */
void ImplAlignment::switchRowCol()
{

	debug_func_cerr(5);

	HAlignment copy = getClone();

	AlignmentIterator it     = copy->begin();
	AlignmentIterator it_end = copy->end();

	clear();

	// copy over residue pairs from copy reversing row and column
	for (;it != it_end; ++it)
		addPair( ResiduePair( it->mCol, it->mRow, it->mScore ) );

	setScore( copy->getScore() );
	calculateLength();
	return;
}
Пример #5
0
/** This is a generic routine. It creates a new alignment by making a copy of the old one.
 */
void ImplAlignment::removeRowRegion( Position from, Position to)
{

	const HAlignment copy = getClone();

	AlignmentIterator it     = copy->begin();
	AlignmentIterator it_end = copy->end();

	clear();

	mScore = copy->getScore();

	for (; it != it_end; ++it)
	{
		if ( (*it).mRow < from || (*it).mRow >= to)
			addPair( ResiduePair(*it) );
	}

	updateBoundaries();
	setChangedLength();
	return;
}
Пример #6
0
/** This is a generic routine. It creates a new alignment by making a copy of the old one.
 */
void ImplAlignment::map(
		const HAlignment & other,
		const CombinationMode & mode )
{
	debug_func_cerr(5);

	const HAlignment copy = getClone();

	clear();

	AlignmentIterator it1(copy->begin());
	AlignmentIterator it1_end(copy->end());
	AlignmentIterator it2(other->begin());
	AlignmentIterator it2_end(other->end());

	while ( it1 != it1_end && it2 != it2_end )
	{

		const ResiduePair & x_pair = *it1;
		const ResiduePair & y_pair = *it2;

		Position map1 = NO_POS;
		Position value1 = NO_POS;

		Position map2 = NO_POS;
		Position value2 = NO_POS;

		switch (mode)
		{

		case RR:
			map1 = x_pair.mRow; value2 = x_pair.mCol;
			map2 = y_pair.mRow; value1 = y_pair.mCol;
			break;

		case CR:
			map1 = x_pair.mCol; value1 = x_pair.mRow;
			map2 = y_pair.mRow; value2 = y_pair.mCol;
			break;

		case RC:
			map1 = x_pair.mRow; value2 = x_pair.mCol;
			map2 = y_pair.mCol; value1 = y_pair.mRow;
			break;

		case CC:
			map1 = x_pair.mCol; value1 = x_pair.mRow;
			map2 = y_pair.mCol; value2 = y_pair.mRow;
			break;
		}

		assert( value1 != NO_POS);
		assert( value2 != NO_POS);

		debug_cerr( 5, "map1:" << map1 << " value1:" << value1 << " map2:" << map2 << " value2:" << value2 );

		if (map1 == map2)
		{
			addPair( ResiduePair(value1, value2, 0));
			++it1;
			++it2;
		}
		else
		{
			if (map1 < map2)
				++it1;
			else
				++it2;
		}

	}

	return;
}