FU Logo
  • Startseite
  • Kontakt
  • Impressum
  • Home
  • Listenauswahl
  • Anleitungen

Re: [Seqan-dev] parseString funktion in a Trie

<-- thread -->
<-- date -->
  • From: Jakob Schulze <jakob.schulze@fu-berlin.de>
  • To: seqan-dev@lists.fu-berlin.de
  • Date: Tue, 18 Sep 2012 11:33:51 +0200
  • Reply-to: SeqAn Development <seqan-dev@lists.fu-berlin.de>
  • 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

  
parseStringInTrie.cpp
#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 = "caac"; Iterator<Dna>::Type itBegin = begin(str) + 1; Iterator<Dna>::Type itEnd = end(str); TVertexDescriptor finalVertex = getNil<TVertexDescriptor>(); finalVertex = parseString(g, getRoot(g), itBegin, itEnd); cout << "finalVertex = " << finalVertex << endl; cout << "finalVertex == root" << "\t" << isRoot(g, finalVertex) << endl; write(cout, g, DotDrawing()); return 0; }
_______________________________________________ seqan-dev mailing list seqan-dev@lists.fu-berlin.de https://lists.fu-berlin.de/listinfo/seqan-dev
<-- thread -->
<-- date -->
  • References:
    • [Seqan-dev] parseString funktion in a Trie
      • From: Jakob Schulze <jakob.schulze@fu-berlin.de>
    • Re: [Seqan-dev] parseString funktion in a Trie
      • From: "Holtgrewe, Manuel" <manuel.holtgrewe@fu-berlin.de>
  • seqan-dev - September 2012 - Archives indexes sorted by:
    [ thread ] [ subject ] [ author ] [ date ]
  • Complete archive of the seqan-dev mailing list
  • More info on this list...

Hilfe

  • FAQ
  • Dienstbeschreibung
  • ZEDAT Beratung
  • postmaster@lists.fu-berlin.de

Service-Navigation

  • Startseite
  • Listenauswahl

Einrichtung Mailingliste

  • ZEDAT-Portal
  • Mailinglisten Portal