Exemple #1
0
void FindAnchorCols(const MSA &msa, unsigned AnchorCols[],
  unsigned *ptruAnchorColCount)
	{
    MuscleContext *ctx = getMuscleContext();

	const unsigned uColCount = msa.GetColCount();
	if (uColCount < 16)
		{
		*ptruAnchorColCount = 0;
		return;
		}

	SCORE *MatchScore = new SCORE[uColCount];
	SCORE *SmoothScore = new SCORE[uColCount];
	unsigned *BestCols = new unsigned[uColCount];

	GetLetterScores(msa, MatchScore);
	static_WindowSmooth(MatchScore, uColCount, ctx->params.g_uSmoothWindowLength, SmoothScore,
	  ctx->params.g_dSmoothScoreCeil);

	unsigned uBestColCount;
	FindBestColsCombo(msa, MatchScore, SmoothScore, ctx->params.g_dMinBestColScore, ctx->params.g_dMinSmoothScore,
	  BestCols, &uBestColCount);

#if	TRACE
	ListBestCols(msa, MatchScore, SmoothScore, BestCols, uBestColCount);
#endif

	MergeBestCols(MatchScore, BestCols, uBestColCount, ctx->params.g_uAnchorSpacing, AnchorCols,
	  ptruAnchorColCount);

	delete[] MatchScore;
	delete[] SmoothScore;
	delete[] BestCols;
	}
Exemple #2
0
void FindAnchorColsPP(const MSA &msa1, const MSA &msa2, unsigned AnchorCols[],
  unsigned *ptruAnchorColCount)
	{
	const unsigned uColCount = msa1.GetColCount();
	if( uColCount != msa2.GetColCount() )
		{
		*ptruAnchorColCount = 0;
		return;	// the profiles must have equal length to find anchor cols
		}

	SCORE *MatchScore = new SCORE[uColCount];
	SCORE *SmoothScore = new SCORE[uColCount];
	unsigned *BestCols = new unsigned[uColCount];

	LetterObjScoreXP(msa1, msa2, MatchScore);
	g_uSmoothWindowLength.get() = 21;	// this is better for DNA
	g_uAnchorSpacing.get() = 96;
	WindowSmooth(MatchScore, uColCount, g_uSmoothWindowLength.get(), SmoothScore,
	  g_dSmoothScoreCeil.get());


	unsigned uBestColCount;
//	FindBestColsGrade(SmoothScore,uColCount,.85,BestCols,&uBestColCount);
	FindBestColsComboPP(uColCount, MatchScore, SmoothScore, g_dMinBestColScore.get(), g_dMinSmoothScore.get(),
	  BestCols, &uBestColCount);
/*
	std::cerr << "found " << uBestColCount << " anchor cols:\n";
	for( size_t colI = 0; colI < uBestColCount; colI++ )
	{
		if( colI > 0 )
			std::cerr << ", ";
		std::cerr << BestCols[colI];
	}
	std::cerr << std::endl;
*/

#if	TRACE
	ListBestCols(msa, MatchScore, SmoothScore, BestCols, uBestColCount);
#endif

	MergeBestCols(MatchScore, BestCols, uBestColCount, g_uAnchorSpacing.get(), AnchorCols,
	  ptruAnchorColCount);
/*
	std::cerr << "\n\nafter merging, have " << *ptruAnchorColCount << " anchor cols:\n";
	for( size_t colI = 0; colI < *ptruAnchorColCount; colI++ )
	{
		if( colI > 0 )
			std::cerr << ", ";
		std::cerr << AnchorCols[colI];
	}
	std::cerr << std::endl;
*/
	delete[] MatchScore;
	delete[] SmoothScore;
	delete[] BestCols;
	}