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


C++ Kmer::read方法代码示例

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


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

示例1: loadCheckpoint

void SeedingData::loadCheckpoint(){
	cout<<"Rank "<<m_parameters->getRank()<<" is reading checkpoint Seeds"<<endl;

	ifstream f(m_parameters->getCheckpointFile("Seeds").c_str());
	int n=0;
	f.read((char*)&n,sizeof(int));
	for(int i=0;i<n;i++){
		GraphPath seed;
		seed.setKmerLength(m_parameters->getWordSize());
		int vertices=0;
		f.read((char*)&vertices,sizeof(int));
		for(int j=0;j<vertices;j++){
			Kmer kmer;
			kmer.read(&f);
			seed.push_back(&kmer);

			CoverageDepth coverageValue=0;

			f.read((char*)&coverageValue,sizeof(CoverageDepth));
			seed.addCoverageValue(coverageValue);
		}

		seed.computePeakCoverage();

		m_SEEDING_seeds.push_back(seed);
	}
	cout<<"Rank "<<m_parameters->getRank()<<" loaded "<<n<<" seeds from checkpoint Seeds"<<endl;
	f.close();
}
开发者ID:Huanle,项目名称:ray,代码行数:29,代码来源:SeedingData.cpp

示例2: loadCheckpoint

void SeedingData::loadCheckpoint(){
	cout<<"Rank "<<m_parameters->getRank()<<" is reading checkpoint Seeds"<<endl;

	ifstream f(m_parameters->getCheckpointFile("Seeds").c_str());
	int n=0;
	f.read((char*)&n,sizeof(int));
	for(int i=0;i<n;i++){
		vector<Kmer> seed;
		int vertices=0;
		f.read((char*)&vertices,sizeof(int));
		for(int j=0;j<vertices;j++){
			Kmer kmer;
			kmer.read(&f);
			seed.push_back(kmer);
		}
		m_SEEDING_seeds.push_back(seed);
	}
	cout<<"Rank "<<m_parameters->getRank()<<" loaded "<<n<<" seeds from checkpoint Seeds"<<endl;
	f.close();
}
开发者ID:GunioRobot,项目名称:ray,代码行数:20,代码来源:SeedingData.cpp

示例3: distribute

void FusionData::distribute(SeedingData*m_seedingData,ExtensionData*m_ed,int getRank,RingAllocator*m_outboxAllocator,StaticVector*m_outbox,int getSize1,int*m_mode){

	/** read the checkpoint ContigPaths */
	if(!m_processedCheckpoint){
		m_processedCheckpoint=true;

		if(m_parameters->hasCheckpoint("ContigPaths")){
			cout<<"Rank "<<m_parameters->getRank()<<" is reading checkpoint ContigPaths"<<endl;
			ifstream f(m_parameters->getCheckpointFile("ContigPaths").c_str());
	
			/* delete old stuff */
			m_ed->m_EXTENSION_identifiers.clear();
			m_ed->m_EXTENSION_contigs.clear();
	
			int theSize=0;
			f.read((char*)&theSize,sizeof(int));
	
			/* write each path with its name and vertices */
			for(int i=0;i<theSize;i++){
				uint64_t name=0;
				int vertices=0;
				f.read((char*)&name,sizeof(uint64_t));
				f.read((char*)&vertices,sizeof(int));
				vector<Kmer> path;
				for(int j=0;j<vertices;j++){
					Kmer kmer;
					kmer.read(&f);
					path.push_back(kmer);
				}
	
				#ifdef ASSERT
				assert(vertices!=0);
				assert(vertices == (int)path.size());
				#endif
	
				m_ed->m_EXTENSION_identifiers.push_back(name);
				m_ed->m_EXTENSION_contigs.push_back(path);
			}
			f.close();
		}
	}

	if(!isReady()){
		return;
	}
	if(!m_buffers.isEmpty() && m_seedingData->m_SEEDING_i==(uint64_t)m_ed->m_EXTENSION_contigs.size()){
		m_ready+=m_buffers.flushAll(RAY_MPI_TAG_SAVE_WAVE_PROGRESSION_WITH_REPLY,m_outboxAllocator,m_outbox,getRank);
		return;
	}else if(m_buffers.isEmpty() && m_seedingData->m_SEEDING_i==(uint64_t)m_ed->m_EXTENSION_contigs.size()){
		printf("Rank %i is distributing fusions [%i/%i] (completed)\n",getRank,(int)m_ed->m_EXTENSION_contigs.size(),(int)m_ed->m_EXTENSION_contigs.size());
		fflush(stdout);
		Message aMessage(NULL,0,MASTER_RANK,RAY_MPI_TAG_DISTRIBUTE_FUSIONS_FINISHED,getRank);
		m_outbox->push_back(aMessage);
		(*m_mode)=RAY_SLAVE_MODE_DO_NOTHING;
		m_buffers.showStatistics(m_parameters->getRank());
		m_buffers.clear();

		m_cacheForRepeatedVertices.clear();
		m_cacheAllocator.clear();

		if(m_parameters->showMemoryUsage()){
			showMemoryUsage(m_rank);
			showDate();
		}
		return;
	}

	if(m_ed->m_EXTENSION_currentPosition==0){
		if(m_seedingData->m_SEEDING_i%10==0){
			printf("Rank %i is distributing fusions [%i/%i]\n",getRank,(int)(m_seedingData->m_SEEDING_i+1),(int)m_ed->m_EXTENSION_contigs.size());
			fflush(stdout);
			if(m_parameters->showMemoryUsage()){
				showMemoryUsage(getRank);
				showDate();
			}
		}
	}

	#ifdef ASSERT
	assert(m_seedingData->m_SEEDING_i<m_ed->m_EXTENSION_contigs.size());
	assert(m_ed->m_EXTENSION_currentPosition < (int) m_ed->m_EXTENSION_contigs[m_seedingData->m_SEEDING_i].size());
	assert(m_ed->m_EXTENSION_contigs[m_seedingData->m_SEEDING_i].size() > 0);
	#endif

	Kmer vertex=m_ed->m_EXTENSION_contigs[m_seedingData->m_SEEDING_i][m_ed->m_EXTENSION_currentPosition];
	int destination=m_parameters->_vertexRank(&vertex);

	for(int i=0;i<KMER_U64_ARRAY_SIZE;i++){
		m_buffers.addAt(destination,vertex.getU64(i));
	}

	m_buffers.addAt(destination,m_ed->m_EXTENSION_identifiers[m_seedingData->m_SEEDING_i]);
	m_buffers.addAt(destination,m_ed->m_EXTENSION_currentPosition);

	if(m_buffers.flush(destination,KMER_U64_ARRAY_SIZE+2,RAY_MPI_TAG_SAVE_WAVE_PROGRESSION_WITH_REPLY,m_outboxAllocator,m_outbox,getRank,false)){
		m_ready++;
	}

	m_ed->m_EXTENSION_currentPosition++;

//.........这里部分代码省略.........
开发者ID:GunioRobot,项目名称:ray,代码行数:101,代码来源:FusionData.cpp


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