本文整理汇总了C++中AlignmentConstPtr::getNumGenomes方法的典型用法代码示例。如果您正苦于以下问题:C++ AlignmentConstPtr::getNumGenomes方法的具体用法?C++ AlignmentConstPtr::getNumGenomes怎么用?C++ AlignmentConstPtr::getNumGenomes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlignmentConstPtr
的用法示例。
在下文中一共展示了AlignmentConstPtr::getNumGenomes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
}
}
示例2: 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
}
示例3: main
int main(int argc, char** argv)
{
CLParserPtr optionsParser = initParser();
string halPath;
string srcGenomeName;
string srcBedPath;
string tgtGenomeName;
string tgtBedPath;
bool noDupes;
bool append;
int inBedVersion;
int outBedVersion;
bool keepExtra;
bool outPSL;
bool outPSLWithName;
bool tab;
try
{
optionsParser->parseOptions(argc, argv);
halPath = optionsParser->getArgument<string>("halFile");
srcGenomeName = optionsParser->getArgument<string>("srcGenome");
srcBedPath = optionsParser->getArgument<string>("srcBed");
tgtGenomeName = optionsParser->getArgument<string>("tgtGenome");
tgtBedPath = optionsParser->getArgument<string>("tgtBed");
noDupes = optionsParser->getFlag("noDupes");
append = optionsParser->getFlag("append");
inBedVersion = optionsParser->getOption<int>("inBedVersion");
outBedVersion = optionsParser->getOption<int>("outBedVersion");
keepExtra = optionsParser->getFlag("keepExtra");
outPSL = optionsParser->getFlag("outPSL");
outPSLWithName = optionsParser->getFlag("outPSLWithName");
tab = optionsParser->getFlag("tab");
}
catch(exception& e)
{
cerr << e.what() << endl;
optionsParser->printUsage(cerr);
exit(1);
}
try
{
if (outPSLWithName == true)
{
outPSL = true;
}
if (outPSL == true)
{
outBedVersion = 12;
}
AlignmentConstPtr alignment = openHalAlignmentReadOnly(halPath,
optionsParser);
if (alignment->getNumGenomes() == 0)
{
throw hal_exception("hal alignmenet is empty");
}
const Genome* srcGenome = alignment->openGenome(srcGenomeName);
if (srcGenome == NULL)
{
throw hal_exception(string("srcGenome, ") + srcGenomeName +
", not found in alignment");
}
const Genome* tgtGenome = alignment->openGenome(tgtGenomeName);
if (tgtGenome == NULL)
{
throw hal_exception(string("tgtGenome, ") + tgtGenomeName +
", not found in alignment");
}
ifstream srcBed;
istream* srcBedPtr;
if (srcBedPath == "stdin")
{
srcBedPtr = &cin;
}
else
{
srcBed.open(srcBedPath.c_str());
srcBedPtr = &srcBed;
if (!srcBed)
{
throw hal_exception("Error opening srcBed, " + srcBedPath);
}
}
ios_base::openmode mode = append ? ios::out | ios::app : ios_base::out;
ofstream tgtBed;
ostream* tgtBedPtr;
if (tgtBedPath == "stdout")
{
tgtBedPtr = &cout;
}
else
{
tgtBed.open(tgtBedPath.c_str(), mode);
tgtBedPtr = &tgtBed;
if (!tgtBed)
//.........这里部分代码省略.........
示例4: main
//.........这里部分代码省略.........
if (parentFromGenome != "\"\"") ++optCount;
if (printRoot) ++optCount;
if (nameForBL != "\"\"") ++optCount;
if (numSegmentsGenome != "\"\"") ++optCount;
if (baseCompPair != "\"\"") ++optCount;
if (genomeMetaData != "\"\"") ++optCount;
if (chromSizesFromGenome != "\"\"") ++optCount;
if (percentID != "\"\"") ++optCount;
if (coverage != "\"\"") ++optCount;
if (topSegments != "\"\"") ++optCount;
if (bottomSegments != "\"\"") ++optCount;
if (allCoverage) ++optCount;
if (optCount > 1)
{
throw hal_exception("--genomes, --sequences, --tree, --span, --spanRoot, "
"--branches, --sequenceStats, --children, --parent, "
"--bedSequences, --root, --numSegments, --baseComp, "
"--genomeMetaData, --chromSizes, --percentID, "
"--coverage, --topSegments, --bottomSegments, "
"--allCoverage "
"and --branchLength options are exclusive");
}
}
catch(exception& e)
{
cerr << e.what() << endl;
optionsParser->printUsage(cerr);
exit(1);
}
try
{
AlignmentConstPtr alignment = openHalAlignmentReadOnly(path, optionsParser);
if (listGenomes == true && alignment->getNumGenomes() > 0)
{
printGenomes(cout, alignment);
}
else if (sequencesFromGenome != "\"\"")
{
printSequences(cout, alignment, sequencesFromGenome);
}
else if (tree == true)
{
cout << alignment->getNewickTree() << endl;
}
else if (sequenceStatsFromGenome != "\"\"")
{
printSequenceStats(cout, alignment, sequenceStatsFromGenome);
}
else if (bedSequencesFromGenome != "\"\"")
{
printBedSequenceStats(cout, alignment, bedSequencesFromGenome);
}
else if (spanGenomes != "\"\"")
{
printBranchPath(cout, alignment, chopString(spanGenomes, ","), false);
}
else if (spanRootGenomes != "\"\"")
{
printBranchPath(cout, alignment, chopString(spanRootGenomes, ","), true);
}
else if (branches == true)
{
printBranches(cout, alignment);
}
else if (childrenFromGenome != "\"\"")
示例5: main
int main(int argc, char** argv)
{
CLParserPtr optionsParser = hdf5CLParserInstance();
optionsParser->setDescription("Rertrieve basic statics from a hal database");
optionsParser->addArgument("halFile", "path to hal file to analyze");
optionsParser->addOptionFlag("genomes", "print only a list of genomes "
"in alignment", false);
optionsParser->addOption("sequences", "print list of sequences in given "
"genome", "\"\"");
optionsParser->addOption("sequenceStats", "print stats for each sequence in "
"given genome", "\"\"");
optionsParser->addOptionFlag("tree", "print only the NEWICK tree", false);
optionsParser->addOptionFlag("branches", "print list of branches. "
"Each branch is specified by the child genome",
false);
optionsParser->addOption("span", "print branches on path (or spanning tree) "
"between comma "
"separated list of genomes", "\"\"");
optionsParser->addOption("spanRoot", "print genomes on path"
"(or spanning tree) between comma "
"separated list of genomes. Different from --path"
"only in that the spanning tree root is also "
"given", "\"\"");
string path;
bool listGenomes;
string sequencesFromGenome;
string sequenceStatsFromGenome;
string spanGenomes;
string spanRootGenomes;
bool tree;
bool branches;
try
{
optionsParser->parseOptions(argc, argv);
path = optionsParser->getArgument<string>("halFile");
listGenomes = optionsParser->getFlag("genomes");
sequencesFromGenome = optionsParser->getOption<string>("sequences");
sequenceStatsFromGenome = optionsParser->getOption<string>("sequenceStats");
tree = optionsParser->getFlag("tree");
spanGenomes = optionsParser->getOption<string>("span");
spanRootGenomes = optionsParser->getOption<string>("spanRoot");
branches = optionsParser->getFlag("branches");
size_t optCount = listGenomes == true ? 1 : 0;
if (sequencesFromGenome != "\"\"") ++optCount;
if (tree == true) ++optCount;
if (sequenceStatsFromGenome != "\"\"") ++optCount;
if (spanGenomes != "\"\"") ++optCount;
if (spanRootGenomes != "\"\"") ++optCount;
if (branches) ++optCount;
if (optCount > 1)
{
throw hal_exception("--genomes, --sequences, --tree, --span, "
"--spanRoot, --branches "
"and --sequenceStats "
"options are mutually exclusive");
}
}
catch(exception& e)
{
cerr << e.what() << endl;
optionsParser->printUsage(cerr);
exit(1);
}
try
{
AlignmentConstPtr alignment = openHalAlignmentReadOnly(path, optionsParser);
if (listGenomes == true && alignment->getNumGenomes() > 0)
{
printGenomes(cout, alignment);
}
else if (sequencesFromGenome != "\"\"")
{
printSequences(cout, alignment, sequencesFromGenome);
}
else if (tree == true)
{
cout << alignment->getNewickTree() << endl;
}
else if (sequenceStatsFromGenome != "\"\"")
{
printSequenceStats(cout, alignment, sequenceStatsFromGenome);
}
else if (spanGenomes != "\"\"")
{
printBranchPath(cout, alignment, chopString(spanGenomes, ","), false);
}
else if (spanRootGenomes != "\"\"")
{
printBranchPath(cout, alignment, chopString(spanRootGenomes, ","), true);
}
else if (branches == true)
{
printBranches(cout, alignment);
}
else
{
HalStats halStats(alignment);
//.........这里部分代码省略.........