% File: hipp-dec-s1-gus-asp.lp % Author: Ferhan Ture % Date: 12-20-07 % Run with command: lparse -c n=5 -c m=4 -c k=5 -d none --true-negation hipp-dec-s1-gus-asp.lp P0.happ | clasp % HIPP-DEC formulation with S1, according to Gusfield's definition %HIPP-DEC Given a set G of n genotypes each with m sites, and a positive integer k, decide whether there is a set H of k 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]. %S1 Every haplotype h in H is different from all other haplotypes in H. geno(1..n). % n genotypes site(1..m). % m sites haplo(1..k). % 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). % S1 : All haplotypes should be unique different(H1,H2,J) :- 1{h(H1,J), h(H2,J)}1, haplo(H1;H2), H1