当前位置: 首页>>代码示例>>C++>>正文


C++ BamReader::OpenIndex方法代码示例

本文整理汇总了C++中BamReader::OpenIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ BamReader::OpenIndex方法的具体用法?C++ BamReader::OpenIndex怎么用?C++ BamReader::OpenIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BamReader的用法示例。


在下文中一共展示了BamReader::OpenIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: loadIndex

bool BamParse::loadIndex(BamReader& reader)
{
	bool bsignal = reader.OpenIndex(this->filename_index);
	if(bsignal==false) 
	{
		cerr << "Index file not found, now create it!!!"<<endl;
		bool bci=reader.CreateIndex();
		if(bci==false)
		{
			cerr << "Index file cannot be created!!!"<<endl;
			return false;
		}
		else
		{
			bool blct=reader.LocateIndex();
			if(blct==false)
			{
				cerr << "Index file cannot be located!!!"<<endl;
				return false;
			}
		}

	}
	return true;
}
开发者ID:Reedwarbler,项目名称:SVHapCaller,代码行数:25,代码来源:bam_parse.cpp

示例2: OpenIndexes

bool BamMultiReaderPrivate::OpenIndexes(const std::vector<std::string>& indexFilenames)
{

    // TODO: This needs to be cleaner - should not assume same order.
    //       And either way, shouldn't start at first reader.  Should start at
    //       first reader without an index?

    // make sure same number of index filenames as readers
    if (m_readers.size() != indexFilenames.size()) {
        const std::string message("size of index file list does not match current BAM file count");
        SetErrorString("BamMultiReader::OpenIndexes", message);
        return false;
    }

    bool errorsEncountered = false;
    m_errorString.clear();

    // iterate over BamReaders
    std::vector<std::string>::const_iterator indexFilenameIter = indexFilenames.begin();
    std::vector<std::string>::const_iterator indexFilenameEnd = indexFilenames.end();
    std::vector<MergeItem>::iterator readerIter = m_readers.begin();
    std::vector<MergeItem>::iterator readerEnd = m_readers.end();
    for (; readerIter != readerEnd; ++readerIter) {
        MergeItem& item = (*readerIter);
        BamReader* reader = item.Reader;

        // open index filename on reader
        if (reader) {
            const std::string& indexFilename = (*indexFilenameIter);
            if (!reader->OpenIndex(indexFilename)) {
                m_errorString.append(1, '\t');
                m_errorString += reader->GetErrorString();
                m_errorString.append(1, '\n');
                errorsEncountered = true;
            }
        }

        // increment filename iterator, skip if no more index files to open
        if (++indexFilenameIter == indexFilenameEnd) break;
    }

    // return success/fail
    if (errorsEncountered) {
        const std::string currentError = m_errorString;
        const std::string message =
            std::string("could not open all index files: \n\t") + currentError;
        SetErrorString("BamMultiReader::OpenIndexes", message);
        return false;
    } else
        return true;
}
开发者ID:grenaud,项目名称:bamtools,代码行数:51,代码来源:BamMultiReader_p.cpp


注:本文中的BamReader::OpenIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。