Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: loci calculator

  1. #1
    Join Date
    May 2010
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default loci calculator

    Hi I am new to this forum and have limited knowledge of coding. I am a miniature dachshund breeder and am in the process of developing my genetics page. I have searched for a calculator that I can change to meet my needs......

    Ideally this is what I want:

    Sire
    3 drop down boxes - 1 for base color (1 option) the second for coat color (1 option) and the 3rd for patterns (up to 4 options)
    Then 2 dropdown list of recessive traits he may carry - 1 for color (up to 4 options) and the 2nd for pattern (up to 3 options)

    Plus

    Dam
    3 drop down boxes - 1 for base color (1 option) the second for coat color (1 option) and the 3rd for patterns (up to 4 options)
    Then 2 dropdown list of recessive traits she may carry - 1 for color (up to 4 options) and the 2nd for pattern (up to 3 options)


    Equals Progeny:

    Predefined pictures based on the choices selected above


    I could settle for this:

    Sire pic plus Dam pic = resulting progeny

    Then a gallery of pictures of all the combinations below so users can choose the pic of the sire and pic of the dam then a seperate predefined pic comes up depending on the 2 pics selected

    is there a code I can adapt? Any and all help is greatly appreciated

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    This is something that must be designed specially for your case (unless of course you can find a free dog breed script out there-- try google, and you might get lucky, but probably not).

    There are a number of ways to go about this, but most if not all are going to require that you get involved with the code at a fairly advanced level.

    Of course you could just create the pictures manually and set them as links.

    But that would take a lot of time and probably in the end be more work.


    You could try to use Javascript for this, but in general this is probably better for a language like PHP, a serverside programming language-- or ASP, CGI, etc.
    These languages are designed to deal with forms and to generate result pages, among other things. They even work with databases if you want to do that later.

    I don't know if you'd want to take this on yourself. If so, there are lots of resources out there and feel free to post back once you get some code and we can point you in the right direction.

    If not, you could hire someone to do this for you, and since this is such a specialized task it might be the best way to go.

    If you're creative enough you may be able to look around and find something that you can adapt, but genetics calculations are (I expect) fairly complex, so you probably won't find something that works without some manipulation.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    May 2010
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I really appreciate your input -

    I was hoping there was some sort of code I could adapt to set my own probabilities like on this site: http://www.fenfleur.com/ (how to predict pup colors) but adding the recessive carried probabilities with a picture for the result instead of text like they have - maybe someone could take a look? thier calculator isn't fully functioning like its supposed to but gives the basic idea what I am looking to do.

    Nothing too complicated like if sire is black/tan (black based and carries for cream *recessive trait) and the dam is a chocolate/tan (chocolate based *recessive trait carries for piebald *recessive trait) with this combination a breeder could only get black/tans that will carry for chocolate and possibly cream and piebald because recessive traits can only be expressed if both the sire and dam has it....clear as mud right? lol

    I started looking into a sql database and php programming which seems thats the way to go if I can get my mind wrapped around it - I started to look into some of the tutorials and will give that a whirl after looking into more options first

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    All that site has is an array of answers that is determined by the two colors you pick for the parents - it's all manually defined. (And, it's not working at all.)

    If you're going to add recessive traits, etc., things will get much more complicated.

    In the end, it's not a matter of finding a programmer, it's a matter of finding a programmer who understands genetics and canine inheritance -or at least, one who can understand when you explain it really patiently. Unless you are comfortable writing out every possible trait combination and likely outcome, I wouldn't bother trying to have a script written, because it probably won't give the correct answers.

  5. #5
    Join Date
    May 2010
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    All that site has is an array of answers that is determined by the two colors you pick for the parents - it's all manually defined. (And, it's not working at all.)

    Yea thats what I figured - I knew it wasn't working just really like the concept. It was difficult for me to learn the genetics without a cheat sheat. So I figured if I were to teach others then I would like something like that as well as the detailed explanations on a different page.

    I started my code.....I just can't figure out how people can select more than one option at a time. So I took a break and started learning how to develop a SQL database - I am totally lost now so going back to my code.... is there a way to keep the drop down boxes and users able to select more than one option without it being distorted?

    Here is my code:

    <html>
    <head>
    <title> Test</title>
    </head>
    <body>
    <form name="form1" method="post" action="CCalculator2.php">
    <table width="96%" border="0" cellspacing="0" cellpadding="0" align="center" height="23">
    <tr>
    <td width="74%" class="BlueBoxV11">
    <p align="center"><b><font size="2" face="Arial"><br>
    <font size="3">Sire:</font>

    <select name="SireBaseColor" size="1" class="BodyTextV11">
    <option value="0" selected>Select Base Color</option>

    <option value="1">Black</option>

    <option value="2">Chocolate</option>

    <option value="3">Blue</option>

    <option value="4">Isabella</option>

    </select>

    <select name="SireColor" size="1" class="BodyTextV11">
    <option value="0" selected>Select Color</option>

    <option value="1">Red</option>

    <option value="2">Black</option>

    <option value="3">Chocolate</option>

    <option value="4">Cream</option>

    <option value="5">Blue</option>

    <option value="6">Isabella</option>

    </select>
    <select name="SirePattern" size="1" class="BodyTextV11">

    <option value="0" selected>Select Pattern(s)</option>

    <option value="1">Pointed Tan</option>

    <option value="2">Pointed Cream</option>

    <option value="3">Sable</option>

    <option value="4">Brindle</option>

    <option value="5">Dapple</option>

    <option value="6">Piebald</option>

    </select>
    <select name="SireCarriedColor" size="1" class="BodyTextV11">
    <option value="0" selected>Select Carried Color(s)</option>


    <option value="1">Chocolate</option>

    <option value="2">Cream</option>

    <option value="3">Blue</option>

    <option value="4">Isabella</option>


    </select>

    <select name="SireCarriedPattern" size="1" class="BodyTextV11">
    <option value="0" selected>Select Carried Pattern(s)</option>

    <option value="1">Pointed Tan</option>
    <option value="1">Pointed Cream</option>
    <option value="3">Piebald</option>
    </select>

    </font></b> </p>
    </td>
    <td width="26%" class="BlueBoxV11" rowspan="2">
    <p align="center">Select the sire and dam <br>
    Base color, coat color, pattern and carried colors and patterns then <br>
    press the Continue button. <br>
    <br>
    <input type="submit" name="Continue" value="Continue" class="BodyTextV11">
    </p>
    </td>
    </tr>
    <tr>
    <td width="74%" class="BlueBoxV11">
    <div align="center"><b><font size="2" face="Arial"><br>
    <font size="3">Dam:</font>


    <select name="DamBaseColor" size="1" class="BodyTextV11">

    <option value="0" selected>Select Base Color</option>
    <option value="1">Black</option>

    <option value="2">Chocolate</option>

    <option value="3">Blue</option>

    <option value="4">Isabella</option>

    </select>

    <select name="DamColor" size="1" class="BodyTextV11">
    <option value="0" selected>Select Color</option>

    <option value="1">Red</option>

    <option value="2">Black</option>

    <option value="3">Chocolate</option>

    <option value="4">Cream</option>
    <option value="5">Blue</option>

    <option value="6">Isabella</option>

    </select>
    <select name="DamPattern" size="1" class="BodyTextV11">

    <option value="0" selected>Select Pattern(s)</option>
    <option value="1">Pointed Tan</option>

    <option value="2">Pointed Cream</option>

    <option value="3">Sable</option>

    <option value="4">Brindle</option>

    <option value="5">Dapple</option>

    <option value="6">Piebald</option>
    </select>
    <select name="DamCarriedColor" size="1" class="BodyTextV11">
    <option value="0" selected>Select Carried Color(s)</option>

    <option value="1">Chocolate</option

    <option value="2">Cream</option>

    <option value="3">Blue</option>

    <option value="4">Isabella</option>

    </select>

    <select name="DamCarriedPattern" size="1" class="BodyTextV11">
    <option value="0" selected>Select Carried Pattern(s)</option>

    <option value="1">Pointed Tan</option>
    <option value="2">Pointed Cream</option>
    <option value="3">Piebald</option>
    </select>

    </b></div>
    </td>
    </tr>
    </table>

    </form>
    </body>
    </html>

    Once a user submits this form then they are taken to an advanced options page to select more choices (trying to do a multipage form) which I may scrap for now until after I learn how to do my database and link it altogether

  6. #6
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    You need to wrap your code in [ code ] tags ( [ code ] [/ code ], [ html ] [/ html ], [ php ] [/ php ], without the spaces) so it's easier to read and doesn't take up so much space.

    If you need a user to be able to choose more than one option on a <select> list, add the attribute multiple="yes" to the opening <select> tag. For checkboxes, you can create an array by giving multiple boxes the same name, followed by square brackets []:
    Code:
    <input type="checkbox" name="multichoice[]" value="one">
    <input type="checkbox" name="multichoice[]" value="two">
    <input type="checkbox" name="multichoice[]" value="three">

  7. #7
    Join Date
    May 2010
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Like this?

    Code:
    <html>
    <HEAD><TITLE>Test</TITLE>
    <META content="MSHTML 6.00.2900.3676" name=GENERATOR></HEAD>
    <BODY>
    <FORM name=form1 action=CCalculator2.php method=post>
    <TABLE height=23 cellSpacing=0 cellPadding=0 width="96%" align=center border=0>
    <TBODY>
    <TR>
    <TD class=BlueBoxV11 width="74%"><FONT face=Arial size=2>
    <P align=center><BR><FONT size=5><STRONG>Sire</STRONG></FONT></P>
    <P align=center><STRONG><FONT size=3>Base Color:</FONT><INPUT type=checkbox value=one name=multichoice[]></STRONG>Black</OPTION><STRONG> <INPUT type=checkbox value=two name=multichoice[]></STRONG>Chocolate</OPTION> <STRONG><INPUT type=checkbox value=three name=multichoice[]></STRONG>Blue</OPTION><STRONG> <INPUT type=checkbox value=four name=multichoice[]></STRONG>Isabella</OPTION> </SELECT></P>
    <P align=center><STRONG><FONT size=3>Base Color:</FONT><INPUT type=checkbox value=one
     name=multichoice[]></STRONG>Black</OPTION><STRONG> <INPUT type=checkbox value=two 
    name=multichoice[]></STRONG>Chocolate</OPTION> <STRONG><INPUT type=checkbox value=three 
    name=multichoice[]></STRONG>Blue</OPTION><STRONG> <INPUT type=checkbox value=four 
    name=multichoice[]></STRONG>Isabella</OPTION> </SELECT></P>
    <P align=center><STRONG><FONT size=3>Pattern:</FONT> <INPUT type=checkbox value=one name=multichoice[]></STRONG>Sable</OPTION> <INPUT type=checkbox value=two name=multichoice[]>Dapple</OPTION> <INPUT type=checkbox value=three name=multichoice[]>Brindle</OPTION> <INPUT type=checkbox value=four name=multichoice[]>Tan Pointed</OPTION> <INPUT type=checkbox value=five name=multichoice[]>Cream Pointed</OPTION> <INPUT type=checkbox value=six name=multichoice[]>Piebald</OPTION> </SELECT></P>
    <P align=center><STRONG><FONT size=3>Carried Color:</FONT> <INPUT type=checkbox value=one name=multichoice[]></STRONG>Chocolate</OPTION> <INPUT type=checkbox value=two name=multichoice[]>Isabella</OPTION> <INPUT type=checkbox value=three name=multichoice[]>Blue</OPTION> <INPUT type=checkbox value=four name=multichoice[]>Cream</OPTION> </SELECT></P>
    <P align=center><STRONG><FONT size=3>Carried Pattern:</FONT> <INPUT type=checkbox value=one name=multichoice[]></STRONG>Tan Pointed</OPTION> <INPUT type=checkbox value=two name=multichoice[]>Cream Pointed</OPTION> <INPUT type=checkbox value=three name=multichoice[]>Piebald</OPTION> </SELECT></FONT></P></FONT></TD>
    <TD class=BlueBoxV11 width="26%" rowSpan=2>
    <P align=center>Select the Sire and Dam's base color, coat color, pattern and carried colors and patterns then <BR>press the Continue button. <BR><BR><INPUT class=BodyTextV11 type=submit value=Continue name=Continue> </P></TD></TR>
    <TR>
    <TD class=BlueBoxV11 width="74%"><FONT face=Arial size=2>
    <P align=center><BR><FONT size=5><STRONG>Dam</STRONG></FONT></P>
    <P align=center><STRONG><FONT size=3>Base Color:</FONT> <INPUT type=checkbox value=one name=multichoice[]></STRONG>Black</OPTION><STRONG> <INPUT type=checkbox value=two name=multichoice[]></STRONG>Chocolate</OPTION> <STRONG><INPUT type=checkbox value=three name=multichoice[]></STRONG>Blue</OPTION><STRONG> <INPUT type=checkbox value=four name=multichoice[]></STRONG>Isabella</OPTION> </SELECT></P>
    <P align=center><STRONG><FONT size=3>Color:</FONT> <INPUT type=checkbox value=one name=multichoice[]></STRONG>Red</OPTION><STRONG> <INPUT type=checkbox value=two name=multichoice[]></STRONG>Black</OPTION> <STRONG><INPUT type=checkbox value=three name=multichoice[]></STRONG>Blue</OPTION><STRONG> <INPUT type=checkbox value=four name=multichoice[]></STRONG>Cream</OPTION> <STRONG><INPUT type=checkbox value=five name=multichoice[]></STRONG>Chocolate</OPTION> <STRONG><INPUT type=checkbox value=six name=multichoice[]></STRONG>Isabella</OPTION><STRONG> </SELECT></STRONG></P>
    <P align=center><STRONG><FONT size=3>Pattern:</FONT> <INPUT type=checkbox value=one name=multichoice[]></STRONG>Sable</OPTION> <INPUT type=checkbox value=two name=multichoice[]>Dapple</OPTION> <INPUT type=checkbox value=three name=multichoice[]>Brindle</OPTION> <INPUT type=checkbox value=four name=multichoice[]>Tan Pointed</OPTION> <INPUT type=checkbox value=five name=multichoice[]>Cream Pointed</OPTION> <INPUT type=checkbox value=six name=multichoice[]>Piebald</OPTION> </SELECT></P>
    <P align=center><STRONG><FONT size=3>Carried Color:</FONT> <INPUT type=checkbox value=one name=multichoice[]></STRONG>Chocolate</OPTION> <INPUT type=checkbox value=two name=multichoice[]>Isabella</OPTION> <INPUT type=checkbox value=three name=multichoice[]>Blue</OPTION> <INPUT type=checkbox value=four name=multichoice[]>Cream</OPTION> </SELECT></P>
    <P align=center><STRONG><FONT size=3>Carried Pattern:</FONT> <INPUT type=checkbox value=one name=multichoice[]></STRONG>Tan Pointed</OPTION> <INPUT type=checkbox value=two name=multichoice[]>Cream Pointed</OPTION> <INPUT type=checkbox value=three name=multichoice[]>Piebald</OPTION> </SELECT></FONT></P></FONT></TD></TR></TBODY></TABLE></FORM></BODY>
    </html>
    I guess I just don't understand what you mean....i'll search through the forum
    Last edited by djr33; 05-18-2010 at 09:59 PM.

  8. #8
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    RE code tags: the final tag has a slash in it: [/code].
    It's just like html, but using [] instead of <>.
    Hope this helps.
    (I fixed your code above)
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #9
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    A couple of tips:

    1) Quote ALL your attribute values. e.g., <INPUT type=checkbox> needs to be <input type="checkbox">.

    2) Use current, valid tags and attributes. align="center" and <FONT size=""> are depreciated. Use css styles instead (an inline example would be
    Code:
    <p style="font-size: small; text-align: center;"> paragraph text goes here </p>
    3) Tables are not intended as layout tools. You should use css instead, but that's not a critical issue. The two points above, however, could cause problems in some browsers.

    To answer your question, "multichoice" is just an example name. Take whatever name value you wish and add square brackets on the end to allow the user to choose more than one. Maybe:
    Code:
    <input type="checkbox" name="damcolor[]" value="chocolate">
    <input type="checkbox" name="damcolor[]" value="cream">
    The user could choose one, the other, or both colors and the script would get the answers in an array. If they chose both colors, for example, the script would see:
    Code:
    $_POST['damcolor'] = array(
      [0] => "chocolate"
      [1] => "cream"
    )
    Last edited by traq; 05-19-2010 at 02:01 AM.

  10. #10
    Join Date
    May 2010
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    OMG! Thank you guys all so much for these tips - I greatly appreciate all the help in getting me to understand what the heck I am doing ..... I am going to work on it a bit more later...On the brighter side I did figure out how to do a small database using MySQL in tutorials but have a long way to go to learn how to get it to compute the data using genetic rules and variables depending on what is selected but its a start. Now I am going to trudge back through my code - using brackets instead of <>, quote the attribute values, redo the multichoice and figure out how to do it on a css ....Anyone know of any good basic css tutorials?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •