DNA.qsrc 4.4 KB

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