1
0

DNA 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. # DNA
  2. if $ARGS[0] = 'compare':
  3. !!Comparing two DNA string, if match, gives back 1
  4. if $ARGS[1] = $ARGS[2]:
  5. result = 1
  6. else
  7. result = 0
  8. end
  9. end
  10. if $ARGS[0] = 'relate':
  11. !!Comparing two DNA string to determine genetic relation
  12. !!First sample
  13. !!own ID
  14. temp1[0] = $mid ($ARGS[1], 1, 10)
  15. !!mother ID
  16. temp1[1] = $mid ($ARGS[1], 12, 10)
  17. !!father ID
  18. temp1[2] = $mid ($ARGS[1], 23, 10)
  19. !!maternal grandmother ID
  20. temp1[3] = $mid ($ARGS[1], 34, 10)
  21. !!maternal grandfather ID
  22. temp1[4] = $mid ($ARGS[1], 45, 10)
  23. !!paternal grandmother ID
  24. temp1[5] = $mid ($ARGS[1], 56, 10)
  25. !!paternal grandfather ID
  26. temp1[6] = $mid ($ARGS[1], 67, 10)
  27. !!Second sample
  28. !!own ID
  29. temp2[0] = $mid ($ARGS[2], 1, 10)
  30. !!mother ID
  31. temp2[1] = $mid ($ARGS[2], 12, 10)
  32. !!father ID
  33. temp2[2] = $mid ($ARGS[2], 23, 10)
  34. !!maternal grandmother ID
  35. temp2[3] = $mid ($ARGS[2], 34, 10)
  36. !!maternal grandfather ID
  37. temp2[4] = $mid ($ARGS[2], 45, 10)
  38. !!paternal grandmother ID
  39. temp2[5] = $mid ($ARGS[2], 56, 10)
  40. !!paternal grandfather ID
  41. temp2[6] = $mid ($ARGS[2], 67, 10)
  42. if temp1[0] = temp2[1] or temp1[0] = temp2[2] or temp2[0] = temp1[1] or temp2[0] = temp1[2]:
  43. 'Parent-child relation'
  44. if temp1[0] = temp2[1] or temp1[0] = temp2[2]:
  45. !!temp1 is the parent, temp2 is child
  46. if temp2[1] = temp2[5] or temp2[2] = temp2[4]:'Child is the result of incest (parent is also grandparent)'
  47. if temp2[3] = temp2[5] and temp2[4] = temp2[6]:'Child is result of incest with close family member (sibling)'
  48. if temp2[3] = temp2[5] or temp2[4] = temp2[6]:'Child is result of incest with close family member (half sibling)'
  49. elseif temp2[0] = temp1[1] or temp2[0] = temp1[2]:
  50. !!temp2 is the parent, temp1 is child
  51. if temp1[1] = temp1[5] or temp1[2] = temp1[4]:'Child is the result of incest (parent is also grandparent)'
  52. if temp1[3] = temp1[5] and temp1[4] = temp1[6]:'Child is result of incest with close family member (sibling)'
  53. if temp1[3] = temp1[5] or temp1[4] = temp1[6]:'Child is result of incest with close family member (half sibling)'
  54. end
  55. elseif temp1[0] = temp2[3] or temp1[0] = temp2[4] or temp1[0] = temp2[5] or temp1[0] = temp2[6] or temp2[0] = temp1[3] or temp2[0] = temp1[4] or temp2[0] = temp1[5] or temp2[0] = temp1[6]:
  56. 'Grandparent-grandchild relation'
  57. elseif temp1[1] = temp2[1] or temp1[2] = temp2[2]:
  58. 'Sibling relation'
  59. if temp1[1] = temp2[1] and temp1[2] = temp2[2]:'Full sibling'
  60. if temp1[1] ! temp2[1] or temp1[2] ! temp2[2]:'Half sibling'
  61. elseif temp1[1] ! temp2[1] and temp1[2] ! temp2[2]:
  62. if temp1[3] = temp2[3] and temp1[4] = temp2[4] or temp1[3] = temp2[5] and temp1[4] = temp2[6]:
  63. 'first cousins'
  64. elseif temp1[3] = temp2[3] or temp1[4] = temp2[4] or temp1[3] = temp2[5] or temp1[4] = temp2[6]:
  65. 'distand blood relation'
  66. end
  67. end
  68. killvar 'temp1'
  69. killvar 'temp2'
  70. end
  71. if $ARGS[0] = 'create':
  72. !!If no known parentage, generate a DNA string, as Tabula Rasa
  73. icr = 0
  74. :DNAloop
  75. $DNA += str(rand(0,9)) + mid(str(rand(1000000000,1999999999)),2,9)
  76. if icr < 6:$DNA += ' ' & icr += 1 & jump 'DNAloop'
  77. $RESULT = $DNA
  78. killvar '$DNA'
  79. killvar 'icr'
  80. end
  81. if $ARGS[0] = 'generate':
  82. !!Creating its own DNA string from parent DNAs
  83. !!The order of the arguments are important, first is always the female
  84. $momDNA = $ARGS[1]
  85. $dadDNA = $ARGS[2]
  86. !!mother ID
  87. $temp[0] = $mid ($momDNA, 1, 10)
  88. !!father ID
  89. $temp[1] = $mid ($dadDNA, 1, 10)
  90. !!maternal grandmother ID
  91. $temp[2] = $mid ($momDNA, 12, 10)
  92. !!maternal grandfather ID
  93. $temp[3] = $mid ($momDNA, 23, 10)
  94. !!paternal grandmother ID
  95. $temp[4] = $mid ($dadDNA, 12, 10)
  96. !!paternal grandfather ID
  97. $temp[5] = $mid ($dadDNA, 23, 10)
  98. $RESULT = str(rand(0,9)) + mid(str(rand(1000000000,1999999999)),2,9) + ' ' + $temp[0] + ' ' + $temp[1] + ' ' + $temp[2] + ' ' + $temp[3] + ' ' + $temp[4] + ' ' + $temp[5]
  99. killvar 'temp'
  100. killvar 'momDNA'
  101. killvar 'dadDNA'
  102. end
  103. --- DNA -------------------------------