コード例 #1
0
ファイル: prlHashCtg.c プロジェクト: Marge-m/SOAPdenovo-Trans
static void chopKmer4read (int t, int threadID)
{
	char *src_seq = seqBuffer + seqBreakers[t];
	char *bal_seq = rcSeq[threadID];
	int len_seq = lenBuffer[t];
	int j, bal_j;
	ubyte8 hash_ban, bal_hash_ban;
	Kmer word, bal_word;
	int index;

	word=kmerZero;

	for (index = 0; index < overlaplen; index++)
	{
		word = KmerLeftBitMoveBy2 (word);
#ifdef MER127
		word.low2 |= src_seq[index];
#endif
#ifdef MER63
		word.low|= src_seq[index];
#endif
#ifdef MER31
		word |= src_seq[index];
#endif
	}

	reverseComplementSeq (src_seq, len_seq, bal_seq);
	// complementary node
	bal_word = reverseComplement (word, overlaplen);
	bal_j = len_seq - 0 - overlaplen;	//  0;
	index = indexArray[t];

	if (KmerSmaller (word, bal_word))
	{
		hash_ban = hash_kmer (word);
		kmerBuffer[index] = word;
		hashBanBuffer[index] = hash_ban;
		smallerBuffer[index++] = 1;
	}
	else
	{
		bal_hash_ban = hash_kmer (bal_word);
		kmerBuffer[index] = bal_word;
		hashBanBuffer[index] = bal_hash_ban;
		smallerBuffer[index++] = 0;
	}

	//printf("%dth: %p with %p\n",kmer_c-1,bal_word,bal_hash_ban);
	for (j = 1; j <= len_seq - overlaplen; j++)
	{
		word = nextKmer (word, src_seq[j - 1 + overlaplen]);
		bal_j = len_seq - j - overlaplen;	//  j;
		bal_word = prevKmer (bal_word, bal_seq[bal_j]);
		
		if (KmerSmaller (word, bal_word))
		{
			hash_ban = hash_kmer (word);
			kmerBuffer[index] = word;
			hashBanBuffer[index] = hash_ban;
			smallerBuffer[index++] = 1;
			//printf("%dth: %p with %p\n",kmer_c-1,word,hashBanBuffer[kmer_c-1]);
		}
		else
		{
			// complementary node
			bal_hash_ban = hash_kmer (bal_word);
			kmerBuffer[index] = bal_word;
			hashBanBuffer[index] = bal_hash_ban;
			smallerBuffer[index++] = 0;
			//printf("%dth: %p with %p\n",kmer_c-1,bal_word,hashBanBuffer[kmer_c-1]);
		}
	}
}
コード例 #2
0
ファイル: prlHashReads.c プロジェクト: Buttonwood/SOAPdenovo2
static void chopKmer4read ( int t, int threadID )
{
	char * src_seq = seqBuffer[t];
	char * bal_seq = rcSeq[threadID];
	int len_seq = lenBuffer[t];
	int j, bal_j;
	ubyte8 hash_ban, bal_hash_ban;
	Kmer word, bal_word;
	int index;
	char InvalidCh = 4;
#ifdef MER127
	word.high1 = word.low1 = word.high2 = word.low2 = 0;

	for ( index = 0; index < overlaplen; index++ )
	{
		word = KmerLeftBitMoveBy2 ( word );
		word.low2 |= src_seq[index];
	}

#else
	word.high = word.low = 0;

	for ( index = 0; index < overlaplen; index++ )
	{
		word = KmerLeftBitMoveBy2 ( word );
		word.low |= src_seq[index];
	}

#endif
	reverseComplementSeq ( src_seq, len_seq, bal_seq );
	// complementary node
	bal_word = reverseComplement ( word, overlaplen );
	bal_j = len_seq  - overlaplen;
	index = indexArray[t];

	if ( KmerSmaller ( word, bal_word ) )
	{
		hash_ban = hash_kmer ( word );
		hashBanBuffer[index] = hash_ban;
		kmerBuffer[index] = word;
		prevcBuffer[index] = InvalidCh;
		nextcBuffer[index++] = src_seq[0 + overlaplen];
	}
	else
	{
		bal_hash_ban = hash_kmer ( bal_word );
		hashBanBuffer[index] = bal_hash_ban;
		kmerBuffer[index] = bal_word;
		prevcBuffer[index] = bal_seq[bal_j - 1];
		nextcBuffer[index++] = InvalidCh;
	}

	for ( j = 1; j <= len_seq - overlaplen; j++ )
	{
		word = nextKmer ( word, src_seq[j - 1 + overlaplen] );
		bal_j = len_seq - j - overlaplen;
		bal_word = prevKmer ( bal_word, bal_seq[bal_j] );

		if ( KmerSmaller ( word, bal_word ) )
		{
			hash_ban = hash_kmer ( word );
			hashBanBuffer[index] = hash_ban;
			kmerBuffer[index] = word;
			prevcBuffer[index] = src_seq[j - 1];

			if ( j < len_seq - overlaplen )
			{
				nextcBuffer[index++] = src_seq[j + overlaplen];
			}
			else
			{
				nextcBuffer[index++] = InvalidCh;
			}

			//printf("%dth: %p with %p\n",kmer_c-1,word,hashBanBuffer[kmer_c-1]);
		}
		else
		{
			// complementary node
			bal_hash_ban = hash_kmer ( bal_word );
			hashBanBuffer[index] = bal_hash_ban;
			kmerBuffer[index] = bal_word;

			if ( bal_j > 0 )
			{
				prevcBuffer[index] = bal_seq[bal_j - 1];
			}
			else
			{
				prevcBuffer[index] = InvalidCh;
			}

			nextcBuffer[index++] = bal_seq[bal_j + overlaplen];
			//printf("%dth: %p with %p\n",kmer_c-1,bal_word,hashBanBuffer[kmer_c-1]);
		}
	}
}
コード例 #3
0
ファイル: prlHashCtg.c プロジェクト: aquaskyline/SOAPdenovo2
static void chopKmer4read(int t, int threadID)
{
  char *src_seq = seqBuffer + seqBreakers[t];
  char *bal_seq = rcSeq[threadID];
  int len_seq = lenBuffer[t];
  int j, bal_j;
  Kmer hash_ban, bal_hash_ban;
  Kmer word, bal_word;
  int index;

  word = 0;

  for (index = 0; index < overlaplen; index++)
    {
      word <<= 2;
      word += src_seq[index];
    }

  reverseComplementSeq(src_seq, len_seq, bal_seq);
  // complementary node
  bal_word = reverseComplement(word, overlaplen);
  bal_j = len_seq - 0 - overlaplen; //  0;
  index = indexArray[t];

  if(word < bal_word)
    {
      hash_ban = hash_kmer(word);
      kmerBuffer[index] = word;
      hashBanBuffer[index] = hash_ban;
      smallerBuffer[index++] = 1;
    }
  else
    {
      bal_hash_ban = hash_kmer(bal_word);
      kmerBuffer[index] = bal_word;
      hashBanBuffer[index] = bal_hash_ban;
      smallerBuffer[index++] = 0;
    }

  //printf("%dth: %p with %p\n",kmer_c-1,bal_word,bal_hash_ban);
  for(j = 1; j <= len_seq - overlaplen; j ++)
    {
      word = nextKmer(word, src_seq[j - 1 + overlaplen]);
      bal_j = len_seq - j - overlaplen; //  j;
      bal_word = prevKmer(bal_word, bal_seq[bal_j]);

      if(word < bal_word)
        {
          hash_ban = hash_kmer(word);
          kmerBuffer[index] = word;
          hashBanBuffer[index] = hash_ban;
          smallerBuffer[index++] = 1;
          //printf("%dth: %p with %p\n",kmer_c-1,word,hashBanBuffer[kmer_c-1]);
        }
      else
        {
          // complementary node
          bal_hash_ban = hash_kmer(bal_word);
          kmerBuffer[index] = bal_word;
          hashBanBuffer[index] = bal_hash_ban;
          smallerBuffer[index++] = 0;
          //printf("%dth: %p with %p\n",kmer_c-1,bal_word,hashBanBuffer[kmer_c-1]);
        }
    }
}