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


C++ Alignment::setIdentity方法代码示例

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


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

示例1: traceback


//.........这里部分代码省略.........
		alignment->setScore(cell->getScore());

		int maxlen = s1.length() + s2.length(); // maximum length after the
												// aligned sequences

		//fprintf(stdout, "maxlen = %d \n", maxlen);

		char reversed1[maxlen]; // reversed sequence #1
		char reversed2[maxlen]; // reversed sequence #2
		char reversed3[maxlen]; // reversed markup

		//initialize reversed
		for (int i = 0; i < maxlen; i++) {
			reversed1[i] = '\0';
			reversed2[i] = '\0';
			reversed3[i] = '\0';
		}
		int len1 = 0; // length of sequence #1 after alignment
		int len2 = 0; // length of sequence #2 after alignment
		int len3 = 0; // length of the markup line

		int lenBase1 = 0; //length of sequence1 bases not including gaps
		int lenBase2 = 0; //length of sequence 2 bases not including gaps

		int identity = 0; // count of identitcal pairs
		int similarity = 0; // count of similar pairs
		int gaps = 0; // count of gaps

		char c1, c2;

		int i = cell->getRow(); // traceback start row
		int j = cell->getCol(); // traceback start col
		int k = i * n;

		int stillGoing = 1; // traceback flag: true -> continue & false
								   // -> stop
		//fprintf(stdout, "row = %d, col = %d, k = %d \n", i, j, n);

		while (stillGoing) {
			switch (pointers[k + j]) {
			case UP:
				for (int l = 0, len = sizesOfVerticalGaps[k + j]; l < len; l++) {
					reversed1[len1++] = a1.at(--i);
					reversed2[len2++] = '-';
					reversed3[len3++] = ' ';
					k -= n;
					gaps++;
					lenBase1++;
				}
				break;
			case DIAGONAL:
				c1 = a1.at(--i);
				c2 = a2.at(--j);
				k -= n;
				lenBase1++;
				lenBase2++;
				reversed1[len1++] = c1;
				reversed2[len2++] = c2;
				if (c1 == c2) {
					reversed3[len3++] = '|';
					identity++;
					similarity++;
				} else {
					reversed3[len3++] = '.';
				}
				break;
			case LEFT:
				for (int l = 0, len = sizesOfHorizontalGaps[k + j]; l < len; l++) {
					reversed1[len1++] = '-';
					reversed2[len2++] = a2.at(--j);
					reversed3[len3++] = ' ';
					gaps++;
					lenBase2++;
				}
				break;
			case STOP:
				stillGoing = 0;
			}
		}
		//fprintf(stdout, "finished stillGoing \n");
		//std::cout << "traceback len1 = " << len1 << std::endl;
		//std::cout << "traceback rev1 = " << reversed1 << std::endl;

		//std::cout << "traceback rev1 len = " << strlen(reversed1) << std::endl;
		alignment->setSequence1(reverse(reversed1, len1));
		alignment->setStart1(i);
		alignment->setLengthOfSequence1(lenBase1);
		alignment->setSequence2(reverse(reversed2, len2));
		alignment->setStart2(j);
		alignment->setLengthOfSequence2(lenBase2);
		alignment->setMarkupLine(reverse(reversed3, len3));
		alignment->setIdentity(identity);
		alignment->setGaps(gaps);
		alignment->setSimilarity(similarity);

		//delete[] a1;
		//delete[] a2;

		return alignment;
	}
开发者ID:Brainiarc7,项目名称:TS,代码行数:101,代码来源:SmithWaterman.cpp


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