Example #1
0
/** Remove the specified extensions from this k-mer. */
void SequenceCollectionHash::removeExtension(const Kmer& kmer,
		extDirection dir, SeqExt ext)
{
	bool rc;
	SequenceCollectionHash::iterator it = find(kmer, rc);
	assert(it != m_data.end());
	if (opt::ss) {
		assert(!rc);
		it->second.removeExtension(dir, ext);
	} else {
		bool palindrome = kmer.isPalindrome();
		if (!rc || palindrome)
			it->second.removeExtension(dir, ext);
		if (rc || palindrome)
			it->second.removeExtension(!dir, ~ext);
	}
	notify(*it);
}
Example #2
0
/** Add an edge to this k-mer. */
bool SequenceCollectionHash::setBaseExtension(
		const Kmer& kmer, extDirection dir, uint8_t base)
{
	bool rc;
	SequenceCollectionHash::iterator it = find(kmer, rc);
	if (it == m_data.end())
		return false;
	if (opt::ss) {
		assert(!rc);
		it->second.setBaseExtension(dir, base);
	} else {
		bool palindrome = kmer.isPalindrome();
		if (!rc || palindrome)
			it->second.setBaseExtension(dir, base);
		if (rc || palindrome)
			it->second.setBaseExtension(!dir, complementBaseCode(base));
	}
	return true;
}