% File: hipp-opt-gus-asp.lp % Author: Ferhan Ture % Date: 12-20-07 % Run with command: lparse -c n=5 -c m=4 -d none --true-negation hipp-opt-gus-asp.lp P0.happ | clasp 0 % HIPP formulation, according to Gusfield's definition %HIPP Given a set G of n genotypes each with m sites, find a minimal set H of haplotypes such that the following constraints are satisfied: %C1 Every genotype g in G is mapped to two haplotypes in H. %C2 For every genotype g in G, for every ambiguous site j of g, the values of the j'th sites of these haplotypes are different. %C3 For every genotype g in G, for every resolved site j of g, the values of the j'th site of these haplotypes are g[j]. geno(1..n). % n genotypes site(1..m). % m sites haplo(1..2*n). % k haplotypes index(1..2). % two haplotypes explaining a genotype % sorts of variables G, I, and J %#domain geno(G), index(I), site(J). % Generate a set of k haplotypes {h(H,J)} :- haplo(H),site(J). % Test wrt the given constraints C1--C3 % C1 1{s(I,G,H):haplo(H)}1 :- geno(G),index(I). % C2 :- s(1,G,H1), s(2,G,H2), amb(G,J), h(H1,J), h(H2,J), haplo(H1;H2), geno(G),site(J). :- s(1,G,H1), s(2,G,H2), amb(G,J), not h(H1,J), not h(H2,J), haplo(H1;H2), geno(G),site(J). % C3 :- not h(H,J), s(I,G,H), -amb(G,J), haplo(H), geno(G),site(J),index(I). :- h(H,J), s(I,G,H), not -amb(G,J), not amb(G,J), haplo(H), geno(G),site(J),index(I). mapped(H) :- s(I,G,H), index(I), geno(G), haplo(H). % Minimization statement minimize [mapped(H):haplo(H)]. hide. show s(_,_,_).