Skip to content

Commit

Permalink
Do not modify contigs KmerContigMap
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Kim committed May 8, 2012
1 parent adb2098 commit 1a741c8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions contig.cpp
Expand Up @@ -26,6 +26,12 @@ Contig::Contig(kmer_t init_kmer)
s = kmer_str;
}

Contig::Contig(Contig* contig)
: id(id_generator++), s(contig->s), left_ext(contig->left_ext),
right_ext(contig->right_ext)
{
}

bool Contig::check_next_left_ext(base next_left_ext)
{
return char2base(s[s.size() - k]) == next_left_ext;
Expand Down
1 change: 1 addition & 0 deletions contig.h
Expand Up @@ -15,6 +15,7 @@ class Contig {

Contig();
Contig(kmer_t init_kmer);
Contig(Contig* contig);

/* Checks the given base 'next_left_ext' against the s[size - k] to see if
* they're the same. If the kmer overlaps properly, these bases should be
Expand Down
7 changes: 4 additions & 3 deletions kmer_contig_map.cpp
Expand Up @@ -41,14 +41,15 @@ void KmerContigMap::join_contigs(ContigStore& contig_store)
for (map_type_t::iterator it = forward_map.map.begin();
it != forward_map.map.end();
it++) {
Contig* contig = it->second;

if (contig->s.size() == 0) continue;
if (it->second->s.size() == 0) continue;

Contig* contig = new Contig(it->second);
walk(contig);
contig->revcmp();
walk(contig);
contig_store.add(contig);

it->second->s.clear();
}
}

Expand Down

0 comments on commit 1a741c8

Please sign in to comment.