orfDirection(vng0001h,forward).
orfDirection(vng0002g,forward).
orfDirection(vng0003c,forward).
orfDirection(vng0005h,forward).
orfDirection(vng0006g,reverse).
orfDirection(vng0008g,reverse).
orfDirection(vng0009g,reverse).
orfDirection(vng0011c,forward).
orfDirection(vng0013c,reverse).
orfDirection(vng0014c,forward).
orfDirection(vng0015h,reverse).
orfDirection(vng0016h,reverse).
orfDirection(vng0017h,forward).
orfDirection(vng0018h,forward).
orfDirection(vng0019h,forward).
orfDirection(vng0020h,reverse).
orfDirection(vng0021h,forward).
orfDirection(vng0022h,forward).
orfDirection(vng0023h,forward).
orfDirection(vng0024h,reverse).
orfDirection(vng0025h,reverse).
orfDirection(vng0026c,reverse).
orfDirection(vng0027h,reverse).
orfDirection(vng0028c,forward).
orfDirection(vng0029h,reverse).
orfDirection(vng0030h,forward).
orfDirection(vng0031h,forward).
orfDirection(vng0032h,forward).
orfDirection(vng0033h,reverse).
orfEnd(vng0001h,1450).
orfEnd(vng0002g,2112).
orfEnd(vng0003c,3251).
orfEnd(vng0005h,5640).
orfEnd(vng0006g,5649).
orfEnd(vng0008g,7457).
orfEnd(vng0009g,8658).
orfEnd(vng0011c,11410).
orfEnd(vng0013c,11481).
orfEnd(vng0014c,13184).
orfEnd(vng0015h,13465).
orfEnd(vng0016h,13812).
orfEnd(vng0017h,14777).
orfEnd(vng0018h,15128).
orfEnd(vng0019h,15405).
orfEnd(vng0020h,15422).
orfEnd(vng0021h,17703).
orfEnd(vng0022h,18899).
orfEnd(vng0023h,19527).
orfEnd(vng0024h,19706).
orfEnd(vng0025h,20222).
orfEnd(vng0026c,20536).
orfEnd(vng0027h,22106).
orfEnd(vng0028c,23887).
orfEnd(vng0029h,24112).
orfEnd(vng0030h,26593).
orfEnd(vng0031h,29005).
orfEnd(vng0032h,29426).
orfEnd(vng0033h,29479).
orfStart(vng0001h,248).
orfStart(vng0002g,1450).
orfStart(vng0003c,2145).
orfStart(vng0005h,3322).
orfStart(vng0006g,7451).
orfStart(vng0008g,8641).
orfStart(vng0009g,9860).
orfStart(vng0011c,9980).
orfStart(vng0013c,12614).
orfStart(vng0014c,12978).
orfStart(vng0015h,13644).
orfStart(vng0016h,14180).
orfStart(vng0017h,14484).
orfStart(vng0018h,14868).
orfStart(vng0019h,15310).
orfStart(vng0020h,16051).
orfStart(vng0021h,16342).
orfStart(vng0022h,18357).
orfStart(vng0023h,18895).
orfStart(vng0024h,20023).
orfStart(vng0025h,20482).
orfStart(vng0026c,21456).
orfStart(vng0027h,22750).
orfStart(vng0028c,23336).
orfStart(vng0029h,24564).
orfStart(vng0030h,26201).
orfStart(vng0031h,26648).
orfStart(vng0032h,29046).
orfStart(vng0033h,29913).

sameTranscriptionDirection(A,B) :-
  orfDirection(A,D),
  orfDirection(B,D),
  A<>B.

operonNeighbors(A,B,Direction,Gap) :-
  sameTranscriptionDirection(A,B),
  orfStart(B,S), 
  orfEnd(A,E),
  Gap = S - E,
  Gap >= 0,
  Gap <= 100,
  orfDirection(A,Direction).
  
:- solve(operonNeighbors(A,B,Direction,Gap)).
