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


C++ BamMultiReader::GetErrorString方法代码示例

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


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

示例1: bbctools_create

int bbctools_create( BbcUtils::OptParser &optParser ) {
    const vector<string> cmdArgs = optParser.getArgs();

	// remove .bbc extension from bbc file root, if present
	string bbcfileRoot = optParser.getOptValue( "bbc" );
	int i = bbcfileRoot.size() - 4;
	if( i > 0 && bbcfileRoot.substr(i,4) == ".bbc" ) {
		bbcfileRoot = bbcfileRoot.substr(0,i);
	}
	bool f_bci = optParser.getOptBoolean("index");
	bool f_cbc = optParser.getOptBoolean("coarse");

	string targetRegions   = optParser.getOptValue("regions");
	string annotationFields = optParser.getOptValue( "annotationFields");
	vector<string> auxRegionSplit = BbcUtils::mapToPairList(annotationFields);

	string  sumstatsFile = optParser.getOptValue("sumStats");
	string  covstatsFile = optParser.getOptValue("covStats");
	string  readOrigFile = optParser.getOptValue("readOrigin");
	string  readType     = optParser.getOptValue("readType");
	string  covDepths    = optParser.getOptValue("covDepths","-");
	double  minPcCov     = optParser.getOptNumber("minPcCov");
	int32_t primerLength = optParser.getOptInteger( "primerLength", (readType == "AmpliSeq" ? 30 : 0) );
	int32_t maxE2eEndGap = optParser.getOptInteger( "e2eGap", (readType == "AmpliSeq" ? 2 : 0) );

	bool   autoCreateBamIndex = optParser.getOptBoolean("autoCreateBamIndex");
	bool     samdepth         = optParser.getOptBoolean("samdepth");
	int32_t  filterQuality    = optParser.getOptInteger("minMAPQ");
	int32_t  minAlignLength   = optParser.getOptInteger("minAlignLength");
	bool     filterDuplicates = optParser.getOptBoolean("noDups");
	bool     filterUnique     = optParser.getOptBoolean("unique");
	uint32_t skipFlag         = filterDuplicates ? 0x704 : 0x304;
	uint16_t minMapQuality    = filterUnique ? 1 : filterQuality;

	bool onlyOnTargetReads = optParser.getOptBoolean("onTargetReads");
	bool onlyOnTargetBases = optParser.getOptBoolean("onTargetBases");

	// possible future options
	bool invertOnTarget = false;

	// check basic valid argument values and combinations
	int numOuts  = !bbcfileRoot.empty() + !covstatsFile.empty() + !sumstatsFile.empty() + !readOrigFile.empty();
	int numPipes = (bbcfileRoot == "-") + (covstatsFile == "-") + (sumstatsFile == "-") + (readOrigFile == "-");
	if( numOuts == 0 && !f_bci && !f_cbc ) {
		bbcfileRoot = "-";	// default if no other output specified
	} else if( numPipes > 1 ) {
		cerr << "Error: bbctools create: Only one file output (--covStats, --sumStats, --readOrigin or --bbc) may be piped to STDOUT." << endl;
		return -1;
	} else if( samdepth && numOuts ) {
		cerr << "Error: bbctools create: --samdepth (-s) option may only be used without other output options." << endl;
		return -1;
	}
	// check if single argument is a BBC file and leave open for reading if so
	BbcView bbcView;
	bool haveBbcFile = cmdArgs.size() == 1 && bbcView.Open( cmdArgs[0], true );
	bbcView.SelectPrintStream( samdepth ? "SAMDEPTH" : "BBCVIEW" );

	// check distinction between default and explicit no target regions - only for BBC input
	bool explicitNoTargetRegions = false;
	if( targetRegions == "-" ) {
		explicitNoTargetRegions = haveBbcFile;
		targetRegions = "";
	}
	if( targetRegions.empty() ) {
		if( onlyOnTargetBases && explicitNoTargetRegions && !invertOnTarget ) {
			cerr << "Warning: bbctools create --onTargetBases (-b) option with --regions '-' produces no coverage." << endl;
		} else if( onlyOnTargetReads ) {
			cerr << "Error: bbctools create --onTargetReads (-r) option requires a --regions file." << endl;
			return -1;
		}
	}
	// check for legal BBC create options
	if( f_bci || f_cbc ) {
		if( (bbcfileRoot.empty() || bbcfileRoot == "-") && !haveBbcFile ) {
			string opt = f_bci ? "--index (-i)" : "--coarse (-c)";
			cerr << "Error: bbctools create "+opt+" option requires the --bbc (-B) option or a BBC source file." << endl;
			return -1;
		}
	}
	BamMultiReader bamReader;
	if( haveBbcFile ) {
		// warn for options that do not work with BBC input
		if( filterQuality > 0 || filterDuplicates || filterUnique || minAlignLength ) {
			cerr << "Warning: SAM flag, alignment length and MAPQ filters ignored for BBC source file." << endl;
		}
		if( samdepth ) {
			cerr << "Error: --samdepth option is not supported for BBC source files." << endl;
			return -1;
		}
		if( !readOrigFile.empty() ) {
			cerr << "Error: --readOrigin option is not supported for BBC source files." << endl;
			return -1;
		}
	} else {
		// check / open for multiple BAM file inputs
		if ( !bamReader.Open(cmdArgs) ) {
			if( cmdArgs.size() == 1 ) cerr << "ERROR: Could not read input BAM file:";
			else cerr << "ERROR: Could not read all input BAM files:";
			// get and clean up bamtools error msg
			string errMsg = bamReader.GetErrorString();
//.........这里部分代码省略.........
开发者ID:biocyberman,项目名称:TS,代码行数:101,代码来源:BbcMain.cpp


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