Line 66: |
Line 66: |
| = Derivation for getting the index of a genotype in an enumerated list = | | = Derivation for getting the index of a genotype in an enumerated list = |
| | | |
| + | == Observation of nested patterns == |
| An important observation here is that for the enumeration of A alleles for a given P ploidy, the enumeration of A-1 alleles for P ploidy is a subsequence. | | An important observation here is that for the enumeration of A alleles for a given P ploidy, the enumeration of A-1 alleles for P ploidy is a subsequence. |
| | | |
Line 76: |
Line 77: |
| ! scope="col"| A=1,P=3 | | ! scope="col"| A=1,P=3 |
| |- | | |- |
− | |1 <br> | + | |0 <br> |
| + | 1 <br> |
| 2 <br> | | 2 <br> |
| 3 <br> | | 3 <br> |
Line 95: |
Line 97: |
| 18 <br> | | 18 <br> |
| 19 <br> | | 19 <br> |
− | 20 <br>
| |
| | AAA <br> | | | AAA <br> |
| AAB <br> | | AAB <br> |
Line 135: |
Line 136: |
| |} | | |} |
| | | |
− | Another important observation here is that for a genotype <math>(a_1, a_2, .. a_P)</math>, The <math>F(P, a_p)</math>th genotype to <math>(a_1, a_2, .. a_P)</math> all end with <math>a_p</math>, this does not help distinguish the order, so we need to only examine the genotype <math>(a_1,..., a_{P-1})</math>. | + | Another important observation here is that for a genotype <math>(a_1, a_2, .. a_P)</math>, The <math>F(P, a_p)</math>th genotype to <math>(a_1, a_2, .. a_P)</math> all end with <math>a_p</math>, this does not help distinguish the order, so we need to only examine the genotype <math>(a_1,..., a_{P-1})</math>. The sub genotype <math>(a_1,..., a_{P-1})</math> is also ordered else <math>(a_1,..., a_{P})</math> is not ordered. |
| + | |
| + | {| class="wikitable" |
| + | |- |
| + | ! scope="col"| Index |
| + | ! scope="col"| A=4,P=3 |
| + | ! scope="col"| A=3,P=3 |
| + | ! scope="col"| A=2,P=3 |
| + | ! scope="col"| A=1,P=3 |
| + | |- |
| + | |0 <br> |
| + | 1 <br> |
| + | 2 <br> |
| + | 3 <br> |
| + | 4 <br> |
| + | 5 <br> |
| + | 6 <br> |
| + | 7 <br> |
| + | 8 <br> |
| + | 9 <br> |
| + | 10 <br> |
| + | 11 <br> |
| + | 12 <br> |
| + | 13 <br> |
| + | 14 <br> |
| + | 15 <br> |
| + | 16 <br> |
| + | 17 <br> |
| + | 18 <br> |
| + | 19 <br> |
| + | | AAA<br> |
| + | AAB <br> |
| + | ABB <br> |
| + | BBB <br> |
| + | AAC <br> |
| + | ABC <br> |
| + | BBC <br> |
| + | ACC <br> |
| + | BCC <br> |
| + | CCC <br> |
| + | <span style="color:#FF0000">AA</span>D <br> |
| + | <span style="color:#FF0000">AB</span>D <br> |
| + | <span style="color:#FF0000">BB</span>D <br> |
| + | <span style="color:#FF0000">AC</span>D <br> |
| + | <span style="color:#FF0000">BC</span>D <br> |
| + | <span style="color:#FF0000">CC</span>D <br> |
| + | <span style="color:#FF0000">AD</span>D <br> |
| + | <span style="color:#FF0000">BD</span>D <br> |
| + | <span style="color:#FF0000">CD</span>D <br> |
| + | <span style="color:#FF0000">DD</span>D <br> |
| + | | AAA<br> |
| + | AAB <br> |
| + | ABB <br> |
| + | BBB <br> |
| + | AAC <br> |
| + | ABC <br> |
| + | BBC <br> |
| + | ACC <br> |
| + | BCC <br> |
| + | CCC <br> |
| + | <span style="color:#FF0000">AA</span>D <br> |
| + | <span style="color:#FF0000">AB</span>D <br> |
| + | <span style="color:#FF0000">BB</span>D <br> |
| + | <span style="color:#FF0000">AC</span>D <br> |
| + | <span style="color:#FF0000">BC</span>D <br> |
| + | <span style="color:#FF0000">CC</span>D <br> |
| + | <span style="color:#FF0000">AD</span>D <br> |
| + | <span style="color:#FF0000">BD</span>D <br> |
| + | <span style="color:#FF0000">CD</span>D <br> |
| + | <span style="color:#FF0000">DD</span>D <br> |
| + | | AAA <br> |
| + | AAB <br> |
| + | ABB <br> |
| + | BBB <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> |
| + | | AAA <br> |
| + | <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> |
| + | |- |
| + | |} |
| + | == Derivation == |
| | | |
| <math>a_1, ... a_P</math> is ordered and indexed 0 to A-1. Clearly when P = 1, the enumeration of the genotypes is trivially the same as the allele. | | <math>a_1, ... a_P</math> is ordered and indexed 0 to A-1. Clearly when P = 1, the enumeration of the genotypes is trivially the same as the allele. |