本文整理汇总了C++中AlignmentConstPtr类的典型用法代码示例。如果您正苦于以下问题:C++ AlignmentConstPtr类的具体用法?C++ AlignmentConstPtr怎么用?C++ AlignmentConstPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AlignmentConstPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyFromTopAlignment
void copyFromTopAlignment(AlignmentConstPtr topAlignment,
AlignmentPtr mainAlignment, const string &genomeName)
{
Genome *mainReplacedGenome = mainAlignment->openGenome(genomeName);
const Genome *topReplacedGenome = topAlignment->openGenome(genomeName);
topReplacedGenome->copyTopDimensions(mainReplacedGenome);
topReplacedGenome->copyTopSegments(mainReplacedGenome);
mainReplacedGenome->fixParseInfo();
// Copy bot segments for the parent and top segments for the
// siblings of the genome that's being replaced
Genome *mainParent = mainReplacedGenome->getParent();
const Genome *topParent = topReplacedGenome->getParent();
topParent->copyBottomDimensions(mainParent);
topParent->copyBottomSegments(mainParent);
mainParent->fixParseInfo();
vector<string> siblings = mainAlignment->getChildNames(mainParent->getName());
for (size_t i = 0; i < siblings.size(); i++)
{
if (siblings[i] != genomeName)
{
Genome *mainChild = mainAlignment->openGenome(siblings[i]);
const Genome *topChild = topAlignment->openGenome(siblings[i]);
topChild->copyTopDimensions(mainChild);
topChild->copyTopSegments(mainChild);
mainChild->fixParseInfo();
}
}
}
示例2: testTopSegment
void MappedSegmentMapAcrossTest::testTopSegment(AlignmentConstPtr alignment,
TopSegmentIteratorConstPtr top)
{
const Genome* parent = top->getGenome()->getParent();
const Genome* other = top->getGenome()->getName() == "child1" ?
alignment->openGenome("child2") : alignment->openGenome("child1");
set<MappedSegmentConstPtr> results;
top->getMappedSegments(results, other, NULL, false);
CuAssertTrue(_testCase, results.size() == 1);
MappedSegmentConstPtr mseg = *results.begin();
CuAssertTrue(_testCase, mseg->getSource()->getGenome() == top->getGenome());
CuAssertTrue(_testCase, mseg->getSource()->getStartPosition() ==
top->getStartPosition());
CuAssertTrue(_testCase,
mseg->getSource()->getLength() == top->getLength());
CuAssertTrue(_testCase,
mseg->getSource()->getReversed() == top->getReversed());
BottomSegmentIteratorConstPtr bottom = parent->getBottomSegmentIterator();
bottom->toParent(top);
TopSegmentIteratorConstPtr sister = other->getTopSegmentIterator();
sister->toChildG(bottom, other);
CuAssertTrue(_testCase, mseg->getGenome() == sister->getGenome());
CuAssertTrue(_testCase,
mseg->getStartPosition() == sister->getStartPosition());
CuAssertTrue(_testCase,
mseg->getLength() == sister->getLength());
CuAssertTrue(_testCase,
mseg->getReversed() == sister->getReversed());
}
示例3: checkCallBack
void TopSegmentIteratorReverseTest::checkCallBack(AlignmentConstPtr alignment)
{
BottomSegmentIteratorConstPtr bi;
TopSegmentIteratorConstPtr ti, ti2;
const Genome* parent1 = alignment->openGenome("parent1");
const Genome* child1 = alignment->openGenome("child1");
ti = child1->getTopSegmentIterator();
bi = parent1->getBottomSegmentIterator();
ti2 = child1->getTopSegmentIterator();
ti2->toChild(bi, 0);
CuAssertTrue(_testCase, ti->getStartPosition() == 0);
CuAssertTrue(_testCase, ti->getLength() == 10);
CuAssertTrue(_testCase, ti->getReversed() == false);
CuAssertTrue(_testCase, ti2->getStartPosition() == 9);
CuAssertTrue(_testCase, ti2->getLength() == 10);
CuAssertTrue(_testCase, ti2->getReversed() == true);
bi->slice(1, 3);
ti2->toChild(bi, 0);
CuAssertTrue(_testCase, bi->getStartPosition() == 1);
CuAssertTrue(_testCase, bi->getLength() == 6);
CuAssertTrue(_testCase, ti2->getStartPosition() == 8);
CuAssertTrue(_testCase, ti2->getLength() == 6);
string buffer;
bi->getString(buffer);
CuAssertTrue(_testCase, buffer == "CCTACG");
ti2->getString(buffer);
CuAssertTrue(_testCase, buffer == "CACGTA");
bi = child1->getBottomSegmentIterator();
CuAssertTrue(_testCase, bi->getReversed() == false);
ti->toParseUp(bi);
CuAssertTrue(_testCase, ti->getStartPosition() == 0);
CuAssertTrue(_testCase, ti->getLength() == 5);
bi->toReverse();
ti->toParseUp(bi);
CuAssertTrue(_testCase, ti->getStartPosition() == 4);
CuAssertTrue(_testCase, ti->getLength() == 5);
bi->toReverse();
CuAssertTrue(_testCase, bi->getReversed() == false);
bi->toRight();
ti->toParseUp(bi);
CuAssertTrue(_testCase, ti->getStartPosition() == 5);
CuAssertTrue(_testCase, ti->getLength() == 5);
bi->toReverse();
ti->toParseUp(bi);
CuAssertTrue(_testCase, ti->getStartPosition() == 9);
CuAssertTrue(_testCase, ti->getLength() == 5);
}
示例4: checkCallBack
void GenomeCreateTest::checkCallBack(AlignmentConstPtr alignment)
{
const Genome* dudGenome = alignment->openGenome("Zebra");
CuAssertTrue(_testCase, dudGenome == NULL);
const Genome* ancGenome = alignment->openGenome("AncGenome");
const MetaData* ancMeta = ancGenome->getMetaData();
CuAssertTrue(_testCase, ancMeta->get("Young") == "Jeezy");
const Genome* leaf1Genome = alignment->openGenome("Leaf1");
const Genome* leaf2Genome = alignment->openGenome("Leaf2");
const Genome* leaf3Genome = alignment->openGenome("Leaf3");
CuAssertTrue(_testCase, ancGenome->getName() == "AncGenome");
CuAssertTrue(_testCase, leaf1Genome->getName() == "Leaf1");
CuAssertTrue(_testCase, leaf2Genome->getName() == "Leaf2");
CuAssertTrue(_testCase, leaf3Genome->getName() == "Leaf3");
CuAssertTrue(_testCase, ancGenome->getSequenceLength() == 1000000);
CuAssertTrue(_testCase, ancGenome->getNumTopSegments() == 5000);
CuAssertTrue(_testCase, ancGenome->getNumBottomSegments() == 700000);
CuAssertTrue(_testCase, leaf1Genome->getSequenceLength() == 1000000);
CuAssertTrue(_testCase, leaf1Genome->getNumTopSegments() == 700000);
CuAssertTrue(_testCase, leaf1Genome->getNumBottomSegments() == 0);
CuAssertTrue(_testCase, leaf2Genome->getSequenceLength() == 2000000);
CuAssertTrue(_testCase, leaf2Genome->getNumTopSegments() == 700000);
CuAssertTrue(_testCase, leaf2Genome->getNumBottomSegments() == 0);
CuAssertTrue(_testCase, leaf3Genome->getSequenceLength() == 3000000);
CuAssertTrue(_testCase, leaf3Genome->getNumTopSegments() == 700000);
CuAssertTrue(_testCase, leaf3Genome->getNumBottomSegments() == 0);
}
示例5: printBranches
static void printBranches(ostream& os, AlignmentConstPtr alignment)
{
const Genome* root = alignment->openGenome(alignment->getRootName());
set<const Genome*> genomes;
getGenomesInSubTree(root, genomes);
genomes.insert(root);
bool first = true;
for (set<const Genome*>::iterator i = genomes.begin(); i != genomes.end();
++i)
{
if ((*i)->getParent() != NULL)
{
if (!first)
{
os << " ";
}
else
{
first = false;
}
os << (*i)->getName();
}
}
os << endl;
}
示例6: checkCallBack
void MappedSegmentColCompareTest::checkCallBack(AlignmentConstPtr alignment)
{
if (alignment->getNumGenomes() == 0)
{
return;
}
validateAlignment(alignment);
set<const Genome*> genomeSet;
hal::getGenomesInSubTree(alignment->openGenome(alignment->getRootName()),
genomeSet);
for (set<const Genome*>::iterator i = genomeSet.begin(); i != genomeSet.end();
++i)
{
const Genome* srcGenome = *i;
for (set<const Genome*>::iterator j = genomeSet.begin();
j != genomeSet.end(); ++j)
{
const Genome* tgtGenome = *j;
if (srcGenome->getSequenceLength() > 0 &&
tgtGenome->getSequenceLength() > 0)
{
_ref = srcGenome;
_tgt = tgtGenome;
createColArray();
createBlockArray();
compareArrays();
}
}
}
}
示例7: printParent
void printParent(ostream& os, AlignmentConstPtr alignment,
const string& genomeName)
{
if (genomeName != alignment->getRootName())
{
os << alignment->getParentName(genomeName) << endl;
}
}
示例8: printBranchLength
void printBranchLength(ostream& os, AlignmentConstPtr alignment,
const string& genomeName)
{
if (genomeName != alignment->getRootName())
{
string parentName = alignment->getParentName(genomeName);
os << alignment->getBranchLength(parentName, genomeName) << endl;
}
}
示例9: printGenomes
void printGenomes(ostream& os, AlignmentConstPtr alignment)
{
const Genome* root = alignment->openGenome(alignment->getRootName());
set<const Genome*> genomes;
getGenomesInSubTree(root, genomes);
genomes.insert(root);
for (set<const Genome*>::iterator i = genomes.begin(); i != genomes.end();
++i)
{
if (i != genomes.begin())
{
os << ",";
}
os << (*i)->getName();
}
os << endl;
}
示例10: printNumSegments
void printNumSegments(ostream& os, AlignmentConstPtr alignment,
const string& genomeName)
{
const Genome* genome = alignment->openGenome(genomeName);
if (genome == NULL)
{
throw hal_exception(string("Genome ") + genomeName + " not found.");
}
os << genome->getNumTopSegments() << " " << genome->getNumBottomSegments()
<< endl;
}
示例11: checkAlignment
void LodManager::checkAlignment(hal_size_t minQuery,
const string& path,
AlignmentConstPtr alignment)
{
if (alignment->getNumGenomes() == 0)
{
stringstream ss;
ss << "No genomes found in base alignment specified in " << path;
throw hal_exception(ss.str());
}
#ifndef NDEBUG
if (minQuery == 0)
{
vector<string> leafNames = alignment->getLeafNamesBelow(
alignment->getRootName());
string name = !leafNames.empty() ? leafNames[0] : alignment->getRootName();
const Genome* genome = alignment->openGenome(name);
bool seqFound = genome->containsDNAArray();
alignment->closeGenome(genome);
if (seqFound == false)
{
stringstream ss;
ss << "HAL file for highest level of detail (0) in " << path
<< "must contain DNA sequence information.";
throw hal_exception(ss.str());
}
}
#endif
}
示例12: printChildren
void printChildren(ostream& os, AlignmentConstPtr alignment,
const string& genomeName)
{
vector<string> children = alignment->getChildNames(genomeName);
for (size_t i = 0; i < children.size(); ++i)
{
os << children[i];
if (i != children.size() - 1)
{
os << " ";
}
}
os << endl;
}
示例13: validateAlignment
void hal::validateAlignment(AlignmentConstPtr alignment)
{
deque<string> bfQueue;
bfQueue.push_back(alignment->getRootName());
while (bfQueue.empty() == false)
{
string name = bfQueue.back();
bfQueue.pop_back();
if (name.empty() == false)
{
const Genome* genome = alignment->openGenome(name);
if (genome == NULL)
{
throw hal_exception("Failure to open genome " + name);
}
validateGenome(genome);
vector<string> childNames = alignment->getChildNames(name);
for (size_t i = 0; i < childNames.size(); ++i)
{
bfQueue.push_front(childNames[i]);
}
}
}
}
示例14: copyFromBottomAlignment
void copyFromBottomAlignment(AlignmentConstPtr bottomAlignment,
AlignmentPtr mainAlignment,
const string &genomeName)
{
// Copy genome & bottom segments for the genome that's being replaced
Genome *mainReplacedGenome = mainAlignment->openGenome(genomeName);
const Genome *botReplacedGenome = bottomAlignment->openGenome(genomeName);
botReplacedGenome->copyDimensions(mainReplacedGenome);
botReplacedGenome->copySequence(mainReplacedGenome);
botReplacedGenome->copyBottomDimensions(mainReplacedGenome);
botReplacedGenome->copyBottomSegments(mainReplacedGenome);
mainReplacedGenome->fixParseInfo();
// Copy top segments for the children
vector<string> children = mainAlignment->getChildNames(genomeName);
for (size_t i = 0; i < children.size(); i++)
{
Genome *mainChild = mainAlignment->openGenome(children[i]);
const Genome *botChild = bottomAlignment->openGenome(children[i]);
botChild->copyTopDimensions(mainChild);
botChild->copyTopSegments(mainChild);
mainChild->fixParseInfo();
}
}
示例15: printBedSequenceStats
void printBedSequenceStats(ostream& os, AlignmentConstPtr alignment,
const string& genomeName)
{
const Genome* genome = alignment->openGenome(genomeName);
if (genome == NULL)
{
throw hal_exception(string("Genome ") + genomeName + " not found.");
}
if (genome->getNumSequences() > 0)
{
SequenceIteratorConstPtr seqIt = genome->getSequenceIterator();
SequenceIteratorConstPtr seqEnd = genome->getSequenceEndIterator();
for (; !seqIt->equals(seqEnd); seqIt->toNext())
{
os << seqIt->getSequence()->getName() << "\t"
<< 0 << "\t"
<< seqIt->getSequence()->getSequenceLength() << "\n";
}
}
os << endl;
}