当前位置: 首页>>代码示例>>C++>>正文


C++ Pair::insertB方法代码示例

本文整理汇总了C++中Pair::insertB方法的典型用法代码示例。如果您正苦于以下问题:C++ Pair::insertB方法的具体用法?C++ Pair::insertB怎么用?C++ Pair::insertB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pair的用法示例。


在下文中一共展示了Pair::insertB方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

Pair *Smith_Waterman::align( )
{
	// construct the pair object...
	Pair *pair = new Pair( );

	// construct the table...
	vector<vector<int> >grid(first->size( ) + 1, vector<int>(second->size( ), 0));
	unsigned int i;
	unsigned int j;

	// set initial penalty values
	for (i = 0; i < first->size( ); i++)
	{
		grid[i][0] = i * penalty;
	}

	for (j = 0; j < second->size( ); j++)
	{
		grid[0][j] = j * penalty;
	}

	// set initial values according to sub_matrix
	for (i = 1; i < first->size( ); i++)
	{
		for (j = 1; j < second->size( ); j++)
		{
			grid[i][j] = sub->getScore(first->at((i - 1) * sizeof(char)), second->at((j - 1) * sizeof(char)));
		}
	}

	/* print the grid
	for (i = 0; i < first->size( ); i++)
	{
		for (j = 0; j < second->size( ); j++)
		{
			cout << "\t" << grid[i][j];
		}
		cout << endl;
	}
	cout << endl << endl;*/

	// score the table...
	int match = 0;
	int insertion = 0;
	int deletion = 0;

	for (i = 1; i < first->size( ); i++)
	{
		for (j = 1; j < second->size( ); j++)
		{
			match = grid[i - 1][j - 1] + sub->getScore(first->at((i - 1) * sizeof(char)), second->at((j - 1) * sizeof(char)));
			insertion = grid[i][j - 1] + penalty;
			deletion = grid[i - 1][j] + penalty;

			grid[i][j] = max(max(match, insertion), deletion);
			if (grid[i][j] < 0)
			{
				grid[i][j] = 0;
			}
			//				cout << "\nInserting " << grid[i][j] << " into " << i << ", " << j;
		}
	}

	// trace back to find the alignment...
	string out1("");
	string out2("");

	// find highest value
	int highest = 0;
	for (unsigned int iTest = 0; iTest < first->size( ) - 1; iTest++)
	{
		for (unsigned int jTest = 0; jTest < second->size( ) - 1; jTest++)
		{
			if (grid[iTest][jTest] >= highest)
			{
				highest = grid[iTest][jTest];
				i = iTest;
				j = jTest;
			}
		}
	}
	//		i = first->size() - 1;
	//		j = second->size() - 1;
	int score;
	int score_diagonal;
	int score_up;
	int score_left;
	int matches = 0;

	while (i > 0 && j > 0)
	{
		score = grid[i][j];
		score_diagonal = grid[i - 1][j - 1];
		score_up = grid[i][j - 1];
		score_left = grid[i - 1][j];

		if (score == score_diagonal + sub->getScore(first->at((i - 1) * sizeof(char)), second->at((j - 1) * sizeof(char))))
		{
			pair->insertA(first->at((i - 1) * sizeof(char)));
			pair->insertB(second->at((j - 1) * sizeof(char)));
//.........这里部分代码省略.........
开发者ID:matt-morris,项目名称:oosd-bioinformatics,代码行数:101,代码来源:Smith_Waterman.cpp


注:本文中的Pair::insertB方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。