1
0

DNA.qsrc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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] = 'generateM':
  82. $RESULT = mid($ARGS[1],12,11) + mid($ARGS[1],34,22) + mid(func('DNA','create'),1,43)
  83. end
  84. if $ARGS[0] = 'generateF':
  85. $RESULT = mid($ARGS[1],23,11) + mid($ARGS[1],56,21) + ' ' + mid(func('DNA','create'),1,43)
  86. end
  87. if $ARGS[0] = 'generate':
  88. !!Creating its own DNA string from parent DNAs
  89. !!The order of the arguments are important, first is always the female
  90. $momDNA = $ARGS[1]
  91. $dadDNA = $ARGS[2]
  92. !!mother ID
  93. $temp[0] = $mid ($momDNA, 1, 10)
  94. !!father ID
  95. $temp[1] = $mid ($dadDNA, 1, 10)
  96. !!maternal grandmother ID
  97. $temp[2] = $mid ($momDNA, 12, 10)
  98. !!maternal grandfather ID
  99. $temp[3] = $mid ($momDNA, 23, 10)
  100. !!paternal grandmother ID
  101. $temp[4] = $mid ($dadDNA, 12, 10)
  102. !!paternal grandfather ID
  103. $temp[5] = $mid ($dadDNA, 23, 10)
  104. $RESULT = str(rand(0,9)) + mid(str(rand(1000000000,1999999999)),2,9) + ' ' + $temp[0] + ' ' + $temp[1] + ' ' + $temp[2] + ' ' + $temp[3] + ' ' + $temp[4] + ' ' + $temp[5]
  105. killvar 'temp'
  106. killvar 'momDNA'
  107. killvar 'dadDNA'
  108. end
  109. --- DNA ---------------------------------