Subject: Re: [Seqan-dev] parseString funktion in a Trie
Thanks that solved the problem so far.
I got confused with the parameter and the return value, but it's clear
now.
Jakob
As a side node: You can print your trie (and other graphs in SeqAn) in .dot format using the following line. You can visualize the results using the graphviz package.
write(cout, g, DotDrawing());
What exactly is it that you want to achieve?
The function parseString returns the target vertex descriptor:
http://docs.seqan.de/seqan/dev/FUNCTION.parse_String.html
Attached is a slightly modified version of your example:
(1) The trie is printed to stdout using write().
(2) The query string is built simply by assigment from a C-style string.
(3) I use finalVertex = parseString(g, getRoot(g), itBegin, itEnd); since this is probably what you want to do.
HTH
*m
________________________________________
From: Jakob Schulze [jakob.schulze@fu-berlin.de]
Sent: Tuesday, September 18, 2012 10:49 AM
To: seqan-dev@lists.fu-berlin.de
Subject: [Seqan-dev] parseString funktion in a Trie
Hi,
I constructed a Trie with createTrie and then I tried to call
parseString. The following error message came up:
seqan-trunk/core/include/seqan/graph_types/graph_impl_automaton.h:905
Assertion failed : idInUse(g.data_id_managerV, vertex) should be true
but was 0
When I broke my program down, I saw that my parseString call does not
work at all. (But the error message vanished mysteriously) It should
store the final Vertex, but it doesn't.
Regards,
Jakob
Here my little code example: (without error message)
#include <iostream>
#include <seqan/graph_algorithms.h>
#include <seqan/graph_types.h>
using namespace seqan;
using namespace std;
int main() {
typedef Graph<Automaton<Dna> > TGraph;
typedef VertexDescriptor<TGraph>::Type TVertexDescriptor;
String<String<unsigned int> > terminalStateMap;
TGraph g;
String<CharString> sequenceList;
appendValue(sequenceList, "aat");
appendValue(sequenceList, "aac");
createTrie(g, terminalStateMap, sequenceList);
DnaString str;
appendValue(str, 'c');
appendValue(str, 'a');
appendValue(str, 'a');
appendValue(str, 'c');
Iterator<Dna>::Type itBegin = begin(str) + 1;
Iterator<Dna>::Type itEnd = end(str);
TVertexDescriptor finalVertex = getRoot(g);
parseString(g, finalVertex, itBegin, itEnd);
cout << "finalVertex = " << finalVertex << endl;
cout << "finalVertex == root" << "\t" << isRoot(g, finalVertex) <<
endl;
return 0;
}
Output:
finalVertex = 0
finalVertex == root 1