本文整理汇总了C++中BlockModel::toSeqAlign方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockModel::toSeqAlign方法的具体用法?C++ BlockModel::toSeqAlign怎么用?C++ BlockModel::toSeqAlign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockModel
的用法示例。
在下文中一共展示了BlockModel::toSeqAlign方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IntersectByMaster
int IntersectByMaster(CCdCore* ccd, double rowFraction) {
int result = -1;
unsigned int masterLen = (ccd) ? ccd->GetSequenceStringByRow(0).length() : 0;
if (masterLen == 0) return result;
int slaveStart;
int nAlignedIBM = 0;
unsigned int i, j, nBlocks;
unsigned int nRows = ccd->GetNumRows();
// If there is already a consistent block model, do nothing.
MultipleAlignment* ma = new MultipleAlignment(ccd);
if (ma && ma->isBlockAligned()) {
delete ma;
return 0;
}
delete ma;
BlockIntersector blockIntersector(masterLen);
BlockModel* intersectedBlockModel;
//BlockModel* simpleIntersectedBlockModel;
BlockModelPair* bmp;
vector<BlockModelPair*> blockModelPairs;
set<int> forcedCTerminiInIntersection;
list< CRef< CSeq_align > >& cdSeqAligns = ccd->GetSeqAligns();
list< CRef< CSeq_align > >::iterator cdSeqAlignIt = cdSeqAligns.begin(), cdSeqAlignEnd = cdSeqAligns.end();
for (i = 0; cdSeqAlignIt != cdSeqAlignEnd; ++cdSeqAlignIt, ++i) {
bmp = new BlockModelPair(*cdSeqAlignIt);
// We assume # of blocks and all block lengths are same on master and slave.
if (bmp && bmp->isValid()) {
blockModelPairs.push_back(bmp);
blockIntersector.addOneAlignment(bmp->getMaster());
// Find places the intersection can't merge blocks (i.e., where there are
// gaps in the slave across a block boundary, but not in the master).
BlockModel& slave = bmp->getSlave();
nBlocks = slave.getBlocks().size();
for (j = 0; j < nBlocks - 1; ++j) { // '-1' as I don't care about end of the C-terminal block
if (slave.getGapToCTerminal(j) > 0 && bmp->getMaster().getGapToCTerminal(j) == 0) {
forcedCTerminiInIntersection.insert(bmp->getMaster().getBlock(j).getEnd());
}
}
}
}
// There was a problem creating one of the BlockModelPair objects from a seq_align,
// or one or more seq_align was invalid.
if (blockModelPairs.size() != cdSeqAligns.size()) {
return result;
}
//simpleIntersectedBlockModel = blockIntersector.getIntersectedAlignment(forcedCTerminiInIntersection);
intersectedBlockModel = blockIntersector.getIntersectedAlignment(forcedCTerminiInIntersection, rowFraction);
nAlignedIBM = (intersectedBlockModel) ? intersectedBlockModel->getTotalBlockLength() : 0;
if (nAlignedIBM == 0) {
return result;
}
/*
string testStr, testStr2;
string sint = intersectedBlockModel->toString();
string sintsimple = simpleIntersectedBlockModel->toString();
delete simpleIntersectedBlockModel;
cout << "rowFraction = 1:\n" << sintsimple << endl;
cout << "rowFraction = " << rowFraction << ":\n" << sint << endl;
*/
// As we have case where every block model isn't identical,
// change each seq-align to reflect the common set of aligned columns.
nBlocks = intersectedBlockModel->getBlocks().size();
for (i = 0, cdSeqAlignIt = cdSeqAligns.begin(); i < nRows - 1 ; ++i, ++cdSeqAlignIt) {
bmp = blockModelPairs[i]; //BlockModelPair seqAlignPair(*cdSeqAlignIt);
BlockModel* intersectedSeqAlignSlave = new BlockModel(bmp->getSlave().getSeqId(), false);
bmp->reverse();
for (j = 0; j < nBlocks; ++j) {
const Block& jthMasterBlock = intersectedBlockModel->getBlock(j);
slaveStart = bmp->mapToMaster(jthMasterBlock.getStart());
// since we're dealing w/ an intersection, slaveStart should always be valid
assert(slaveStart != -1);
Block b(slaveStart, jthMasterBlock.getLen(), jthMasterBlock.getId());
intersectedSeqAlignSlave->addBlock(b);
}
*cdSeqAlignIt = intersectedSeqAlignSlave->toSeqAlign(*intersectedBlockModel);
//testStr = intersectedSeqAlignSlave->toString();
//testStr2 = bmp->getMaster().toString(); // original *slave* alignment
delete bmp;
}
blockModelPairs.clear();
result = nBlocks;
//.........这里部分代码省略.........