Algorithm 1.
Pseudo code for FASTA conversion
input : Splice graph G |
output : A compact FASTA file F that is correct and L-complete with regard to G |
FUNCTION main(Graph G(V, E)) |
begin |
Forall u ∈ V |
If (Not(Visited(u)) |
F=DFS(u, EmptyString) |
Print(F) |
end |
FUNCTION DFS(node u, str x) |
begin |
If (Visited(u)) |
F = DFSFiniteLength(u,x,L) |
Else If (TERMINAL(u)) |
Visited(u) = True |
Else |
Visited(u) = True |
x = x + str(u) |
ForAll (outgoing neighbors v) |
If (NotFirstEdge(u → v)) |
x = suffixL(x) |
F=DFS(v,x) |
Return(F) |
end |
input : Splice graph G, node u, str x, length l |
output : All sequences of length l that start from node u |
FUNCTION DFSFiniteLength(node u, str x, length l) |
begin |
If (length(u) > l) |
Else If (TERMINAL(u)) |
Else |
l = l - length(u) |
x = x + str(u) |
ForAll (outgoing neighbor v) |
If (NotFirstEdge(u → v)) |
x = suffixL(x) |
F=DFSFiniteLength(v,x,l) |
Return(F) |
end |