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


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

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


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

示例1:

/**
 * Get the ingoing edges
 * one bit (1=yes, 0=no) per possible edge
 */
vector<Kmer> Kmer::_getIngoingEdges(uint8_t edges,int k){
	vector<Kmer> b;
	Kmer aTemplate;
	aTemplate=*this;
	
	int posToClear=2*k;

	for(int i=0;i<aTemplate.getNumberOfU64();i++){
		uint64_t element=aTemplate.getU64(i);
		element=element<<2;

//	1		0
//
//	127..64		63...0
//
//	00abcdefgh  ijklmnopqr		// initial state
//	abcdefgh00  klmnopqr00		// shift left
//	abcdefghij  klmnopqr00		// copy the last to the first
//	00cdefghij  klmnopqr00		// reset the 2 last

/**
 * Now, we need to copy 2 bits from 
 */
		if(i!=0){
			// the 2 last of the previous will be the 2 first of this one
			uint64_t last=getU64(i-1);
			last=(last>>62);
			element=element|last;
		}

		/**
 *	The two last bits that shifted must be cleared
 *	Otherwise, it will change the hash value of the Kmer...
 *	The chunk number i contains bits from i to i*64-1
 *	Therefore, if posToClear is inside these boundaries,
 *	then it is obvious that these awful bits must be changed 
 *	to 0
 */
		if(i*64<=posToClear&&posToClear<i*64+64){
			int position=posToClear%64;

			uint64_t filter=3;// 11 or 1*2^1+1*2^0
			filter=filter<<(position);
			filter=~filter;
			element=element&filter;
		}
		aTemplate.setU64(i,element);
	}
开发者ID:GunioRobot,项目名称:ray,代码行数:52,代码来源:Kmer.cpp

示例2: wordId

Kmer wordId(const char*a){
	Kmer i;
	int theLen=strlen(a);
	for(int j=0;j<(int)theLen;j++){
		uint64_t k=charToCode(a[j]);
		int bitPosition=2*j;
		int chunk=bitPosition/64;
		int bitPositionInChunk=bitPosition%64;
		#ifdef ASSERT
		if(!(chunk<i.getNumberOfU64())){
			cout<<"Chunk="<<chunk<<" positionInKmer="<<j<<" KmerLength="<<strlen(a)<<" bitPosition=" <<bitPosition<<" Chunks="<<i.getNumberOfU64()<<endl;
		}
		assert(chunk<i.getNumberOfU64());
		#endif
		uint64_t filter=(k<<bitPositionInChunk);
		i.setU64(chunk,i.getU64(chunk)|filter);
	}
	return i;
}
开发者ID:sebhtml,项目名称:photon-assembler,代码行数:19,代码来源:common_functions.cpp

示例3: call_RAY_SLAVE_MODE_REGISTER_SEEDS

void SpuriousSeedAnnihilator::call_RAY_SLAVE_MODE_REGISTER_SEEDS(){

	if(!m_debugCode && m_parameters->hasCheckpoint("Seeds")){
		m_hasCheckpointFilesForSeeds = true;
	}

	if((!m_debugCode && m_hasCheckpointFilesForSeeds) || m_skip){

		m_core->getSwitchMan()->closeSlaveModeLocally(m_core->getOutbox(),m_core->getRank());
		return;
	}

	if(m_inbox->hasMessage(RAY_MESSAGE_TAG_PUSH_SEEDS_REPLY)){
		m_activeQueries--;
		return;
	}

	#ifdef ASSERT
	assert(m_activeQueries>=0);
	#endif

	if(m_activeQueries > 0)
		return;

	#ifdef ASSERT
	assert(m_activeQueries==0);
	#endif

	if(m_seedIndex < (int)m_seeds->size()){

		if(m_seedPosition < (*m_seeds)[m_seedIndex].size()){

			if(m_seedIndex==0 && m_seedPosition == 0)
				cout<<"Rank "<<m_core->getRank()<<" has "<<m_seeds->size()<<" seeds to register."<<endl;

			Kmer vertex;
			(*m_seeds)[m_seedIndex].at(m_seedPosition,&vertex);

			Rank destination=m_parameters->vertexRank(&vertex);

			MessageTag tag=RAY_MESSAGE_TAG_PUSH_SEEDS;
			int elements = m_virtualCommunicator->getElementsPerQuery(tag);

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

			PathHandle identifier = getPathUniqueId(m_rank, m_seedIndex);

			m_buffers.addAt(destination, identifier);
			m_buffers.addAt(destination, m_seedPosition);

			if(m_buffers.flush(destination, elements, tag, m_outboxAllocator, m_outbox, m_rank,false)){
				m_activeQueries++;
			}

			if(m_seedPosition % 1000 == 0) {
				cout << "Rank "<<m_rank << " registered " << m_seedIndex << "/" <<m_seeds->size();
				cout<< " "<< m_seedPosition << "/" << (*m_seeds)[m_seedIndex].size() << endl;
			}

			m_seedPosition++;
		}else{

			if(m_seedIndex % 100 == 0)
				cout << "Rank "<<m_rank << " registered " << m_seedIndex << "/" <<m_seeds->size() << endl;

			m_seedIndex++;

			m_seedPosition = 0;
		}

	}else if(!m_buffers.isEmpty()){

/**
 * Flush additional queries
 */
		MessageTag tag=RAY_MESSAGE_TAG_PUSH_SEEDS;

		m_activeQueries += m_buffers.flushAll(tag, m_outboxAllocator, m_outbox, m_rank);

	}else{
		m_seedIndex=0;
		m_seedPosition=0;

		cout << "Rank "<<m_rank << " registered " << m_seedIndex - 1 << "/" <<m_seeds->size() << endl;
		cout<<"Rank "<<m_rank << " registered its seeds" << endl;

		m_core->getSwitchMan()->closeSlaveModeLocally(m_core->getOutbox(),m_core->getRank());
	}
}
开发者ID:Djeef,项目名称:ray,代码行数:91,代码来源:SpuriousSeedAnnihilator.cpp


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