本文整理汇总了C++中IntervalTree::add方法的典型用法代码示例。如果您正苦于以下问题:C++ IntervalTree::add方法的具体用法?C++ IntervalTree::add怎么用?C++ IntervalTree::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntervalTree
的用法示例。
在下文中一共展示了IntervalTree::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
int VcfMac::execute(int argc, char **argv)
{
String inputVcf = "";
int minAC = -1;
String sampleSubset = "";
String filterList = "";
bool params = false;
IntervalTree<int> regions;
std::vector<int> intersection;
// Read in the parameters.
ParameterList inputParameters;
BEGIN_LONG_PARAMETERS(longParameterList)
LONG_PARAMETER_GROUP("Required Parameters")
LONG_STRINGPARAMETER("in", &inputVcf)
LONG_PARAMETER_GROUP("Optional Parameters")
LONG_STRINGPARAMETER("sampleSubset", &sampleSubset)
LONG_INTPARAMETER("minAC", &minAC)
LONG_STRINGPARAMETER("filterList", &filterList)
LONG_PARAMETER("params", ¶ms)
LONG_PHONEHOME(VERSION)
END_LONG_PARAMETERS();
inputParameters.Add(new LongParameters ("Input Parameters",
longParameterList));
inputParameters.Read(argc-1, &(argv[1]));
// Check that all files were specified.
if(inputVcf == "")
{
usage();
inputParameters.Status();
std::cerr << "Missing \"--in\", a required parameter.\n\n";
return(-1);
}
if(params)
{
inputParameters.Status();
}
// Open the two input files.
VcfFileReader inFile;
VcfHeader header;
VcfRecord record;
// Open the file
if(sampleSubset.IsEmpty())
{
inFile.open(inputVcf, header);
}
else
{
inFile.open(inputVcf, header, sampleSubset, NULL, NULL);
}
// Add the discard rule for minor allele count.
if(minAC >= 0)
{
inFile.addDiscardMinMinorAlleleCount(minAC, NULL);
}
if(!filterList.IsEmpty())
{
// Open the filter list.
IFILE regionFile = ifopen(filterList, "r");
String regionLine;
StringArray regionColumn;
int start;
int end;
int intervalVal = 1;
if(regionFile == NULL)
{
std::cerr << "Failed to open " << filterList
<< ", so keeping all positions\n";
filterList.Clear();
}
else
{
while( regionFile->isOpen() && !regionFile->ifeof())
{
// Read the next interval
regionLine.Clear();
regionLine.ReadLine(regionFile);
if(regionLine.IsEmpty())
{
// Nothing on this line, continue to the next.
continue;
}
regionColumn.ReplaceColumns(regionLine, ' ');
if(regionColumn.Length() != 2)
{
std::cerr << "Improperly formatted region line: "
<< regionLine << "; skipping to the next line.\n";
continue;
}
// Convert the columns to integers.
if(!regionColumn[0].AsInteger(start))
//.........这里部分代码省略.........