[Seqan-dev] Merging seeds
Hi,
I found that the seed merging depends on the order of the merge. For
example:
SeedSet< int, SimpleSeed, DefaultNoScore , void > seedset(100, 0);bool
yep = addSeed(seedset, Seed<int,SimpleSeed>(1, 1, 4),Single());
::std::cout << yep << " " << length(seedset) << " " <<
leftDim0(*begin(seedset)) << "-" << rightDim0(*begin(seedset)) <<
::std::endl;
yep = addSeed(seedset, Seed<int,SimpleSeed>(0, 0, 4), 0, Merge());
::std::cout << yep << " " << length(seedset) << " " <<
leftDim0(*begin(seedset)) << "-" << rightDim0(*begin(seedset)) <<
::std::endl;
results in:
1 1 1-4
0 1 1-4
the seed containing a preceding location is not added.
On the other hand adding the seeds in reverse order, i.e.:
SeedSet< int, SimpleSeed, DefaultNoScore , void > seedset(100, 0);bool
yep = addSeed(seedset, Seed<int,SimpleSeed>(0, 0, 4),Single());
::std::cout << yep << " " << length(seedset) << " " <<
leftDim0(*begin(seedset)) << "-" << rightDim0(*begin(seedset)) <<
::std::endl;
yep = addSeed(seedset, Seed<int,SimpleSeed>(1, 1, 4), 0, Merge());
::std::cout << yep << " " << length(seedset) << " " <<
leftDim0(*begin(seedset)) << "-" << rightDim0(*begin(seedset)) <<
::std::endl;
gives what one expects:
1 1 0-3
1 1 0-4
Is this a feature or a bug? It should be annotated if it is the former.
It would also be nice to have an example for seed merging in demos
(although I found some in tests).
Secondly, If I use the tag Single() while adding the second seed I get a
compiler error:
SeedSet< int, SimpleSeed, DefaultNoScore , void > seedset(100, 0);
bool yep = addSeed(seedset, Seed<int,SimpleSeed>(0, 0, 4),Single());
::std::cout << yep << " " << length(seedset) << " " <<
leftDim0(*begin(seedset)) << "-" << rightDim0(*begin(seedset)) <<
::std::endl;
yep = addSeed(seedset, Seed<int,SimpleSeed>(1, 1, 4), 0, Single());
::std::cout << yep << " " << length(seedset) << " " <<
leftDim0(*begin(seedset)) << "-" << rightDim0(*begin(seedset)) <<
::std::endl;
Thirdly, two adjacent seeds are currently not concatenated though it
would make sense to join them I think:
SeedSet< int, SimpleSeed, DefaultNoScore , void > seedset(100, 0);
bool yep = addSeed(seedset, Seed<int,SimpleSeed>(0, 0, 4),Single());
::std::cout << yep << " " << length(seedset) << " " <<
leftDim0(*begin(seedset)) << "-" << rightDim0(*begin(seedset)) <<
::std::endl;
yep = addSeed(seedset, Seed<int,SimpleSeed>(4, 4, 4), 0, Merge());
::std::cout << yep << " " << length(seedset) << " " <<
leftDim0(*begin(seedset)) << "-" << rightDim0(*begin(seedset)) <<
::std::endl;
gives:
1 1 0-3
0 1 0-3
rather than:
1 1 0-3
1 1 0-7
And finally, its called SeedSet but if a merge is not successful, like
in the last example, no new member in the set is added (by default).
Why so? Using appendValue() does also give a compiler error:
SeedSet< int, SimpleSeed, DefaultNoScore , void > seedset(100, 0);
bool yep = addSeed(seedset, Seed<int,SimpleSeed>(0, 0, 4),Single());
::std::cout << yep << " " << length(seedset) << " " <<
leftDim0(*begin(seedset)) << "-" << rightDim0(*begin(seedset)) <<
::std::endl;
yep = addSeed(seedset, Seed<int,SimpleSeed>(4, 4, 4), 0, Merge());
::std::cout << yep << " " << length(seedset) << " " <<
leftDim0(*begin(seedset)) << "-" << rightDim0(*begin(seedset)) <<
::std::endl;
if (not yep)
appendValue(seedset, Seed<int,SimpleSeed>(4, 4, 4));
::std::cout << yep << " " << length(seedset) << " " <<
leftDim0(*begin(seedset)) << "-" << rightDim0(*begin(seedset)) <<
::std::endl;
Cheers,
Fabian
--
Fabian Buske
Institute for Molecular Bioscience
The University of Queensland
Brisbane, Qld. 4072 Australia
Phone: (61)-(7)-334-62608