本文整理汇总了C++中DeBruijnNode::appendToSequence方法的典型用法代码示例。如果您正苦于以下问题:C++ DeBruijnNode::appendToSequence方法的具体用法?C++ DeBruijnNode::appendToSequence怎么用?C++ DeBruijnNode::appendToSequence使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeBruijnNode
的用法示例。
在下文中一共展示了DeBruijnNode::appendToSequence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildDeBruijnGraphFromFastg
void AssemblyGraph::buildDeBruijnGraphFromFastg(QString fullFileName)
{
m_graphFileType = FASTG;
QFile inputFile(fullFileName);
if (inputFile.open(QIODevice::ReadOnly))
{
std::vector<QString> edgeStartingNodeNames;
std::vector<QString> edgeEndingNodeNames;
DeBruijnNode * node = 0;
QTextStream in(&inputFile);
while (!in.atEnd())
{
QApplication::processEvents();
QString nodeName;
double nodeReadDepth;
QString line = in.readLine();
//If the line starts with a '>', then we are beginning a new node.
if (line.startsWith(">"))
{
line.remove(0, 1); //Remove '>' from start
line.chop(1); //Remove ';' from end
QStringList nodeDetails = line.split(":");
QString thisNode = nodeDetails.at(0);
//A single quote as the last character indicates a negative node.
bool negativeNode = thisNode.at(thisNode.size() - 1) == '\'';
QStringList thisNodeDetails = thisNode.split("_");
if (thisNodeDetails.size() < 6)
throw "load error";
nodeName = thisNodeDetails.at(1);
if (negativeNode)
nodeName += "-";
else
nodeName += "+";
QString nodeReadDepthString = thisNodeDetails.at(5);
if (negativeNode)
{
//It may be necessary to remove a single quote from the end of the read depth
if (nodeReadDepthString.at(nodeReadDepthString.size() - 1) == '\'')
nodeReadDepthString.chop(1);
}
nodeReadDepth = nodeReadDepthString.toDouble();
//Make the node
node = new DeBruijnNode(nodeName, nodeReadDepth, ""); //Sequence string is currently empty - will be added to on subsequent lines of the fastg file
m_deBruijnGraphNodes.insert(nodeName, node);
//The second part of nodeDetails is a comma-delimited list of edge nodes.
//Edges aren't made right now (because the other node might not yet exist),
//so they are saved into vectors and made after all the nodes have been made.
if (nodeDetails.size() == 1)
continue;
QStringList edgeNodes = nodeDetails.at(1).split(",");
for (int i = 0; i < edgeNodes.size(); ++i)
{
QString edgeNode = edgeNodes.at(i);
QChar lastChar = edgeNode.at(edgeNode.size() - 1);
bool negativeNode = false;
if (lastChar == '\'')
{
negativeNode = true;
edgeNode.chop(1);
}
QStringList edgeNodeDetails = edgeNode.split("_");
if (edgeNodeDetails.size() < 2)
throw "load error";
QString edgeNodeName = edgeNodeDetails.at(1);
if (negativeNode)
edgeNodeName += "-";
else
edgeNodeName += "+";
edgeStartingNodeNames.push_back(nodeName);
edgeEndingNodeNames.push_back(edgeNodeName);
}
}
//If the line does not start with a '>', then this line is part of the
//sequence for the last node.
else
{
QByteArray sequenceLine = line.simplified().toLocal8Bit();
if (node != 0)
node->appendToSequence(sequenceLine);
}
}
//.........这里部分代码省略.........