Skip to main content
. Author manuscript; available in PMC: 2015 Jan 3.
Published in final edited form as: J Proteome Res. 2013 Jul 17;13(1):21–28. doi: 10.1021/pr400294c

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
                F=F{x+str(u)}
    Else
        Visited(u) = True
        x = x + str(u)
        ForAll (outgoing neighbors v)
            If (NotFirstEdge(uv))
                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)
                F=F{x+prefixl(str(u))}
    Else If (TERMINAL(u))
                F=F{x+str(u)}
    Else
        l = l - length(u)
        x = x + str(u)
        ForAll (outgoing neighbor v)
            If (NotFirstEdge(uv))
                x = suffixL(x)
            F=DFSFiniteLength(v,x,l)
    Return(F)
end
HHS Vulnerability Disclosure