本文整理汇总了C++中DNASequence::ReferenceSubstring方法的典型用法代码示例。如果您正苦于以下问题:C++ DNASequence::ReferenceSubstring方法的具体用法?C++ DNASequence::ReferenceSubstring怎么用?C++ DNASequence::ReferenceSubstring使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DNASequence
的用法示例。
在下文中一共展示了DNASequence::ReferenceSubstring方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//Test DNASequence ReferenceSubstring(rhs, pos, substrLength)
TEST_F(DNASequenceTest, ReferenceSubstring) {
DNALength oneLen = 10;
dnaOne.seq = new Nucleotide[oneLen];
dnaOne.length = oneLen;
DNASequence dnaTwo;
dnaTwo.ReferenceSubstring(dnaOne);
EXPECT_EQ(dnaOne.seq, dnaTwo.seq);
EXPECT_EQ(dnaOne.length, dnaTwo.length);
EXPECT_FALSE(dnaTwo.deleteOnExit);
// EXPECT_DEATH_IF_SUPPORTED(dnaTwo.ReferenceSubstring(dnaOne, 100), "");
delete dnaOne.seq;
}
示例2: main
//.........这里部分代码省略.........
ofstream summaryTable(summaryTableFileName.c_str());
ofstream outputFile(outputFileName.c_str());
queryReader.Initialize(queryFileName);
while (queryReader.GetNext(querySequence)) {
int i;
cerr << "searching " << querySequence.title << endl;
if (querySequence.length < maxLength) {
continue;
}
int nMatches = 0;
querySequence.ToUpper();
int localMax;
for (i = 0; i < querySequence.length - maxLength + 1; i++) {
if ((i + 1) % 100000 == 0) {
cerr << "processed: " << i + 1 << endl;
}
int lcpLength;
vector<SAIndex> lcpLeftBounds, lcpRightBounds;
vector<SAIndex> rclcpLeftBounds, rclcpRightBounds;
localMax = maxN;
if (i < prefix) {
localMax = prefixN;
}
if (i >= querySequence.length - suffix) {
localMax = suffixN;
}
if (querySequence.length - i <= maxLength) {
continue;
}
if (querySequence.seq[i] == 'N') {
continue;
}
lcpLength = sarray.StoreLCPBounds(genome.seq, genome.length, // The string which the suffix array is built on.
&querySequence.seq[i], querySequence.length-i,
true,
maxLength,
lcpLeftBounds, lcpRightBounds,
false);
if (lcpLength < minLength) {
continue;
}
if (lcpLength < maxLength or
lcpRightBounds.size() == 0 or
(lcpRightBounds.size() > 0 and
lcpLeftBounds.size() > 0 and
lcpRightBounds[lcpRightBounds.size() - 1] - lcpLeftBounds[lcpLeftBounds.size()-1] <= localMax)) {
FASTASequence rc;
DNASequence subseq;
subseq.ReferenceSubstring(querySequence, i, maxLength);
subseq.MakeRC(rc);
int rclcpLength;
int numForwardMatches;
if (lcpLength == 0) {
numForwardMatches = 0;
}
else {
numForwardMatches = lcpRightBounds[lcpRightBounds.size() - 1] - lcpLeftBounds[lcpLeftBounds.size()-1];
}
rclcpLength = sarray.StoreLCPBounds(genome.seq, genome.length, // The string which the suffix array is built on.
rc.seq, maxLength,
true,
rclcpLength,
rclcpLeftBounds, rclcpRightBounds,
false);
string rcstr((const char*)rc.seq, rc.length);
if (rclcpLength < maxLength or
rclcpRightBounds.size() == 0 or
(numForwardMatches +
rclcpRightBounds[rclcpRightBounds.size() - 1] -
rclcpLeftBounds[rclcpLeftBounds.size()-1] <= localMax))
{
char* substr = new char[maxLength+1];
substr[maxLength] = '\0';
memcpy(substr, &querySequence.seq[i], maxLength);
// string substr = string((const char*) querySequence.seq, i, maxLength);
outputFile << querySequence.title << "\t" << substr << "\t" << i << endl;
++nMatches;
delete[] substr;
// }
}
rc.Free();
}
}
summaryTable << querySequence.title << "\t" << nMatches << endl;
querySequence.Free();
}
outputFile.close();
genome.Free();
}