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


C++ DataInputStream::readDM方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........

		switch( args_info.inputs_num ) {
			case 0:
				break; /* inputfilename will be null and indicate stdin as input */
		case 1:
			inputfilename =  args_info.inputs[0];
			break;
		default: cerr << "Error: you can at most specify one input filename" << endl;
			exit(EXIT_FAILURE);
		}
		if( args_info.outfile_given )
			outputfilename = args_info.outfile_arg;
		switch ( args_info.input_format_arg ) {
			case input_format_arg_phylip:
				istream = new PhylipDmInputStream(inputfilename);
				break;
			case input_format_arg_binary: istream = new BinaryInputStream(inputfilename);
				break;
#ifdef WITH_LIBXML
			case input_format_arg_xml: istream = new XmlInputStream(inputfilename);
				break;
#endif // WITH_LIBXML
			default:
				exit(EXIT_FAILURE);
		}
		switch (args_info.output_format_arg) {
			case output_format_arg_newick:
				ostream = new TreeTextOutputStream(outputfilename);
				break;
			case output_format_arg_xml:
				ostream = new XmlOutputStream(outputfilename);
				break;
			default:
				exit(EXIT_FAILURE);
		}
		//printf("%d\n", args_info.input_format_arg);
		// THE DATA WE WILL PROCESS
		vector<Sequence> seqs;
		vector<std::string> names;
		vector<DNA_b128_String> b128seqs;
		Extrainfos extrainfos;
		bool latestReadSuccessful = true;
		vector<string> speciesnames;
		readstatus status;
		int run = 0;
		status = END_OF_RUN;

		while (status == END_OF_RUN && (args_info.input_format_arg == input_format_arg_xml || run<args_info.number_of_runs_arg)) {
			string runId("");
			run++;
			tree2int_map tree2count((size_t)(args_info.bootstraps_arg * 1.3));
			str2int_hashmap name2id;
			if (args_info.input_format_arg==input_format_arg_binary) {
				StrFloMatrix dm;
				for (int runNo=1; (status = istream->readDM(dm, names, runId, extrainfos))==DM_READ; runNo++) {
					if (args_info.analyze_run_number_given) {
						if (runNo<args_info.analyze_run_number_arg)
							continue;
						if (runNo>args_info.analyze_run_number_arg) {
							status=END_OF_RUN;
							break;
							}
						}
					for(size_t namei=0; namei<dm.getSize(); namei++)
						name2id[dm.getIdentifier(namei)] = namei;
					buildTrees(dm, tree2count, methods,name2id);
				}
			}
			else {
				StrDblMatrix dm;
				for (int runNo=1; (status = istream->readDM(dm, names, runId, extrainfos))==DM_READ; runNo++) {
					if (args_info.analyze_run_number_given) {
						if (runNo<args_info.analyze_run_number_arg)
							continue;
						if (runNo>args_info.analyze_run_number_arg) {
							status=END_OF_RUN;
							break;
							}
						}
					for(size_t namei=0; namei<dm.getSize(); namei++) {
					     name2id[dm.getIdentifier(namei)] = namei;
					}
					buildTrees(dm, tree2count, methods,name2id);
				}
			}
			if (status==END_OF_RUN)
				ostream->print(tree2count,printCounts, runId, names, extrainfos);
			if (args_info.analyze_run_number_given)
				break;
		}//end run loop
		delete ostream;
		delete istream;
	}
	catch(...){
		throw;
	}
	CATCH_EXCEPTION();
	cmdline_parser_free(&args_info);
	return 0;
}
开发者ID:arvestad,项目名称:FastPhylo,代码行数:101,代码来源:main.cpp


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