Skip to main content
. 2016 Oct 5;6:33987. doi: 10.1038/srep33987

Table 2.

Algorithm 2 Decycle: REMOVE ALL CYCLES FROM A GRAPH
Require: A directed graph Inline graphic, including:
 a function Inline graphic (e) that specifies the successors to node e, and
 a function Inline graphic (e) that specifies the predecessors to node e
 a function f(e) that specifies frequency of epitope e in the population
Require: Functions STRONGLY_CONNECTED_COMPONENTS and SHORTEST_PATH,  both are provided by NetworkX software package41
1: repeat  
2:  J ← STRONGLY_CONNECTED_COMPONENTS (Inline graphic)
  J is a list of all components; each component is a list of nodes in Inline graphic
3:  J ← J − {j ∈ J, such that |j| = 1}  
     ▹ Discard all single-node components – no cycles there!
4:  for all j ∈ J do                ▹ For each component
5:   repeat  
6:    Choose (a, b) ∈ j Randomly choose two nodes from the selected component
7:    C ← CYCLEFROMTWONODES(Inline graphic, a, b)  
8:    if C ≠ ∅ then  
9:     (ea, eb) ← WEAKEDGEINCYCLE(Inline graphic, C)  
10:     Remove edge (ea, eb) from Inline graphic  
11:    until C = ∅  
12: until J = ∅           ▹ Inline graphic is acyclic; we are done.
13: procedure CYCLEFROMTWONODES(Inline graphic, a, b)  
14:  Pab ← SHORTEST_PATH(Inline graphic, a, b)  
15:  Pba ← SHORTEST_PATH(Inline graphic, a, b)  
16:  if either call to SHORTEST_PATH fails then  
17:   C ← ∅  
18:  else  
19:   C ← Pab + Pba         ▹ Merge two paths into a cycle
20:  return C  
21: procedure WEAKEDGEINCYCLE(Inline graphic, C)  
22:  Write C as a list of nodes [e1, …, ek] and edges [(e1, e2), (e2, e3), …, (ek, e1)]  
23:  for all (ei, ej) in [(e1, e2), (e2, e3), …, (ek, e1)] do  
24:   vij ← f(ei) + f(ej)        ▹ v is heuristic “value” of edge
25:   vij ← vij + f (ei) if |Inline graphic(ei)| = 1        ▹ Add value if cutting edge would isolate ei
26:   vij ← vij + f (ej) if |Inline graphic(ej)| = 1        ▹ Add value if cutting edge would isolate ej
27:  Let io, jo ← argmin vij  
28:  return(Inline graphic,Inline graphic)        ▹ return lowest-value edge in cycle
Algorithm 3 Cocktail: FIND (AND ITERATIVELY REFINE) A SET OF m ANTIGENS
Require: Directed Acyclic Graph Inline graphic, including
 a function f (e) that specifies frequency of epitope e in the population
Require: Function EPIGRAPH(Inline graphic, f) that returns a sequence q, corresponding to a path through the graph Inline graphic that maximizes Inline graphic
 ▷See Algorithm 1  
1: Inline graphic ← ∅  
2: f*(e) ← f (e) for all epitopes e ∈ Inline graphic  ▷Initialize
3: for n = 1 … m do  ▷Sequential solution
4:  qn ← EPIGRAPH(Inline graphic, f*)  ▷Compute next antigen sequence qn
5:  Inline graphic ← Inline graphic ∪ {qn}  ▷Add qn to vaccine
6:  for e ∈ Inline graphic (qn) do  ▷Now that e is in the vaccine
7:   f*(e) ← 0  ▷No credit for including e in subsequent antigens
   ▷At this point, f*(e) = 0 for all e ∈ Inline graphic (Inline graphic)
8: repeat  ▷Iterative Refinement (optional)
9:  for n = 1 … m do  
10:   Inline graphicInline graphic− {qn}  ▷Remove sequence qn from vaccine
11:   for e ∈ Inline graphic (Inline graphic) − Inline graphic (qn) do  ▷With e not in the vaccine anymore,
12:    f*(e) ← f(e)  ▷f*(e) gives credit for including e in subsequent antigens
13:   qn ← EPIGRAPH(Inline graphic, f*)  ▷Compute replacement for old sequence qn
14:   Inline graphic← Inline graphic ∪ {qn}  ▷Add qn to vaccine
15:   f*(e) ← 0 for all e ∈ Inline graphic (qn)  
16: until no change in q1, …, qm  
17: return cocktail of m sequences: Inline graphic = {q1, …, qm}  
Algorithm 4 TTV: TAILORED THERAPEUTIC VACCINE
Require: Sequence set Inline graphic = {s1, …, sN},
Require: Directed Acyclic Graph, Inline graphic
Require: Function EPIGRAPH(Inline graphic, f) that returns a sequence q, corresponding to a path through the graph Inline graphic that maximizes Inline graphicInline graphic
   ▷See Algorithm 1
1: Define u(s, e) = 1 if epitope e appears in sequence s  ▷i.e., if e ∈ Inline graphic (s)
2: f(e) ← (1/N) Inline graphic  ▷Frequency of epitope e in sequence set Inline graphic
3: qo ← EPIGRAPH(Inline graphic, f)  ▷qo is centroid of the full data set Inline graphic
4: Randomly select m − 1 sequences from Inline graphic; call them q1, …, qm−1.  
5: repeat  
6:  Initialize: Inline graphic1 = … = Inline graphicm−1 = ∅  
7:  for i = 1…N do  ▷Loop over sequences
8:   for n = 1…m−1 do  ▷Loop over centroids
9:    Inline graphic  ▷Coverage of sequence si by antigens {qo, qn}
   ▷Here, u({qo, qn}, e) = max[u(qo,. e), u(qn, e)]
10:   n ← argmaxncin  
11:   Inline graphicn ← Inline graphicn ∪ {si}  ▷Put si into cluster Inline graphicn
12:  for n = 1…m − 1 do  ▷Loop over clusters
13:   f (n)(e)(1/N) ← Inline graphic  ▷Frequency of e in sequence cluster Inline graphicn
14:   f (n)(e) ← 0 for all e ∈ Inline graphic (qo)  ▷No credit for epitopes already covered by qo
15:   qn ← EPIGRAPH(Inline graphic, f (n))  ▷New centroid for Inline graphicn
16: until convergence  
17: return tailored therapeutic vaccine: qo, q1, …, qm−1