Exemplo n.º 1
0
//splay for one kmer in buffer and save the node to nodeBuffer
static void searchKmer (int t, KmerSet * kset)
{
#ifdef MER127
	if( kmerBuffer[t].low2== 0 && N_kmer)
#endif
#ifdef MER63
	if( kmerBuffer[t].low== 0 && N_kmer)
#endif
#ifdef MER31
	if( kmerBuffer[t]== 0 && N_kmer)
#endif
		return ;
	kmer_t *node;
	boolean found = search_kmerset (kset, kmerBuffer[t], &node);

	if (!found)
	{
#ifdef MER127
		printf ("searchKmer: kmer %llx %llx %llx %llx is not found\n",
			kmerBuffer[t].high1, kmerBuffer[t].low1, kmerBuffer[t].high2, kmerBuffer[t].low2);
#endif
#ifdef MER63
		printf ("searchKmer: kmer %llx %llx is not found\n",
			kmerBuffer[t].high, kmerBuffer[t].low);
#endif
#ifdef MER31
		printf ("searchKmer: kmer %llx is not found\n", kmerBuffer[t]);
#endif
	}

	nodeBuffer[t] = node;
}
Exemplo n.º 2
0
static void search1kmerPlus (int j, unsigned char thrdID)
{
	kmer_t *node;
	boolean found = search_kmerset (KmerSetsPatch[thrdID], mixBuffer[j], &node);

	if (!found)
	{
		mixBuffer[j] =kmerZero;
		return;
	}
#ifdef MER127
	if (smallerBuffer[j])
	{
		mixBuffer[j].low2 = node->l_links;
	}
	else
	{
		mixBuffer[j].low2 = node->l_links + node->twin - 1;
	}
#endif
#ifdef MER63
	if (smallerBuffer[j])
	{
		mixBuffer[j].low= node->l_links;
	}
	else
	{
		mixBuffer[j].low= node->l_links + node->twin - 1;
	}
#endif
#ifdef MER31
	if (smallerBuffer[j])
	{
		mixBuffer[j] = node->l_links;
	}
	else
	{
		mixBuffer[j] = node->l_links + node->twin - 1;
	}
#endif
}
Exemplo n.º 3
0
static void stringBeads ( KMER_PT * firstBead, char nextch, int * node_c )
{
	boolean smaller, found;
	Kmer tempKmer, bal_word;
	Kmer word = firstBead->kmer;
	ubyte8 hash_ban;
	kmer_t * outgoing_node;
	int nodeCounter = 1, setPicker;
	char ch;
	unsigned char flag;
	KMER_PT * temp_pt, *prev_pt = firstBead;
	word = prev_pt->kmer;
	nodeCounter = 1;
	word = nextKmer ( word, nextch );
	bal_word = reverseComplement ( word, overlaplen );

	if ( KmerLarger ( word, bal_word ) )
	{
		tempKmer = bal_word;
		bal_word = word;
		word = tempKmer;
		smaller = 0;
	}
	else
		{ smaller = 1; }

	hash_ban = hash_kmer ( word );
	setPicker = hash_ban % thrd_num;
	found = search_kmerset ( KmerSets[setPicker], word, &outgoing_node );

	while ( found && ( outgoing_node->linear ) )   // for every node in this line
	{
		nodeCounter++;
		temp_pt = ( KMER_PT * ) stackPush ( nodeStack );
		temp_pt->node = outgoing_node;
		temp_pt->isSmaller = smaller;

		if ( smaller )
			{ temp_pt->kmer = word; }
		else
			{ temp_pt->kmer = bal_word; }

		prev_pt = temp_pt;

		if ( smaller )
		{
			for ( ch = 0; ch < 4; ch++ )
			{
				flag = get_kmer_right_cov ( *outgoing_node, ch );

				if ( flag )
					{ break; }
			}

			word = nextKmer ( prev_pt->kmer, ch );
			bal_word = reverseComplement ( word, overlaplen );

			if ( KmerLarger ( word, bal_word ) )
			{
				tempKmer = bal_word;
				bal_word = word;
				word = tempKmer;
				smaller = 0;
			}
			else
				{ smaller = 1; }

			hash_ban = hash_kmer ( word );
			setPicker = hash_ban % thrd_num;
			found = search_kmerset ( KmerSets[setPicker], word, &outgoing_node );
		}
		else
		{
			for ( ch = 0; ch < 4; ch++ )
			{
				flag = get_kmer_left_cov ( *outgoing_node, ch );

				if ( flag )
					{ break; }
			}

			word = nextKmer ( prev_pt->kmer, int_comp ( ch ) );
			bal_word = reverseComplement ( word, overlaplen );

			if ( KmerLarger ( word, bal_word ) )
			{
				tempKmer = bal_word;
				bal_word = word;
				word = tempKmer;
				smaller = 0;
			}
			else
				{ smaller = 1; }

			hash_ban = hash_kmer ( word );
			setPicker = hash_ban % thrd_num;
			found = search_kmerset ( KmerSets[setPicker], word, &outgoing_node );
		}
	}

	if ( outgoing_node ) //this is always true
	{
		nodeCounter++;
		temp_pt = ( KMER_PT * ) stackPush ( nodeStack );
		temp_pt->node = outgoing_node;
		temp_pt->isSmaller = smaller;

		if ( smaller )
			{ temp_pt->kmer = word; }
		else
			{ temp_pt->kmer = bal_word; }
	}

	*node_c = nodeCounter;
}