Page 1
Student ID: 158, P-Value: 9.66e-09
Nearest Neighbor ID: 79
Student (left) and Nearest Neighbor (right).
t | import math | t | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
| nRemainder = nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3**digit)) | | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| def countBases(seq): | | def countBases(seq): |
| bases = ['A','C','G','T'] | | bases = ['A','C','G','T'] |
| counts = [] | | counts = [] |
| for base in bases: | | for base in bases: |
| count = 0 | | count = 0 |
| for char in seq: | | for char in seq: |
| if(base == char): | | if(base == char): |
| count += 1 | | count += 1 |
| counts.append(count) | | counts.append(count) |
| A = counts[0] | | A = counts[0] |
| C = counts[1] | | C = counts[1] |
| G = counts[2] | | G = counts[2] |
| T = counts[3] | | T = counts[3] |
| cg_percentage = (C+G)*100 / len(seq) | | cg_percentage = (C+G)*100 / len(seq) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' | | seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' |
| countBases(seq) | | countBases(seq) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if(len(seq_a) != len(seq_b)): | | if(len(seq_a) != len(seq_b)): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| count = 0 | | count = 0 |
| for char1,char2 in zip(seq_a,seq_b): | | for char1,char2 in zip(seq_a,seq_b): |
| if(char1 != char2): | | if(char1 != char2): |
| count += 1 | | count += 1 |
| return(count) | | return(count) |
| seq_a = 'GATATCGTCTGGGACCT' | | seq_a = 'GATATCGTCTGGGACCT' |
| seq_b = 'CATCGCATTTACGGCCT' | | seq_b = 'CATCGCATTTACGGCCT' |
| hammingdistance(seq_a, seq_b) | | hammingdistance(seq_a, seq_b) |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 2
Student ID: 79, P-Value: 9.66e-09
Nearest Neighbor ID: 158
Student (left) and Nearest Neighbor (right).
t | import math | t | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
| nRemainder = nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3**digit)) | | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| def countBases(seq): | | def countBases(seq): |
| bases = ['A','C','G','T'] | | bases = ['A','C','G','T'] |
| counts = [] | | counts = [] |
| for base in bases: | | for base in bases: |
| count = 0 | | count = 0 |
| for char in seq: | | for char in seq: |
| if(base == char): | | if(base == char): |
| count += 1 | | count += 1 |
| counts.append(count) | | counts.append(count) |
| A = counts[0] | | A = counts[0] |
| C = counts[1] | | C = counts[1] |
| G = counts[2] | | G = counts[2] |
| T = counts[3] | | T = counts[3] |
| cg_percentage = (C+G)*100 / len(seq) | | cg_percentage = (C+G)*100 / len(seq) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' | | seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' |
| countBases(seq) | | countBases(seq) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if(len(seq_a) != len(seq_b)): | | if(len(seq_a) != len(seq_b)): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| count = 0 | | count = 0 |
| for char1,char2 in zip(seq_a,seq_b): | | for char1,char2 in zip(seq_a,seq_b): |
| if(char1 != char2): | | if(char1 != char2): |
| count += 1 | | count += 1 |
| return(count) | | return(count) |
| seq_a = 'GATATCGTCTGGGACCT' | | seq_a = 'GATATCGTCTGGGACCT' |
| seq_b = 'CATCGCATTTACGGCCT' | | seq_b = 'CATCGCATTTACGGCCT' |
| hammingdistance(seq_a, seq_b) | | hammingdistance(seq_a, seq_b) |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 3
Student ID: 215, P-Value: 2.29e-08
Nearest Neighbor ID: 478
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
| nRemainder = nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3**digit)) | | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
n | return boardListdef countBases(seq): | n | return boardListdef countBases(seq): |
| A = str(seq).count('A') | | A = str(seq).count('A') |
| T = str(seq).count('T') | | T = str(seq).count('T') |
| C = str(seq).count('C') | | C = str(seq).count('C') |
| G = str(seq).count('G') | | G = str(seq).count('G') |
t | cg_percentage = (C/ len(str(seq)))*100 + (G/ len(str(seq)))*100 | t | cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| s= seq_a | | s= seq_a |
| t= seq_b | | t= seq_b |
| count=0 | | count=0 |
| for i in range(len(s)): | | for i in range(len(s)): |
| if s[i]!= t[i]: | | if s[i]!= t[i]: |
| count+=1 | | count+=1 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| return count | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 4
Student ID: 478, P-Value: 2.29e-08
Nearest Neighbor ID: 215
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
| nRemainder = nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3**digit)) | | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
n | return boardListdef countBases(seq): | n | return boardListdef countBases(seq): |
| A = str(seq).count('A') | | A = str(seq).count('A') |
| T = str(seq).count('T') | | T = str(seq).count('T') |
| C = str(seq).count('C') | | C = str(seq).count('C') |
| G = str(seq).count('G') | | G = str(seq).count('G') |
t | cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100) | t | cg_percentage = (C/ len(str(seq)))*100 + (G/ len(str(seq)))*100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| s= seq_a | | s= seq_a |
| t= seq_b | | t= seq_b |
| count=0 | | count=0 |
| for i in range(len(s)): | | for i in range(len(s)): |
| if s[i]!= t[i]: | | if s[i]!= t[i]: |
| count+=1 | | count+=1 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| return count | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 5
Student ID: 354, P-Value: 7.11e-08
Nearest Neighbor ID: 79
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
t | nRemainder = nBoard | t | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3**digit)) | | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| def countBases(seq): | | def countBases(seq): |
| bases = ['A','C','G','T'] | | bases = ['A','C','G','T'] |
| counts = [] | | counts = [] |
| for base in bases: | | for base in bases: |
| count = 0 | | count = 0 |
| for char in seq: | | for char in seq: |
| if(base == char): | | if(base == char): |
| count += 1 | | count += 1 |
| counts.append(count) | | counts.append(count) |
| A = counts[0] | | A = counts[0] |
| C = counts[1] | | C = counts[1] |
| G = counts[2] | | G = counts[2] |
| T = counts[3] | | T = counts[3] |
| cg_percentage = (C+G)*100 / len(seq) | | cg_percentage = (C+G)*100 / len(seq) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' | | seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' |
| countBases(seq) | | countBases(seq) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if(len(seq_a) != len(seq_b)): | | if(len(seq_a) != len(seq_b)): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| count = 0 | | count = 0 |
| for char1,char2 in zip(seq_a,seq_b): | | for char1,char2 in zip(seq_a,seq_b): |
| if(char1 != char2): | | if(char1 != char2): |
| count += 1 | | count += 1 |
| return(count) | | return(count) |
| seq_a = 'GATATCGTCTGGGACCT' | | seq_a = 'GATATCGTCTGGGACCT' |
| seq_b = 'CATCGCATTTACGGCCT' | | seq_b = 'CATCGCATTTACGGCCT' |
| hammingdistance(seq_a, seq_b) | | hammingdistance(seq_a, seq_b) |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 6
Student ID: 37, P-Value: 8.31e-08
Nearest Neighbor ID: 478
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
| nRemainder = nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3**digit)) | | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardListdef countBases(seq): | | return boardListdef countBases(seq): |
| A = str(seq).count('A') | | A = str(seq).count('A') |
| T = str(seq).count('T') | | T = str(seq).count('T') |
| C = str(seq).count('C') | | C = str(seq).count('C') |
| G = str(seq).count('G') | | G = str(seq).count('G') |
| cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100) | | cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| s= seq_a | | s= seq_a |
| t= seq_b | | t= seq_b |
| count=0 | | count=0 |
| for i in range(len(s)): | | for i in range(len(s)): |
| if s[i]!= t[i]: | | if s[i]!= t[i]: |
| count+=1 | | count+=1 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| return count | | return count |
t | | t | if __name__=="__main__": |
| | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 7
Student ID: 395, P-Value: 1.22e-07
Nearest Neighbor ID: 79
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
| nRemainder = nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3**digit)) | | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
t | return boardListdef countBases(seq): | t | return boardList |
| | | def countBases(seq): |
| bases = ['A','C','G','T'] | | bases = ['A','C','G','T'] |
| counts = [] | | counts = [] |
| for base in bases: | | for base in bases: |
| count = 0 | | count = 0 |
| for char in seq: | | for char in seq: |
| if(base == char): | | if(base == char): |
| count += 1 | | count += 1 |
| counts.append(count) | | counts.append(count) |
| A = counts[0] | | A = counts[0] |
| C = counts[1] | | C = counts[1] |
| G = counts[2] | | G = counts[2] |
| T = counts[3] | | T = counts[3] |
| cg_percentage = (C+G)*100 / len(seq) | | cg_percentage = (C+G)*100 / len(seq) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' | | seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' |
| countBases(seq) | | countBases(seq) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if(len(seq_a) != len(seq_b)): | | if(len(seq_a) != len(seq_b)): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| count = 0 | | count = 0 |
| for char1,char2 in zip(seq_a,seq_b): | | for char1,char2 in zip(seq_a,seq_b): |
| if(char1 != char2): | | if(char1 != char2): |
| count += 1 | | count += 1 |
| return(count) | | return(count) |
| seq_a = 'GATATCGTCTGGGACCT' | | seq_a = 'GATATCGTCTGGGACCT' |
| seq_b = 'CATCGCATTTACGGCCT' | | seq_b = 'CATCGCATTTACGGCCT' |
| hammingdistance(seq_a, seq_b) | | hammingdistance(seq_a, seq_b) |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 8
Student ID: 98, P-Value: 2.01e-06
Nearest Neighbor ID: 37
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
| nRemainder = nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3**digit)) | | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
n | return boardListdef countBases(seq): | n | return boardListdef countBases(seq): |
| A = str(seq).count('A') | | A = str(seq).count('A') |
| T = str(seq).count('T') | | T = str(seq).count('T') |
| C = str(seq).count('C') | | C = str(seq).count('C') |
| G = str(seq).count('G') | | G = str(seq).count('G') |
n | cg_percentage = (C / len(str(seq)))*100 + (G / len(str(seq)))*100 | n | cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | a= seq_a | n | s= seq_a |
| b= seq_b | | t= seq_b |
| count=0 | | count=0 |
n | for i in range(len(a)): | n | for i in range(len(s)): |
| if a[i]!= b[i]: | | if s[i]!= t[i]: |
| count+=1 | | count+=1 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| return count | | return count |
t | pass | t | |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 9
Student ID: 11, P-Value: 1.92e-05
Nearest Neighbor ID: 79
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
| nRemainder = nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3**digit)) | | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
t | t = decodeBoard(2291) | t | def countBases(seq): |
| print(t) | | |
| print(findWinner(t)) | | |
| print() | | |
| t = decodeBoard(1851) | | |
| print(t) | | |
| print(findWinner(t))def countBases(seq): | | |
| bases = ['A','C','G','T'] | | bases = ['A','C','G','T'] |
| counts = [] | | counts = [] |
| for base in bases: | | for base in bases: |
| count = 0 | | count = 0 |
| for char in seq: | | for char in seq: |
| if(base == char): | | if(base == char): |
| count += 1 | | count += 1 |
| counts.append(count) | | counts.append(count) |
| A = counts[0] | | A = counts[0] |
| C = counts[1] | | C = counts[1] |
| G = counts[2] | | G = counts[2] |
| T = counts[3] | | T = counts[3] |
| cg_percentage = (C+G)*100 / len(seq) | | cg_percentage = (C+G)*100 / len(seq) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' | | seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' |
| countBases(seq) | | countBases(seq) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if(len(seq_a) != len(seq_b)): | | if(len(seq_a) != len(seq_b)): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| count = 0 | | count = 0 |
| for char1,char2 in zip(seq_a,seq_b): | | for char1,char2 in zip(seq_a,seq_b): |
| if(char1 != char2): | | if(char1 != char2): |
| count += 1 | | count += 1 |
| return(count) | | return(count) |
| seq_a = 'GATATCGTCTGGGACCT' | | seq_a = 'GATATCGTCTGGGACCT' |
| seq_b = 'CATCGCATTTACGGCCT' | | seq_b = 'CATCGCATTTACGGCCT' |
| hammingdistance(seq_a, seq_b) | | hammingdistance(seq_a, seq_b) |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 10
Student ID: 74, P-Value: 7.06e-05
Nearest Neighbor ID: 79
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
| nRemainder = nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3**digit)) | | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| def countBases(seq): | | def countBases(seq): |
| bases = ['A','C','G','T'] | | bases = ['A','C','G','T'] |
| counts = [] | | counts = [] |
| for base in bases: | | for base in bases: |
| count = 0 | | count = 0 |
| for char in seq: | | for char in seq: |
| if(base == char): | | if(base == char): |
| count += 1 | | count += 1 |
| counts.append(count) | | counts.append(count) |
| A = counts[0] | | A = counts[0] |
| C = counts[1] | | C = counts[1] |
| G = counts[2] | | G = counts[2] |
| T = counts[3] | | T = counts[3] |
n | cg = (C+G)*100 / len(seq) | n | cg_percentage = (C+G)*100 / len(seq) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' | | seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' |
| countBases(seq) | | countBases(seq) |
n | def hammingdistance(seqa, seqb): | n | def hammingdistance(seq_a, seq_b): |
| if(len(seqa) != len(seqb)): | | if(len(seq_a) != len(seq_b)): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| count = 0 | | count = 0 |
n | for c1,c2 in zip(seqa,seqb): | n | for char1,char2 in zip(seq_a,seq_b): |
| if(c1 != c2): | | if(char1 != char2): |
| count += 1 | | count += 1 |
| return(count) | | return(count) |
t | seqa = 'GATATCGTCTGGGACCT' | t | seq_a = 'GATATCGTCTGGGACCT' |
| seqb = 'CATCGCATTTACGGCCT' | | seq_b = 'CATCGCATTTACGGCCT' |
| hammingdistance(seqa, seqb) | | hammingdistance(seq_a, seq_b) |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 11
Student ID: 295, P-Value: 7.13e-04
Nearest Neighbor ID: 11
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
n | | n | if boardList[2] == boardList[4] == boardList[6]: |
| | | if boardList[2] == 1: |
| | | return 'X' |
| | | elif boardList[2] == 2: |
| | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList=[] | n | boardList = [] |
| nRemainder=nBoard | | nRemainder = nBoard |
| for digit in range(8,-1,-1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| t = decodeBoard(2291) | | t = decodeBoard(2291) |
| print(t) | | print(t) |
| print(findWinner(t)) | | print(findWinner(t)) |
| print() | | print() |
| t = decodeBoard(1851) | | t = decodeBoard(1851) |
| print(t) | | print(t) |
| print(findWinner(t))def countBases(seq): | | print(findWinner(t))def countBases(seq): |
| bases = ['A','C','G','T'] | | bases = ['A','C','G','T'] |
| counts = [] | | counts = [] |
| for base in bases: | | for base in bases: |
| count = 0 | | count = 0 |
| for char in seq: | | for char in seq: |
| if(base == char): | | if(base == char): |
n | count +=1 | n | count += 1 |
| counts.append(count) | | counts.append(count) |
| A = counts[0] | | A = counts[0] |
| C = counts[1] | | C = counts[1] |
| G = counts[2] | | G = counts[2] |
| T = counts[3] | | T = counts[3] |
| cg_percentage = (C+G)*100 / len(seq) | | cg_percentage = (C+G)*100 / len(seq) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' | | seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' |
n | print (countBases(seq)) | n | countBases(seq) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if(len(seq_a) != len(seq_b)): | | if(len(seq_a) != len(seq_b)): |
n | return "Error: Sequence Length Mismatch" | n | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| count = 0 | | count = 0 |
| for char1,char2 in zip(seq_a,seq_b): | | for char1,char2 in zip(seq_a,seq_b): |
| if(char1 != char2): | | if(char1 != char2): |
| count += 1 | | count += 1 |
| return(count) | | return(count) |
| seq_a = 'GATATCGTCTGGGACCT' | | seq_a = 'GATATCGTCTGGGACCT' |
| seq_b = 'CATCGCATTTACGGCCT' | | seq_b = 'CATCGCATTTACGGCCT' |
t | print (hammingdistance(seq_a, seq_b)) | t | hammingdistance(seq_a, seq_b) |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 12
Student ID: 347, P-Value: 7.64e-04
Nearest Neighbor ID: 273
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[2:9:3 | n | if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[1:8:3 |
| ]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardList[3:6:1]==[1,1,1] or boardLis | | ]==[1,1,1] or boardList[2:9:3]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardLis |
| t[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or boardList[2:7:2]==[1,1,1]: | | t[3:6:1]==[1,1,1] or boardList[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or b |
| | | oardList[2:7:2]==[1,1,1]: |
| return 'X' | | return 'X' |
| elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[2:9 | | elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[1:8 |
| :3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardList[3:6:1]==[2,2,2] or boardL | | :3]==[2,2,2] or boardList[2:9:3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardL |
| ist[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or boardList[2:7:2]==[2,2,2]: | | ist[3:6:1]==[2,2,2] or boardList[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or |
| | | boardList[2:7:2]==[2,2,2]: |
| return 'O' | | return 'O' |
n | else: | n | else: |
| return '-' | | return '-' |
n | | n | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=int(nBoard) | | nRemainder=int(nBoard) |
| for digit in range(8,-1,-1): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | pass | n | |
| def countBases(seq): | | passdef countBases(seq): |
| A=0 | | A = 0 |
| C=0 | | C = 0 |
| G=0 | | G = 0 |
| T=0 | | T = 0 |
| for n in range(0,len(seq)): | | for n in range(0,len(seq)): |
| if seq[n]=='A': | | if seq[n]=='A': |
n | A+=1 | n | A = A+1 |
| elif seq[n]=='C': | | elif seq[n]=='C': |
n | C+=1 | n | C = C+1 |
| elif seq[n]=='G': | | elif seq[n]=='G': |
n | G+=1 | n | G = G+1 |
| elif seq[n]=='T': | | elif seq[n]=='T': |
n | T+=1 | n | T = T+1 |
| cg_percentage = 100*((C+G)/(len(seq))) | | cg_percentage = 100*((C+G)/(len(seq))) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if len(seq_a)==len(seq_b): | | if len(seq_a)==len(seq_b): |
| count = -1 | | count = -1 |
| for i in range(0,len(seq_a)): | | for i in range(0,len(seq_a)): |
| if seq_a[i]==seq_b[i]: | | if seq_a[i]==seq_b[i]: |
n | count+=1 | n | count = count+1 |
| return count | | return count |
| else: | | else: |
| return 'Error: Sequences Length Mismatch' | | return 'Error: Sequences Length Mismatch' |
t | | t | if __name__=="__main__": |
| | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 13
Student ID: 273, P-Value: 7.64e-04
Nearest Neighbor ID: 347
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[1:8:3 | n | if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[2:9:3 |
| ]==[1,1,1] or boardList[2:9:3]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardLis | | ]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardList[3:6:1]==[1,1,1] or boardLis |
| t[3:6:1]==[1,1,1] or boardList[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or b | | t[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or boardList[2:7:2]==[1,1,1]: |
| oardList[2:7:2]==[1,1,1]: | | |
| return 'X' | | return 'X' |
| elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[1:8 | | elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[2:9 |
| :3]==[2,2,2] or boardList[2:9:3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardL | | :3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardList[3:6:1]==[2,2,2] or boardL |
| ist[3:6:1]==[2,2,2] or boardList[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or | | ist[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or boardList[2:7:2]==[2,2,2]: |
| boardList[2:7:2]==[2,2,2]: | | |
| return 'O' | | return 'O' |
n | else: | n | else: |
| return '-' | | return '-' |
n | pass | n | |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=int(nBoard) | | nRemainder=int(nBoard) |
| for digit in range(8,-1,-1): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | | n | pass |
| passdef countBases(seq): | | def countBases(seq): |
| A = 0 | | A=0 |
| C = 0 | | C=0 |
| G = 0 | | G=0 |
| T = 0 | | T=0 |
| for n in range(0,len(seq)): | | for n in range(0,len(seq)): |
| if seq[n]=='A': | | if seq[n]=='A': |
n | A = A+1 | n | A+=1 |
| elif seq[n]=='C': | | elif seq[n]=='C': |
n | C = C+1 | n | C+=1 |
| elif seq[n]=='G': | | elif seq[n]=='G': |
n | G = G+1 | n | G+=1 |
| elif seq[n]=='T': | | elif seq[n]=='T': |
n | T = T+1 | n | T+=1 |
| cg_percentage = 100*((C+G)/(len(seq))) | | cg_percentage = 100*((C+G)/(len(seq))) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if len(seq_a)==len(seq_b): | | if len(seq_a)==len(seq_b): |
| count = -1 | | count = -1 |
| for i in range(0,len(seq_a)): | | for i in range(0,len(seq_a)): |
| if seq_a[i]==seq_b[i]: | | if seq_a[i]==seq_b[i]: |
n | count = count+1 | n | count+=1 |
| return count | | return count |
| else: | | else: |
| return 'Error: Sequences Length Mismatch' | | return 'Error: Sequences Length Mismatch' |
t | if __name__=="__main__": | t | |
| pass | | |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 14
Student ID: 34, P-Value: 1.00e-03
Nearest Neighbor ID: 478
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
n | for column in range(3): | n | for col in range(3): |
| if boardList[column] == boardList[column+3] == boardList[column+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[column] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[column] == 2: | n | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList=[] | n | boardList = [] |
| nRemainder=nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
n | return boardList | n | |
| if __name__=="__main__": | | |
| passdef countBases(seq): | | return boardListdef countBases(seq): |
| A = str(seq).count('A') | | A = str(seq).count('A') |
n | | n | T = str(seq).count('T') |
| C = str(seq).count('C') | | C = str(seq).count('C') |
| G = str(seq).count('G') | | G = str(seq).count('G') |
n | T = str(seq).count('T') | n | |
| cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100) | | cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | | n | s= seq_a |
| t= seq_b | | t= seq_b |
n | s= seq_a | n | |
| count=0 | | count=0 |
n | for j in range(len(s)): | n | for i in range(len(s)): |
| if s[j]!= t[j]: | | if s[i]!= t[i]: |
| count+=1 | | count+=1 |
n | if len(seq_b) != len(seq_a): | n | if len(seq_a) != len(seq_b): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| return count | | return count |
t | | t | if __name__=="__main__": |
| | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 15
Student ID: 495, P-Value: 1.68e-03
Nearest Neighbor ID: 318
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
n | return '0' | n | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
n | return '0' | n | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
n | return '0' | n | return 'O' |
| | | else: |
| return '-' | | return '-' |
| | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
n | nRemainder = nBoard | n | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - (x * (3**digit)) | n | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
n | t = decodeBoard(2291) | n | if __name__ =="__main__": |
| print(t) | | pass |
| print(findWinner(t)) | | def countBases(seq): |
| print() | | |
| t = decodeBoard(1851) | | |
| print(t) | | |
| print(findWinner(t))def countBases(seq): | | |
| a = 0 | | a = 0 |
| t = 0 | | t = 0 |
| c = 0 | | c = 0 |
| g = 0 | | g = 0 |
n | for n in seq: | n | for n in seq: |
| if n == 'A': | | if n == 'A': |
n | a += 1 | n | a += 1 |
| elif n == 'T': | | elif n == 'T': |
| t += 1 | | t += 1 |
| elif n == 'C': | | elif n == 'C': |
| c += 1 | | c += 1 |
| elif n == 'G': | | elif n == 'G': |
| g += 1 | | g += 1 |
| Total_Percent=((c+g)/len(seq)) * 100 | | Total_Percent=((c+g)/len(seq)) * 100 |
t | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(a, c, g, t, Total_Percent) | t | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(a, c, g, t, Total_Percent) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| count = 0 | | count = 0 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
| count +=1 | | count +=1 |
| return count | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
| x = input() | | x = input() |
| y = input() | | y = input() |
| print(hammingdistance(x, y)) | | print(hammingdistance(x, y)) |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 16
Student ID: 318, P-Value: 1.68e-03
Nearest Neighbor ID: 495
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
n | return 'O' | n | return '0' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
n | return 'O' | n | return '0' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
n | return 'O' | n | return '0' |
| else: | | |
| return '-' | | return '-' |
| pass | | |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
n | nRemainder = nBoard | n | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
n | if __name__ =="__main__": | n | t = decodeBoard(2291) |
| pass | | print(t) |
| def countBases(seq): | | print(findWinner(t)) |
| | | print() |
| | | t = decodeBoard(1851) |
| | | print(t) |
| | | print(findWinner(t))def countBases(seq): |
| a = 0 | | a = 0 |
| t = 0 | | t = 0 |
| c = 0 | | c = 0 |
| g = 0 | | g = 0 |
n | for n in seq: | n | for n in seq: |
| if n == 'A': | | if n == 'A': |
n | a += 1 | n | a += 1 |
| elif n == 'T': | | elif n == 'T': |
| t += 1 | | t += 1 |
| elif n == 'C': | | elif n == 'C': |
| c += 1 | | c += 1 |
| elif n == 'G': | | elif n == 'G': |
| g += 1 | | g += 1 |
| Total_Percent=((c+g)/len(seq)) * 100 | | Total_Percent=((c+g)/len(seq)) * 100 |
t | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(a, c, g, t, Total_Percent) | t | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(a, c, g, t, Total_Percent) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| count = 0 | | count = 0 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
| count +=1 | | count +=1 |
| return count | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
| x = input() | | x = input() |
| y = input() | | y = input() |
| print(hammingdistance(x, y)) | | print(hammingdistance(x, y)) |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 17
Student ID: 286, P-Value: 5.98e-03
Nearest Neighbor ID: 64
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | if boardList[0] == boardList[1] == boardList[2]: | n | if boardList[0] == boardList[1] == boardList[2]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
n | return 'O' | n | return 'O' |
| elif boardList[3] == boardList[4] == boardList[5]: | | elif boardList[3] == boardList[4] == boardList[5]: |
| if boardList[3] == 1: | | if boardList[3] == 1: |
| return 'X' | | return 'X' |
| if boardList[3] == 2: | | if boardList[3] == 2: |
n | return 'O' | n | return 'O' |
| elif boardList[6] == boardList[7] == boardList[8]: | | elif boardList[6] == boardList[7] == boardList[8]: |
| if boardList[6] == 1: | | if boardList[6] == 1: |
| return 'X' | | return 'X' |
| if boardList[6] == 2: | | if boardList[6] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[0] == boardList[3] == boardList[6]: | n | elif boardList[0] == boardList[3] == boardList[6]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
| elif boardList[1] == boardList[4] == boardList[7]: | | elif boardList[1] == boardList[4] == boardList[7]: |
| if boardList[1] == 1: | | if boardList[1] == 1: |
| return 'X' | | return 'X' |
| if boardList[1] == 2: | | if boardList[1] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[2] == boardList[5] == boardList[8]: | n | elif boardList[2] == boardList[5] == boardList[8]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| if boardList[2] == 2: | | if boardList[2] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[0] == boardList[4] == boardList[8]: | n | elif boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[6] == boardList[4] == boardList[2]: | n | elif boardList[2] == boardList[4] == boardList[6]: |
| if boardList[6] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
n | if boardList[6] == 2: | n | if boardList[2] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
| pass | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
n | for digit in range(8,-1,-1): | n | for digit in range(8,-1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | | n | pass |
| passdef countBases(seq): | | def countBases(seq): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for n in seq: | n | for user_number in seq: |
| if n == 'A': | | if user_number == 'A': |
| A += 1 | | A +=1 |
| elif n == 'C': | | elif user_number == 'C': |
| C += 1 | | C +=1 |
| elif n == 'G': | | elif user_number == 'G': |
| G += 1 | | G +=1 |
| elif n == 'T': | | elif user_number == 'T': |
| T += 1 | | T += 1 |
n | | n | else: |
| | | print('Error') |
| cg_percentage = ((C+G)/len(seq)) * 100 | | cg_percentage = ((C+G)/len(seq))*100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | | n | h_distance = 0 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
n | return('Error: Sequences Length Mismatch') | n | return 'Error: Sequence Length Mismatch' |
| count = 0 | | |
| for n in range(len(seq_a)): | | for user_number in range(len(seq_a)): |
| if seq_a[n] != seq_b[n]: | | if seq_a[user_number] != seq_b[user_number]: |
| count = count+1 | | h_distance += 1 |
| else: | | else: |
| print('Error: Sequences Length Mismatch') | | print('Error: Sequences Length Mismatch') |
t | return count | t | return h_distance |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 18
Student ID: 64, P-Value: 5.98e-03
Nearest Neighbor ID: 286
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | if boardList[0] == boardList[1] == boardList[2]: | n | if boardList[0] == boardList[1] == boardList[2]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
n | return 'O' | n | return 'O' |
| elif boardList[3] == boardList[4] == boardList[5]: | | elif boardList[3] == boardList[4] == boardList[5]: |
| if boardList[3] == 1: | | if boardList[3] == 1: |
| return 'X' | | return 'X' |
| if boardList[3] == 2: | | if boardList[3] == 2: |
n | return 'O' | n | return 'O' |
| elif boardList[6] == boardList[7] == boardList[8]: | | elif boardList[6] == boardList[7] == boardList[8]: |
| if boardList[6] == 1: | | if boardList[6] == 1: |
| return 'X' | | return 'X' |
| if boardList[6] == 2: | | if boardList[6] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[0] == boardList[3] == boardList[6]: | n | elif boardList[0] == boardList[3] == boardList[6]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
| elif boardList[1] == boardList[4] == boardList[7]: | | elif boardList[1] == boardList[4] == boardList[7]: |
| if boardList[1] == 1: | | if boardList[1] == 1: |
| return 'X' | | return 'X' |
| if boardList[1] == 2: | | if boardList[1] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[2] == boardList[5] == boardList[8]: | n | elif boardList[2] == boardList[5] == boardList[8]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| if boardList[2] == 2: | | if boardList[2] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[0] == boardList[4] == boardList[8]: | n | elif boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[2] == boardList[4] == boardList[6]: | n | elif boardList[6] == boardList[4] == boardList[2]: |
| if boardList[2] == 1: | | if boardList[6] == 1: |
| return 'X' | | return 'X' |
n | if boardList[2] == 2: | n | if boardList[6] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
| pass | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
n | for digit in range(8,-1, -1): | n | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | pass | n | |
| def countBases(seq): | | passdef countBases(seq): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for user_number in seq: | n | for n in seq: |
| if user_number == 'A': | | if n == 'A': |
| A +=1 | | A += 1 |
| elif user_number == 'C': | | elif n == 'C': |
| C +=1 | | C += 1 |
| elif user_number == 'G': | | elif n == 'G': |
| G +=1 | | G += 1 |
| elif user_number == 'T': | | elif n == 'T': |
| T += 1 | | T += 1 |
n | else: | n | |
| print('Error') | | |
| cg_percentage = ((C+G)/len(seq))*100 | | cg_percentage = ((C+G)/len(seq)) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | h_distance = 0 | n | |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
n | return 'Error: Sequence Length Mismatch' | n | return('Error: Sequences Length Mismatch') |
| | | count = 0 |
| for user_number in range(len(seq_a)): | | for n in range(len(seq_a)): |
| if seq_a[user_number] != seq_b[user_number]: | | if seq_a[n] != seq_b[n]: |
| h_distance += 1 | | count = count+1 |
| else: | | else: |
| print('Error: Sequences Length Mismatch') | | print('Error: Sequences Length Mismatch') |
t | return h_distance | t | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 19
Student ID: 296, P-Value: 7.31e-03
Nearest Neighbor ID: 79
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
n | if boardList[row*3] == 2: | n | |
| return 'O' | | |
| elif boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[row*3] == 2: |
| | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
n | | n | if boardList[col] == 1: |
| | | return 'X' |
| if boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
n | | n | if boardList[0] == boardList[4] == boardList[8]: |
| elif boardList[col] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| | | elif boardList[0] == 2: |
| | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
n | | n | if boardList[2] == 1: |
| | | return 'X' |
| if boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[2] == 1: | n | |
| return 'X' | | |
| if boardList[0] == boardList[4] == boardList[8]: | | |
| if boardList[0] == 2: | | |
| return 'O' | | |
| elif boardList[0] == 1: | | |
| return 'X' | | |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList=[] | n | boardList = [] |
| nRemainder=nBoard | | nRemainder = nBoard |
| for digit in range (8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
n | if __name__=="__main__": | n | |
| passdef countBases(seq): | | def countBases(seq): |
| | | bases = ['A','C','G','T'] |
| counts = [] | | counts = [] |
n | bases = ['A','C','G','T'] | n | |
| for base in bases: | | for base in bases: |
| count = 0 | | count = 0 |
| for char in seq: | | for char in seq: |
| if(base == char): | | if(base == char): |
| count += 1 | | count += 1 |
| counts.append(count) | | counts.append(count) |
n | A=counts[0] | n | A = counts[0] |
| C=counts [1] | | C = counts[1] |
| G=counts[2] | | G = counts[2] |
| T=counts[3] | | T = counts[3] |
| cg_percentage = (C+G)*100 / len(seq) | | cg_percentage = (C+G)*100 / len(seq) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
n | seq='ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' | n | seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' |
| countBases(seq) | | countBases(seq) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if(len(seq_a) != len(seq_b)): | | if(len(seq_a) != len(seq_b)): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
n | count=0 | n | count = 0 |
| for char1,char2 in zip(seq_a,seq_b): | | for char1,char2 in zip(seq_a,seq_b): |
| if(char1 != char2): | | if(char1 != char2): |
n | count+=1 | n | count += 1 |
| return(count) | | return(count) |
t | seq_a='GATATCGTCTGGGACCT' | t | seq_a = 'GATATCGTCTGGGACCT' |
| seq_b='CATCGCATTTACGGCCT' | | seq_b = 'CATCGCATTTACGGCCT' |
| hammingdistance(seq_a, seq_b) | | hammingdistance(seq_a, seq_b) |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 20
Student ID: 239, P-Value: 7.86e-03
Nearest Neighbor ID: 301
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for down in range(3): | | for down in range(3): |
n | if boardList[down]==boardList[down+3]==boardList[down+6]== 1 or boardLis | n | if boardList[down]==boardList[down+3]==boardList[down+6]==1 or boardList |
| t[2]==boardList[4] ==boardList[6]==1 or boardList[0]==boardList[4]==boardList[8] | | [2]==boardList[4]==boardList[6]==1 or boardList[0]==boardList[4]==boardList[8]== |
| ==1: | | 1: |
| return 'X' | | return 'X' |
| if boardList[down]==boardList[down+3]==boardList[down+6]== 2 or boardLis | | if boardList[down]==boardList[down+3]==boardList[down+6]==2 or boardList |
| t[2]==boardList[4] ==boardList[6]==2 or boardList[0]==boardList[4]==boardList[8] | | [2]==boardList[4]==boardList[6]==2 or boardList[0]==boardList[4]==boardList[8]== |
| ==2: | | 2: |
| return 'O' | | return 'O' |
| for across in range(3): | | for across in range(3): |
| if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]: | | if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]: |
n | if boardList [across*3]==1: | n | if boardList[across*3]==1: |
| return 'X' | | return 'X' |
| if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]: | | if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]: |
n | if boardList [across*3]==2: | n | if boardList[across*3]==2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
| pass | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList=[ ] | n | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
| for digit in range(8,-1,-1): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | | n | pass |
| passdef countBases(seq): | | def countBases(seq): |
| A=seq.count('A') | | A=seq.count('A') |
| C=seq.count('C') | | C=seq.count('C') |
| G=seq.count('G') | | G=seq.count('G') |
| T=seq.count('T') | | T=seq.count('T') |
n | seq_1= C+G | n | yuh=C + G |
| seq_2= C+G+T+A | | hi=C+G+T+A |
| cg_percentage = (seq_1/seq_2)*100 | | cg_percentage = (yuh/hi)*100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return('{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | if (len(seq_a) !=len(seq_b)): | n | if len(seq_a)!=len(seq_b): |
| return ('Error: sequences length mismatch') | | return('Error: Sequences Length Mismatch') |
| else: | | else: |
| seq_a=set(seq_a) | | seq_a=set(seq_a) |
| seq_b=set(seq_b) | | seq_b=set(seq_b) |
n | seq=seq_a.symmetric_difference(seq_b) | n | ekk=seq_a.symmetric_difference(seq_b) |
| seq=set(seq) | | ekk=set(ekk) |
| seq=len(seq) | | ekk=len(ekk) |
| return 7 | | return 7 |
| if __name__=="__main__": | | if __name__=="__main__": |
t | print('seq') | t | print('i want to cry') |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 21
Student ID: 301, P-Value: 7.86e-03
Nearest Neighbor ID: 239
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for down in range(3): | | for down in range(3): |
n | if boardList[down]==boardList[down+3]==boardList[down+6]==1 or boardList | n | if boardList[down]==boardList[down+3]==boardList[down+6]== 1 or boardLis |
| [2]==boardList[4]==boardList[6]==1 or boardList[0]==boardList[4]==boardList[8]== | | t[2]==boardList[4] ==boardList[6]==1 or boardList[0]==boardList[4]==boardList[8] |
| 1: | | ==1: |
| return 'X' | | return 'X' |
| if boardList[down]==boardList[down+3]==boardList[down+6]==2 or boardList | | if boardList[down]==boardList[down+3]==boardList[down+6]== 2 or boardLis |
| [2]==boardList[4]==boardList[6]==2 or boardList[0]==boardList[4]==boardList[8]== | | t[2]==boardList[4] ==boardList[6]==2 or boardList[0]==boardList[4]==boardList[8] |
| 2: | | ==2: |
| return 'O' | | return 'O' |
| for across in range(3): | | for across in range(3): |
| if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]: | | if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]: |
n | if boardList[across*3]==1: | n | if boardList [across*3]==1: |
| return 'X' | | return 'X' |
| if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]: | | if boardList[across*3]==boardList[across*3+1]==boardList[across*3+2]: |
n | if boardList[across*3]==2: | n | if boardList [across*3]==2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
| pass | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList=[] | n | boardList=[ ] |
| nRemainder=nBoard | | nRemainder=nBoard |
| for digit in range(8,-1,-1): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | pass | n | |
| def countBases(seq): | | passdef countBases(seq): |
| A=seq.count('A') | | A=seq.count('A') |
| C=seq.count('C') | | C=seq.count('C') |
| G=seq.count('G') | | G=seq.count('G') |
| T=seq.count('T') | | T=seq.count('T') |
n | yuh=C + G | n | seq_1= C+G |
| hi=C+G+T+A | | seq_2= C+G+T+A |
| cg_percentage = (yuh/hi)*100 | | cg_percentage = (seq_1/seq_2)*100 |
| return('{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | if len(seq_a)!=len(seq_b): | n | if (len(seq_a) !=len(seq_b)): |
| return('Error: Sequences Length Mismatch') | | return ('Error: sequences length mismatch') |
| else: | | else: |
| seq_a=set(seq_a) | | seq_a=set(seq_a) |
| seq_b=set(seq_b) | | seq_b=set(seq_b) |
n | ekk=seq_a.symmetric_difference(seq_b) | n | seq=seq_a.symmetric_difference(seq_b) |
| ekk=set(ekk) | | seq=set(seq) |
| ekk=len(ekk) | | seq=len(seq) |
| return 7 | | return 7 |
| if __name__=="__main__": | | if __name__=="__main__": |
t | print('i want to cry') | t | print('seq') |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 22
Student ID: 30, P-Value: 8.06e-03
Nearest Neighbor ID: 116
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
n | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | n | if boardList[row * 3] == boardList[row * 3 + 1] == boardList[row * 3 + 2 |
| | | ]: |
| if boardList[row*3] == 1: | | if boardList[row * 3] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[row*3] == 2: | n | elif boardList[row * 3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
n | if boardList[col] == boardList[col+3] == boardList[col+6]: | n | if boardList[col] == boardList[col + 3] == boardList[col + 6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
n | | n | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList = [] | n | boardList=[] |
| nRemainder = nBoard | | nRemainder=nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - (x * (3**digit)) | n | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for n in range(len(seq)): | n | for i in range(len(seq)): |
| if seq[n] == 'A': | | if seq[i] == 'A': |
| A += 1 | | A += 1 |
n | elif seq[n] == 'C': | n | if seq[i] == 'C': |
| C += 1 | | C += 1 |
n | elif seq[n] == 'G': | n | if seq[i] == 'G': |
| G += 1 | | G += 1 |
n | elif seq[n] == 'T': | n | if seq[i] == 'T': |
| T += 1 | | T += 1 |
n | cg_percentage = (C + G) / len(seq) * 100 | n | cg_percentage = float(((C + G) / (A + C + G + T)) * 100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | diff = 0 | n | count = 0 |
| if len(seq_a) == len(seq_b): | | if len(seq_a) != len(seq_b): |
| | | return 'Error: Sequences Length Mismatch' |
| | | else: |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
t | diff += 1 | t | count += 1 |
| return diff | | return count |
| else: | | |
| return 'Error: Sequences Length Mismatch' | | |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 23
Student ID: 116, P-Value: 8.06e-03
Nearest Neighbor ID: 30
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
n | if boardList[row * 3] == boardList[row * 3 + 1] == boardList[row * 3 + 2 | n | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| ]: | | |
| if boardList[row * 3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[row * 3] == 2: | n | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
n | if boardList[col] == boardList[col + 3] == boardList[col + 6]: | n | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
n | pass | n | |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList=[] | n | boardList = [] |
| nRemainder=nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for i in range(len(seq)): | n | for n in range(len(seq)): |
| if seq[i] == 'A': | | if seq[n] == 'A': |
| A += 1 | | A += 1 |
n | if seq[i] == 'C': | n | elif seq[n] == 'C': |
| C += 1 | | C += 1 |
n | if seq[i] == 'G': | n | elif seq[n] == 'G': |
| G += 1 | | G += 1 |
n | if seq[i] == 'T': | n | elif seq[n] == 'T': |
| T += 1 | | T += 1 |
n | cg_percentage = float(((C + G) / (A + C + G + T)) * 100) | n | cg_percentage = (C + G) / len(seq) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | count = 0 | n | diff = 0 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) == len(seq_b): |
| return 'Error: Sequences Length Mismatch' | | |
| else: | | |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
t | count += 1 | t | diff += 1 |
| return count | | return diff |
| | | else: |
| | | return 'Error: Sequences Length Mismatch' |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 24
Student ID: 467, P-Value: 1.07e-02
Nearest Neighbor ID: 116
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | | n | for row in range(3): |
| if boardList[0] == boardList[1] == boardList[2]: | | if boardList[row * 3] == boardList[row * 3 + 1] == boardList[row * 3 + 2 |
| | | ]: |
| if boardList[0] == 1: | | if boardList[row * 3] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | elif boardList[row * 3] == 2: |
| return 'O' | | return 'O' |
| | | for col in range(3): |
| if boardList[3] == boardList[4] == boardList[5]: | | if boardList[col] == boardList[col + 3] == boardList[col + 6]: |
| if boardList[3] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| if boardList[3] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[6] == boardList[7] == boardList[8]: | | |
| if boardList[6] == 1: | | |
| return 'X' | | |
| if boardList[6] == 2: | | |
| return 'O' | | |
| if boardList[0] == boardList[3] == boardList[6]: | | |
| if boardList[0] == 1: | | |
| return 'X' | | |
| if boardList[0] == 2: | | |
| return 'O' | | |
| if boardList[1] == boardList[4] == boardList[7]: | | |
| if boardList[1] == 1: | | |
| return 'X' | | |
| if boardList[1] == 2: | | |
| return 'O' | | |
| if boardList[2] == boardList[5] == boardList[8]: | | |
| if boardList[2] == 1: | | |
| return 'X' | | |
| if boardList[2] == 2: | | |
| return 'O' | | |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
n | if boardList[0] == 2: | n | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
n | if boardList[2] == 2: | n | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
n | | n | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | cg_percentage = 0.0 | n | |
| for i in range(0, len(seq)): | | for i in range(len(seq)): |
| if seq[i] == 'A': | | if seq[i] == 'A': |
| A += 1 | | A += 1 |
| if seq[i] == 'C': | | if seq[i] == 'C': |
| C += 1 | | C += 1 |
| if seq[i] == 'G': | | if seq[i] == 'G': |
| G += 1 | | G += 1 |
| if seq[i] == 'T': | | if seq[i] == 'T': |
| T += 1 | | T += 1 |
n | cg_percentage = ((C + G) / len(seq)) * 100 | n | cg_percentage = float(((C + G) / (A + C + G + T)) * 100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| count = 0 | | count = 0 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
n | return "Error: Sequences Length Mismatch" | n | return 'Error: Sequences Length Mismatch' |
| else: | | else: |
n | for i in range(0, len(seq_a)): | n | for i in range(len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
| count += 1 | | count += 1 |
t | return count | t | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 25
Student ID: 65, P-Value: 1.40e-02
Nearest Neighbor ID: 176
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
| | | return 'X' |
| | | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
| | | return 'X' |
| | | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
| | | return 'X' |
| | | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| | | return 'X' |
| elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: | | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | n | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| return 'X' | | return 'O' |
| | | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
| | | return 'O' |
| | | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | n | |
| return 'X' | | |
| elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | n | |
| return 'X' | | |
| elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | |
| return 'O' | | |
| elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | |
| return 'X' | | |
| elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | | |
| return 'O' | | |
| elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | |
| return 'X' | | |
| elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | | |
| return 'X' | | |
| elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: | n | |
| return 'X' | | |
| elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: | | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
n | | n | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
n | nRemainder=nBoard | n | nRemainder=nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | print(decodeBoard(1815)) | n | |
| passdef countBases(seq): | | passdef countBases(seq_a): |
| A = seq.count('A') | | A = 0 |
| C = seq.count('C') | | C = 0 |
| G = seq.count('G') | | G = 0 |
| T = seq.count('T') | | T = 0 |
| Total = A + C + G + T | | for d in seq_a: |
| | | if d == 'A': |
| | | A += 1 |
| | | elif d == 'C': |
| | | C += 1 |
| | | elif d == 'G': |
| | | G += 1 |
| | | elif d == 'T': |
| | | T += 1 |
| cg_percentage = ((C + G) / Total) * 100 | | cg_percentage = float((C + G) / ((len(seq_a))) * 100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | diff = 0 | n | |
| if len(seq_a) == len(seq_b): | | if len(seq_a) == len(seq_b): |
n | | n | diff = 0 |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
| diff += 1 | | diff += 1 |
n | return (diff) | n | |
| else: | | else: |
t | return "Error: Sequences Length Mismatch" | t | return 'Error: Sequences Length Mismatch' |
| | | return diff |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 26
Student ID: 176, P-Value: 1.40e-02
Nearest Neighbor ID: 65
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
| | | return 'O' |
| | | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
| | | return 'X' |
| | | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| | | return 'O' |
| | | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| | | return 'O' |
| elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
| | | return 'O' |
| elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | n | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
| return 'X' | | return 'O' |
| elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | | |
| return 'X' | | |
| elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: | | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: | n | |
| return 'O' | | |
| elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | |
| return 'O' | | |
| elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | | |
| return 'O' | | |
| elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | | |
| return 'O' | | |
| elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: | | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
n | pass | n | |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
n | nRemainder=nBoard | n | nRemainder=nBoard |
| for digit in range(8,-1,-1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | | n | print(decodeBoard(1815)) |
| passdef countBases(seq_a): | | passdef countBases(seq): |
| A = 0 | | A = seq.count('A') |
| C = 0 | | C = seq.count('C') |
| G = 0 | | G = seq.count('G') |
| T = 0 | | T = seq.count('T') |
| for d in seq_a: | | Total = A + C + G + T |
| if d == 'A': | | |
| A += 1 | | |
| elif d == 'C': | | |
| C += 1 | | |
| elif d == 'G': | | |
| G += 1 | | |
| elif d == 'T': | | |
| T += 1 | | |
| cg_percentage = float((C + G) / ((len(seq_a))) * 100) | | cg_percentage = ((C + G) / Total) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | | n | diff = 0 |
| if len(seq_a) == len(seq_b): | | if len(seq_a) == len(seq_b): |
n | diff = 0 | n | |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
| diff += 1 | | diff += 1 |
n | | n | return (diff) |
| else: | | else: |
t | return 'Error: Sequences Length Mismatch' | t | return "Error: Sequences Length Mismatch" |
| return diff | | |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 27
Student ID: 193, P-Value: 1.43e-02
Nearest Neighbor ID: 79
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
n | if boardList[row * 3] == boardList[row * 3 + 1] == boardList[row * 3 + 2 | n | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| ]: | | |
| if boardList[row * 3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[row * 3] == 2: | n | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
n | for column in range(3): | n | for col in range(3): |
| if boardList[column] == boardList[column + 3] == boardList[column + 6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[column] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[column] == 2: | n | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList=[] | n | boardList = [] |
| nRemainder=nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
n | if __name__=="__main__": | n | |
| passdef countBases(seq): | | def countBases(seq): |
| bases = ['A','C','G','T'] | | bases = ['A','C','G','T'] |
| counts = [] | | counts = [] |
| for base in bases: | | for base in bases: |
| count = 0 | | count = 0 |
| for char in seq: | | for char in seq: |
| if(base == char): | | if(base == char): |
| count += 1 | | count += 1 |
| counts.append(count) | | counts.append(count) |
| A = counts[0] | | A = counts[0] |
| C = counts[1] | | C = counts[1] |
| G = counts[2] | | G = counts[2] |
| T = counts[3] | | T = counts[3] |
n | cg_percentage = ((C+G)*100) / (len(seq)) | n | cg_percentage = (C+G)*100 / len(seq) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' | | seq = 'ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGAACTACTCGATTCACGTTT' |
| countBases(seq) | | countBases(seq) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if(len(seq_a) != len(seq_b)): | | if(len(seq_a) != len(seq_b)): |
n | return 'Error: Sequences Length Mismatch' | n | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| count = 0 | | count = 0 |
n | for charA,charB in zip(seq_a,seq_b): | n | for char1,char2 in zip(seq_a,seq_b): |
| if(charA != charB): | | if(char1 != char2): |
| count += 1 | | count += 1 |
| return(count) | | return(count) |
| seq_a = 'GATATCGTCTGGGACCT' | | seq_a = 'GATATCGTCTGGGACCT' |
t | seq_b = 'CCATCGCATTTACGGCCT' | t | seq_b = 'CATCGCATTTACGGCCT' |
| hammingdistance(seq_a, seq_b) | | hammingdistance(seq_a, seq_b) |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 28
Student ID: 73, P-Value: 1.46e-02
Nearest Neighbor ID: 497
Student (left) and Nearest Neighbor (right).
f | def findWinner(boardList): | f | def findWinner(boardList): |
| if (boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1) or (board | | if (boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1) or (board |
| List[3] == 1 and boardList[4] == 1 and boardList[5] == 1) or (boardList[6] == 1 | | List[3] == 1 and boardList[4] == 1 and boardList[5] == 1) or (boardList[6] == 1 |
| and boardList[7] == 1 and boardList[8] == 1): | | and boardList[7] == 1 and boardList[8] == 1): |
n | return 'X' | n | return "X" |
| if (boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1) or (board | | elif (boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1) or (boa |
| List[1] == 1 and boardList[4] == 1 and boardList[7] == 1) or (boardList[2] == 1 | | rdList[1] == 1 and boardList[4] == 1 and boardList[7] == 1) or (boardList[2] == |
| and boardList[5] == 1 and boardList[8] == 1): | | 1 and boardList[5] == 1 and boardList[8] == 1): |
| return 'X' | | return "X" |
| if (boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1) or (board | | elif (boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1) or (boa |
| List[2] == 1 and boardList[4] == 1 and boardList[6] == 1): | | rdList[2] == 1 and boardList[4] == 1 and boardList[6] == 1): |
| return 'X' | | return "X" |
| if (boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2) or (board | | elif (boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2) or (boa |
| List[3] == 2 and boardList[4] == 2 and boardList[5] == 2) or (boardList[6] == 2 | | rdList[3] == 2 and boardList[4] == 2 and boardList[5] == 2) or (boardList[6] == |
| and boardList[7] == 2 and boardList[8]==2): | | 2 and boardList[7] == 2 and boardList[8] == 2): |
| return 'O' | | return "O" |
| if (boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2) or (board | | elif (boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2) or (boa |
| List[1] == 2 and boardList[4] == 2 and boardList[7] == 2) or (boardList[2] == 2 | | rdList[1] == 2 and boardList[4] == 2 and boardList[7] == 2) or (boardList[2] == |
| and boardList[5] == 2 and boardList[8] == 2): | | 2 and boardList[5] == 2 and boardList[8] == 2): |
| return 'O' | | return "O" |
| if (boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2) or (board | | elif (boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2) or (boa |
| List[2] == 2 and boardList[4] == 2 and boardList[6] == 2): | | rdList[2] == 2 and boardList[4] == 2 and boardList[6] == 2): |
| return 'O' | | return "O" |
| else: | | else: |
n | return '-' | n | return "-" |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| import math | | import math |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
n | A=0 | n | A, C, G, T = 0, 0, 0 ,0 |
| C=0 | | base_list = ["A", "C", "G", "T"] |
| G=0 | | |
| T=0 | | |
| lists = ['A','C','G','T'] | | |
| for base in seq: | | for base in seq: |
n | if base == lists[0]: | n | if base == base_list[0]: |
| A += 1 | | A += 1 |
n | elif base == lists[1]: | n | elif base == base_list[1]: |
| C += 1 | | C += 1 |
n | elif base == lists[2]: | n | elif base == base_list[2]: |
| G += 1 | | G += 1 |
n | elif base == lists[3]: | n | elif base == base_list[3]: |
| T += 1 | | T += 1 |
n | cg_percentage = ((C + G)/(A + C + G + T)) * 100 | n | cg_percentage = ((C + G) / (A + C + G + T)) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
n | return 'Error: Sequences Length Mismatch' | n | return "Error: Sequences Length Mismatch" |
| else: | | else: |
| count = 0 | | count = 0 |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
t | count = count + 1 | t | count += 1 |
| return count | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 29
Student ID: 497, P-Value: 1.46e-02
Nearest Neighbor ID: 73
Student (left) and Nearest Neighbor (right).
f | def findWinner(boardList): | f | def findWinner(boardList): |
| if (boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1) or (board | | if (boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1) or (board |
| List[3] == 1 and boardList[4] == 1 and boardList[5] == 1) or (boardList[6] == 1 | | List[3] == 1 and boardList[4] == 1 and boardList[5] == 1) or (boardList[6] == 1 |
| and boardList[7] == 1 and boardList[8] == 1): | | and boardList[7] == 1 and boardList[8] == 1): |
n | return "X" | n | return 'X' |
| elif (boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1) or (boa | | if (boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1) or (board |
| rdList[1] == 1 and boardList[4] == 1 and boardList[7] == 1) or (boardList[2] == | | List[1] == 1 and boardList[4] == 1 and boardList[7] == 1) or (boardList[2] == 1 |
| 1 and boardList[5] == 1 and boardList[8] == 1): | | and boardList[5] == 1 and boardList[8] == 1): |
| return "X" | | return 'X' |
| elif (boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1) or (boa | | if (boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1) or (board |
| rdList[2] == 1 and boardList[4] == 1 and boardList[6] == 1): | | List[2] == 1 and boardList[4] == 1 and boardList[6] == 1): |
| return "X" | | return 'X' |
| elif (boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2) or (boa | | if (boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2) or (board |
| rdList[3] == 2 and boardList[4] == 2 and boardList[5] == 2) or (boardList[6] == | | List[3] == 2 and boardList[4] == 2 and boardList[5] == 2) or (boardList[6] == 2 |
| 2 and boardList[7] == 2 and boardList[8] == 2): | | and boardList[7] == 2 and boardList[8]==2): |
| return "O" | | return 'O' |
| elif (boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2) or (boa | | if (boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2) or (board |
| rdList[1] == 2 and boardList[4] == 2 and boardList[7] == 2) or (boardList[2] == | | List[1] == 2 and boardList[4] == 2 and boardList[7] == 2) or (boardList[2] == 2 |
| 2 and boardList[5] == 2 and boardList[8] == 2): | | and boardList[5] == 2 and boardList[8] == 2): |
| return "O" | | return 'O' |
| elif (boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2) or (boa | | if (boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2) or (board |
| rdList[2] == 2 and boardList[4] == 2 and boardList[6] == 2): | | List[2] == 2 and boardList[4] == 2 and boardList[6] == 2): |
| return "O" | | return 'O' |
| else: | | else: |
n | return "-" | n | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| import math | | import math |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
n | A, C, G, T = 0, 0, 0 ,0 | n | A=0 |
| base_list = ["A", "C", "G", "T"] | | C=0 |
| | | G=0 |
| | | T=0 |
| | | lists = ['A','C','G','T'] |
| for base in seq: | | for base in seq: |
n | if base == base_list[0]: | n | if base == lists[0]: |
| A += 1 | | A += 1 |
n | elif base == base_list[1]: | n | elif base == lists[1]: |
| C += 1 | | C += 1 |
n | elif base == base_list[2]: | n | elif base == lists[2]: |
| G += 1 | | G += 1 |
n | elif base == base_list[3]: | n | elif base == lists[3]: |
| T += 1 | | T += 1 |
n | cg_percentage = ((C + G) / (A + C + G + T)) * 100 | n | cg_percentage = ((C + G)/(A + C + G + T)) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
n | return "Error: Sequences Length Mismatch" | n | return 'Error: Sequences Length Mismatch' |
| else: | | else: |
| count = 0 | | count = 0 |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
t | count += 1 | t | count = count + 1 |
| return count | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 30
Student ID: 231, P-Value: 1.66e-02
Nearest Neighbor ID: 65
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
| | | return 'O' |
| elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| | | return 'O' |
| elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| | | return 'O' |
| elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
| | | return 'O' |
| elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: | | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: | n | |
| return 'O' | | |
| elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | | |
| return 'O' | | |
| elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | |
| return 'O' | | |
| elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | | |
| return 'O' | | |
| elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: | | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
n | pass | n | |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
n | nRemainder=nBoard | n | nRemainder=nBoard |
| for digit in range(8,-1,-1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| print(boardList) | | |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | decodeBoard(2291) | n | print(decodeBoard(1815)) |
| passfrom itertools import count | | |
| def countBases(seq): | | passdef countBases(seq): |
| A = seq.count('A') | | A = seq.count('A') |
| C = seq.count('C') | | C = seq.count('C') |
| G = seq.count('G') | | G = seq.count('G') |
| T = seq.count('T') | | T = seq.count('T') |
n | | n | Total = A + C + G + T |
| c_percentage = C / len(seq) * 100 | | cg_percentage = ((C + G) / Total) * 100 |
| g_percentage = G / len(seq) * 100 | | |
| cg_percentage = c_percentage + g_percentage | | |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | count1 = 0 | n | diff = 0 |
| if len(seq_a) == len(seq_b): | | if len(seq_a) == len(seq_b): |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
n | count1 += 1 | n | diff += 1 |
| | | return (diff) |
| else: | | else: |
t | return 'Error: Sequences Length Mismatch' | t | return "Error: Sequences Length Mismatch" |
| return count1 | | |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 31
Student ID: 196, P-Value: 2.03e-02
Nearest Neighbor ID: 176
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
| | | return 'X' |
| | | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
| | | return 'X' |
| | | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
| | | return 'X' |
| | | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| | | return 'X' |
| elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: | | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | n | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| return 'X' | | return 'O' |
| | | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
| | | return 'O' |
| | | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | n | |
| return 'X' | | |
| elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | n | |
| return 'X' | | |
| elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | |
| return 'O' | | |
| elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | |
| return 'X' | | |
| elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | | |
| return 'O' | | |
| elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | |
| return 'X' | | |
| elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | | |
| return 'X' | | |
| elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: | n | |
| return 'X' | | |
| elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: | | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
| pass | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
n | for digit in range(8, -1, -1): | n | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | passdef countBases(seq): | n | passdef countBases(seq_a): |
| A = 0 | | A = 0 |
n | for i in seq: | n | |
| if i == 'A': | | |
| A = A + 1 | | |
| C = 0 | | C = 0 |
n | for j in seq: | n | |
| if j == 'C': | | |
| C = C + 1 | | |
| G = 0 | | G = 0 |
n | for k in seq: | n | |
| if k == 'G': | | |
| G = G + 1 | | |
| T = 0 | | T = 0 |
n | for l in seq: | n | for d in seq_a: |
| | | if d == 'A': |
| | | A += 1 |
| | | elif d == 'C': |
| | | C += 1 |
| | | elif d == 'G': |
| | | G += 1 |
| if l == 'T': | | elif d == 'T': |
| T = T + 1 | | T += 1 |
| cg_percentage = (C + G)/len(seq) * 100 | | cg_percentage = float((C + G) / ((len(seq_a))) * 100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | if len(seq_a) != len(seq_b): | n | if len(seq_a) == len(seq_b): |
| | | diff = 0 |
| | | for i in range(len(seq_a)): |
| | | if seq_a[i] != seq_b[i]: |
| | | diff += 1 |
| | | else: |
| return 'Error: Sequences Length Mismatch' | | return 'Error: Sequences Length Mismatch' |
t | count = 0 | t | return diff |
| for i in range(len(seq_a)): | | |
| if seq_a[i] != seq_b[i]: | | |
| count = count + 1 | | |
| return count | | |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 32
Student ID: 290, P-Value: 2.08e-02
Nearest Neighbor ID: 176
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | n | |
| return 'X' | | |
| elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | | |
| return 'X' | | |
| elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
| elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
n | | n | return 'X' |
| | | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
| | | return 'X' |
| | | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: | | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: | | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | n | |
| return 'O' | | |
| elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
| return 'O' | | return 'O' |
| elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
n | | n | return 'O' |
| | | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| | | return 'O' |
| | | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
| elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
| elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: | | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
n | | n | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
n | for digit in reversed(range(9)): | n | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - (x * (3**digit)) | n | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | passdef countBases(seq): | n | passdef countBases(seq_a): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for x in seq: | n | for d in seq_a: |
| if x == 'A': | | if d == 'A': |
| A += 1 | | A += 1 |
| if x == 'C': | | elif d == 'C': |
| C += 1 | | C += 1 |
n | if x == 'G': | n | elif d == 'G': |
| G += 1 | | G += 1 |
n | if x == 'T': | n | elif d == 'T': |
| T += 1 | | T += 1 |
n | cg_percentage = ((C+G)/(A+C+G+T)) * 100 | n | cg_percentage = float((C + G) / ((len(seq_a))) * 100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | Dh = 0 | n | |
| if len(seq_a) == len(seq_b): | | if len(seq_a) == len(seq_b): |
n | | n | diff = 0 |
| for x in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[x] != seq_b[x]: | | if seq_a[i] != seq_b[i]: |
| Dh += 1 | | diff += 1 |
| return Dh | | |
| else: | | else: |
t | return ('Error: Sequences Length Mismatch') | t | return 'Error: Sequences Length Mismatch' |
| | | return diff |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 33
Student ID: 63, P-Value: 2.57e-02
Nearest Neighbor ID: 176
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
n | | n | return 'X' |
| | | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
| | | return 'X' |
| | | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
| | | return 'X' |
| | | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
| elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
| return 'X' | | return 'X' |
| elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| | | return 'X' |
| elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: | | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | n | |
| return 'O' | | |
| elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| if boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | | |
| return 'X' | | |
| elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | |
| return 'X' | | |
| elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | |
| return 'X' | | |
| elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
| return 'O' | | return 'O' |
| elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | if boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | n | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| return 'X' | | return 'O' |
| elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: | | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
| return 'X' | | return 'O' |
| elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
| elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: | | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
n | return'-' | n | return '-' |
| pass | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
n | for digit in range(8, -1,-1): | n | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | | n | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | passdef countBases(seq): | n | passdef countBases(seq_a): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
| for x in seq: | | for d in seq_a: |
| if x == 'A': | | if d == 'A': |
| A += 1 | | A += 1 |
n | elif x == 'C': | n | elif d == 'C': |
| C += 1 | | C += 1 |
| elif x == 'G': | | elif d == 'G': |
| G += 1 | | G += 1 |
| elif x == 'T': | | elif d == 'T': |
| T += 1 | | T += 1 |
| else: | | |
| continue | | |
| cg_percentage = (((C + G) / (len(seq))) * 100) | | cg_percentage = float((C + G) / ((len(seq_a))) * 100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | if len(seq_a) != len(seq_b): | n | if len(seq_a) == len(seq_b): |
| return "Error: Sequences Length Mismatch" | | diff = 0 |
| | | for i in range(len(seq_a)): |
| | | if seq_a[i] != seq_b[i]: |
| | | diff += 1 |
| else: | | else: |
t | diff = 0 | t | return 'Error: Sequences Length Mismatch' |
| for i in range(0, len(seq_a)): | | |
| if seq_a[i] != seq_b[i]: | | |
| diff += 1 | | |
| return diff | | return diff |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 34
Student ID: 10, P-Value: 2.67e-02
Nearest Neighbor ID: 370
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
n | def findWinner(boardList) : | n | def findWinner(boardList): |
| for row in range(3) : | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2] : | | if boardList[row * 3] == boardList[row * 3+1] == boardList[row * 3+2]: |
| if boardList[row*3] == 1 : | | if boardList[row * 3] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[row*3] == 2 : | n | elif boardList[row * 3] == 2: |
| return 'O' | | return 'O' |
n | for col in range(3) : | n | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6] : | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1 : | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[col] == 2 : | n | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
n | if boardList[0] == boardList[4] == boardList[8] : | n | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1 : | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[0] == 2 : | n | elif boardList[0] == 2: |
| return '0' | | return '0' |
n | if boardList[2] == boardList[4] == boardList[6] : | n | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1 : | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2 : | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
n | nRemainder = nBoard | n | nRemainder = nBoard |
| for digit in range(8, -1, -1) : | | for digit in range(8, -1, -1): |
| x = nRemainder / (3 ** digit) | | x = nRemainder / (3 ** digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3 ** digit)) | | nRemainder = nRemainder - (x * (3 ** digit)) |
| boardList.append(x) | | boardList.append(x) |
n | return boardListdef countBases(seq): | n | return boardList |
| | | def countBases(seq): |
| A, C, G, T = 0, 0, 0, 0 | | A, C, G, T = 0, 0, 0, 0 |
n | for i in seq : | n | for i in seq: |
| if i == 'A' : A += 1 | | if i == 'A' : A += 1 |
| if i == 'C' : C += 1 | | if i == 'C' : C += 1 |
| if i == 'G' : G += 1 | | if i == 'G' : G += 1 |
| if i == 'T' : T += 1 | | if i == 'T' : T += 1 |
n | cg_percentage = (C + G) / (A + C + G + T) * 100 | n | cg_percentage = (C+G)/(A+C+G+T) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch' | | if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch' |
n | seq_a_count = countBases(seq_a) | n | seq_a_count=countBases(seq_a) |
| seq_b_count = countBases(seq_b) | | seq_b_count=countBases(seq_b) |
| seq_a_count = seq_a_count.split(' ') | | seq_a_count=seq_a_count.split(' ') |
| seq_b_count = seq_b_count.split(' ') | | seq_b_count=seq_b_count.split(' ') |
| seq_a_count[3] = seq_a_count[3][:seq_a_count[3].index('\n')] | | seq_a_count[3]=seq_a_count[3][:seq_a_count[3].index('\n')] |
| seq_b_count[3] = seq_b_count[3][:seq_b_count[3].index('\n')] | | seq_b_count[3]=seq_b_count[3][:seq_b_count[3].index('\n')] |
| difference = 0 | | difference = 0 |
t | for i in range(0, 4) : | t | for i in range(len(seq_a)): |
| difference += abs(int(seq_a_count[i]) - int(seq_b_count[i])) * 2 | | if (seq_a[i] == seq_b[i]): |
| | | pass |
| | | else: |
| | | difference +=1 |
| return difference | | return difference |
| if __name__=="__main__": | | if __name__=="__main__": |
| print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT')) | | print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT')) |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 35
Student ID: 370, P-Value: 2.67e-02
Nearest Neighbor ID: 10
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
n | def findWinner(boardList): | n | def findWinner(boardList) : |
| for row in range(3): | | for row in range(3) : |
| if boardList[row * 3] == boardList[row * 3+1] == boardList[row * 3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2] : |
| if boardList[row * 3] == 1: | | if boardList[row*3] == 1 : |
| return 'X' | | return 'X' |
n | elif boardList[row * 3] == 2: | n | elif boardList[row*3] == 2 : |
| return 'O' | | return 'O' |
n | for col in range(3): | n | for col in range(3) : |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6] : |
| if boardList[col] == 1: | | if boardList[col] == 1 : |
| return 'X' | | return 'X' |
n | elif boardList[col] == 2: | n | elif boardList[col] == 2 : |
| return 'O' | | return 'O' |
n | if boardList[0] == boardList[4] == boardList[8]: | n | if boardList[0] == boardList[4] == boardList[8] : |
| if boardList[0] == 1: | | if boardList[0] == 1 : |
| return 'X' | | return 'X' |
n | elif boardList[0] == 2: | n | elif boardList[0] == 2 : |
| return '0' | | return '0' |
n | if boardList[2] == boardList[4] == boardList[6]: | n | if boardList[2] == boardList[4] == boardList[6] : |
| if boardList[2] == 1: | | if boardList[2] == 1 : |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2 : |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
n | nRemainder = nBoard | n | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1) : |
| x = nRemainder / (3 ** digit) | | x = nRemainder / (3 ** digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - (x * (3 ** digit)) | | nRemainder = nRemainder - (x * (3 ** digit)) |
| boardList.append(x) | | boardList.append(x) |
n | return boardList | n | return boardListdef countBases(seq): |
| def countBases(seq): | | |
| A, C, G, T = 0, 0, 0, 0 | | A, C, G, T = 0, 0, 0, 0 |
n | for i in seq: | n | for i in seq : |
| if i == 'A' : A += 1 | | if i == 'A' : A += 1 |
| if i == 'C' : C += 1 | | if i == 'C' : C += 1 |
| if i == 'G' : G += 1 | | if i == 'G' : G += 1 |
| if i == 'T' : T += 1 | | if i == 'T' : T += 1 |
n | cg_percentage = (C+G)/(A+C+G+T) * 100 | n | cg_percentage = (C + G) / (A + C + G + T) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch' | | if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch' |
n | seq_a_count=countBases(seq_a) | n | seq_a_count = countBases(seq_a) |
| seq_b_count=countBases(seq_b) | | seq_b_count = countBases(seq_b) |
| seq_a_count=seq_a_count.split(' ') | | seq_a_count = seq_a_count.split(' ') |
| seq_b_count=seq_b_count.split(' ') | | seq_b_count = seq_b_count.split(' ') |
| seq_a_count[3]=seq_a_count[3][:seq_a_count[3].index('\n')] | | seq_a_count[3] = seq_a_count[3][:seq_a_count[3].index('\n')] |
| seq_b_count[3]=seq_b_count[3][:seq_b_count[3].index('\n')] | | seq_b_count[3] = seq_b_count[3][:seq_b_count[3].index('\n')] |
| difference = 0 | | difference = 0 |
t | for i in range(len(seq_a)): | t | for i in range(0, 4) : |
| if (seq_a[i] == seq_b[i]): | | difference += abs(int(seq_a_count[i]) - int(seq_b_count[i])) * 2 |
| pass | | |
| else: | | |
| difference +=1 | | |
| return difference | | return difference |
| if __name__=="__main__": | | if __name__=="__main__": |
| print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT')) | | print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT')) |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 36
Student ID: 307, P-Value: 2.88e-02
Nearest Neighbor ID: 217
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for column in range(3): | | for column in range(3): |
| if boardList[column] == boardList[column+3] == boardList[column+6]: | | if boardList[column] == boardList[column+3] == boardList[column+6]: |
| if boardList[column] == 1: | | if boardList[column] == 1: |
n | return "X" | n | return 'X' |
| elif boardList[column] == 2: | | elif boardList[column] == 2: |
n | return "O" | n | return 'O' |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
n | return "X" | n | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
n | return "O" | n | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
n | return "X" | n | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
n | return "O" | n | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
n | return "X" | n | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
n | return "O" | n | return 'O' |
| else: | | |
| return "-" | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList=[] | n | boardList = [] |
| nRemainder=nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
n | return boardList | n | return boardListdef countBases(seq): |
| if __name__=="__main__": | | |
| passdef countBases(sequence): | | |
| A, C, G, T = 0, 0, 0, 0 | | A, C, G, T = 0, 0, 0, 0 |
| for i in sequence: | | for i in seq: |
| if i == "A": | | if i == "A": |
| A+= 1 | | A += 1 |
| elif i == "G": | | elif i == "G": |
| G += 1 | | G += 1 |
| elif i == "C": | | elif i == "C": |
| C += 1 | | C += 1 |
| elif i == "T": | | elif i == "T": |
| T += 1 | | T += 1 |
| else: | | else: |
| continue | | continue |
| cg_percentage = ((C + G) / len(sequence)) * 100 | | cg_percentage = ((C + G) / len(seq)) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | if len(seq_a,)!= len( seq_b): | n | if len(seq_a) != len(seq_b): |
| return"Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| count = 0 | | count = 0 |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] == seq_b[i]: | | if seq_a[i] == seq_b[i]: |
| count += 1 | | count += 1 |
t | return count -1 | t | return count - 1 |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 37
Student ID: 217, P-Value: 2.88e-02
Nearest Neighbor ID: 307
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for column in range(3): | | for column in range(3): |
| if boardList[column] == boardList[column+3] == boardList[column+6]: | | if boardList[column] == boardList[column+3] == boardList[column+6]: |
| if boardList[column] == 1: | | if boardList[column] == 1: |
n | return 'X' | n | return "X" |
| elif boardList[column] == 2: | | elif boardList[column] == 2: |
n | return 'O' | n | return "O" |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
n | return 'X' | n | return "X" |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
n | return 'O' | n | return "O" |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
n | return 'X' | n | return "X" |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
n | return 'O' | n | return "O" |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
n | return 'X' | n | return "X" |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
n | return 'O' | n | return "O" |
| | | else: |
| return '-' | | return "-" |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList = [] | n | boardList=[] |
| nRemainder = nBoard | | nRemainder=nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - (x * (3**digit)) | n | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
n | return boardListdef countBases(seq): | n | return boardList |
| | | if __name__=="__main__": |
| | | passdef countBases(sequence): |
| A, C, G, T = 0, 0, 0, 0 | | A, C, G, T = 0, 0, 0, 0 |
| for i in seq: | | for i in sequence: |
| if i == "A": | | if i == "A": |
| A += 1 | | A+= 1 |
| elif i == "G": | | elif i == "G": |
| G += 1 | | G += 1 |
| elif i == "C": | | elif i == "C": |
| C += 1 | | C += 1 |
| elif i == "T": | | elif i == "T": |
| T += 1 | | T += 1 |
| else: | | else: |
| continue | | continue |
| cg_percentage = ((C + G) / len(seq)) * 100 | | cg_percentage = ((C + G) / len(sequence)) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | if len(seq_a) != len(seq_b): | n | if len(seq_a,)!= len( seq_b): |
| return "Error: Sequences Length Mismatch" | | return"Error: Sequences Length Mismatch" |
| count = 0 | | count = 0 |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] == seq_b[i]: | | if seq_a[i] == seq_b[i]: |
| count += 1 | | count += 1 |
t | return count - 1 | t | return count -1 |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 38
Student ID: 119, P-Value: 3.04e-02
Nearest Neighbor ID: 64
Student (left) and Nearest Neighbor (right).
n | import math | n | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | if boardList[0] == boardList[1] == boardList[2]: | n | if boardList[0] == boardList[1] == boardList[2]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
| elif boardList[3] == boardList[4] == boardList[5]: | | elif boardList[3] == boardList[4] == boardList[5]: |
| if boardList[3] == 1: | | if boardList[3] == 1: |
| return 'X' | | return 'X' |
| if boardList[3] == 2: | | if boardList[3] == 2: |
| return 'O' | | return 'O' |
| elif boardList[6] == boardList[7] == boardList[8]: | | elif boardList[6] == boardList[7] == boardList[8]: |
| if boardList[6] == 1: | | if boardList[6] == 1: |
| return 'X' | | return 'X' |
| if boardList[6] == 2: | | if boardList[6] == 2: |
| return 'O' | | return 'O' |
| elif boardList[0] == boardList[3] == boardList[6]: | | elif boardList[0] == boardList[3] == boardList[6]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
| elif boardList[1] == boardList[4] == boardList[7]: | | elif boardList[1] == boardList[4] == boardList[7]: |
| if boardList[1] == 1: | | if boardList[1] == 1: |
| return 'X' | | return 'X' |
| if boardList[1] == 2: | | if boardList[1] == 2: |
| return 'O' | | return 'O' |
| elif boardList[2] == boardList[5] == boardList[8]: | | elif boardList[2] == boardList[5] == boardList[8]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| if boardList[2] == 2: | | if boardList[2] == 2: |
| return 'O' | | return 'O' |
| elif boardList[0] == boardList[4] == boardList[8]: | | elif boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
| elif boardList[2] == boardList[4] == boardList[6]: | | elif boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| if boardList[2] == 2: | | if boardList[2] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
| pass | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
n | for digit in range(8,-1,-1): | n | for digit in range(8,-1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | | n | pass |
| passdef countBases(seq): | | def countBases(seq): |
| A, C, G, T = 0,0,0,0 | | A = 0 |
| for j in seq: | | C = 0 |
| | | G = 0 |
| | | T = 0 |
| | | for user_number in seq: |
| if j == 'A': | | if user_number == 'A': |
| A +=1 | | A +=1 |
n | elif j == 'C': | n | elif user_number == 'C': |
| C += 1 | | C +=1 |
| elif j == 'G': | | elif user_number == 'G': |
| G += 1 | | G +=1 |
| elif j == 'T': | | elif user_number == 'T': |
| T += 1 | | T += 1 |
| else: | | else: |
n | print('Not in DNA') | n | print('Error') |
| cg_percentage = ((C+G)/len(seq))*100 | | cg_percentage = ((C+G)/len(seq))*100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | | n | h_distance = 0 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
n | return 'Error: Sequences Length Mismatch' | n | return 'Error: Sequence Length Mismatch' |
| ham_distance = 0 | | |
| for j in range(len(seq_a)): | | for user_number in range(len(seq_a)): |
| if seq_a[j] != seq_b[j]: | | if seq_a[user_number] != seq_b[user_number]: |
| ham_distance += 1 | | h_distance += 1 |
| else: | | else: |
| print('Error: Sequences Length Mismatch') | | print('Error: Sequences Length Mismatch') |
t | return ham_distance | t | return h_distance |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 39
Student ID: 51, P-Value: 3.21e-02
Nearest Neighbor ID: 176
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | n | |
| return 'X' | | |
| elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
| elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
n | return 'X' | n | |
| elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: | | |
| return 'X' | | return 'X' |
| elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
| elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
| return 'X' | | return 'X' |
| elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| | | return 'X' |
| elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: | | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
n | return 'O' | n | |
| elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | |
| return 'O' | | return 'O' |
| elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
n | return 'O' | n | |
| elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: | | |
| return 'O' | | return 'O' |
| elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
| elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| return 'O' | | return 'O' |
| elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | | n | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| | | return 'O' |
| | | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
n | | n | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
n | nRemainder = nBoard | n | nRemainder=nBoard |
| for digit in range(8,-1,-1): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | | n | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | |
| return boardList | | return boardList |
n | | n | if __name__=="__main__": |
| def countBases(seq): | | passdef countBases(seq_a): |
| seq = list(seq) | | |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for i in range(len(seq)): | n | for d in seq_a: |
| if seq[i] == 'A': | | if d == 'A': |
| A += 1 | | A += 1 |
| elif seq[i] == 'C': | | elif d == 'C': |
| C += 1 | | C += 1 |
n | elif seq[i] == 'G': | n | elif d == 'G': |
| G += 1 | | G += 1 |
n | elif seq[i] == 'T': | n | elif d == 'T': |
| T += 1 | | T += 1 |
n | C_percentage = (C / len(seq)) * 100 | n | cg_percentage = float((C + G) / ((len(seq_a))) * 100) |
| G_percentage = (G / len(seq)) * 100 | | |
| cg_percentage = C_percentage + G_percentage | | |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | dH = 0 | n | |
| if len(seq_a) != len(seq_b): | | if len(seq_a) == len(seq_b): |
| | | diff = 0 |
| | | for i in range(len(seq_a)): |
| | | if seq_a[i] != seq_b[i]: |
| | | diff += 1 |
| | | else: |
| return 'Error: Sequences Length Mismatch' | | return 'Error: Sequences Length Mismatch' |
t | for i in range(len(seq_a)): | t | |
| if seq_a[i] != seq_b[i]: | | |
| dH += 1 | | |
| else: | | |
| dH += 0 | | |
| return dH | | return diff |
| | | if __name__=="__main__": |
| | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 40
Student ID: 431, P-Value: 3.57e-02
Nearest Neighbor ID: 467
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == boardList[1] == boardList[2]: | | if boardList[0] == boardList[1] == boardList[2]: |
n | if boardList[0] == 0: | n | |
| return '-' | | |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[3] == boardList[4] == boardList[5]: | | if boardList[3] == boardList[4] == boardList[5]: |
n | if boardList[3] == 0: | n | |
| return '-' | | |
| if boardList[3] == 1: | | if boardList[3] == 1: |
| return 'X' | | return 'X' |
| if boardList[3] == 2: | | if boardList[3] == 2: |
| return 'O' | | return 'O' |
| if boardList[6] == boardList[7] == boardList[8]: | | if boardList[6] == boardList[7] == boardList[8]: |
n | if boardList[6] == 0: | n | |
| return '-' | | |
| if boardList[6] == 1: | | if boardList[6] == 1: |
| return 'X' | | return 'X' |
| if boardList[6] == 2: | | if boardList[6] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[3] == boardList[6]: | | if boardList[0] == boardList[3] == boardList[6]: |
n | if boardList[3] == 0: | n | |
| return '-' | | |
| if boardList[3] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
n | if boardList[3] == 2: | n | if boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[1] == boardList[4] == boardList[7]: | | if boardList[1] == boardList[4] == boardList[7]: |
n | if boardList[1] == 0: | n | |
| return '-' | | |
| if boardList[1] == 1: | | if boardList[1] == 1: |
| return 'X' | | return 'X' |
| if boardList[1] == 2: | | if boardList[1] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[5] == boardList[8]: | | if boardList[2] == boardList[5] == boardList[8]: |
n | if boardList[2] == 0: | n | |
| return '-' | | |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| if boardList[2] == 2: | | if boardList[2] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
n | if boardList[0] == 0: | n | |
| return '-' | | |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
n | if boardList[2] == 0: | n | |
| return '-' | | |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| if boardList[2] == 2: | | if boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
n | for digit in range(8,-1,-1): | n | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for letter in seq: | n | cg_percentage = 0.0 |
| if letter == "A": | | for i in range(0, len(seq)): |
| | | if seq[i] == 'A': |
| A += 1 | | A += 1 |
n | if letter == "C": | n | if seq[i] == 'C': |
| C += 1 | | C += 1 |
n | if letter == "G": | n | if seq[i] == 'G': |
| G +=1 | | G += 1 |
| if letter == "T": | | if seq[i] == 'T': |
| T += 1 | | T += 1 |
n | cg_percentage =((G+C) / (A+C+G+T))*100 | n | cg_percentage = ((C + G) / len(seq)) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | | n | count = 0 |
| if len(seq_a) == len(seq_b): | | if len(seq_a) != len(seq_b): |
| distance = 0 | | return "Error: Sequences Length Mismatch" |
| for i in range(len(seq_a)): | | |
| if seq_a != seq_b: | | |
| distance += 1 | | |
| print(distance) | | |
| else: | | else: |
n | print("Error: Sequences Length Mismatch") | n | for i in range(0, len(seq_a)): |
| | | if seq_a[i] != seq_b[i]: |
| | | count += 1 |
| | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
t | basecount=countBases | t | |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 41
Student ID: 250, P-Value: 3.83e-02
Nearest Neighbor ID: 467
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | if boardList[0] == boardList[1] and boardList[1] == boardList [2]: | n | if boardList[0] == boardList[1] == boardList[2]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
n | pass | n | |
| elif boardList[3] == boardList[4] and boardList[4] == boardList [5]: | | if boardList[3] == boardList[4] == boardList[5]: |
| if boardList[3] == 1: | | if boardList[3] == 1: |
| return 'X' | | return 'X' |
| if boardList[3] == 2: | | if boardList[3] == 2: |
| return 'O' | | return 'O' |
n | pass | n | |
| elif boardList[6] == boardList[7] and boardList[7] == boardList [8]: | | if boardList[6] == boardList[7] == boardList[8]: |
| if boardList[6] == 1: | | if boardList[6] == 1: |
| return 'X' | | return 'X' |
| if boardList[6] == 2: | | if boardList[6] == 2: |
| return 'O' | | return 'O' |
n | pass | n | |
| elif boardList[0] == boardList[3] and boardList[3] == boardList [6]: | | if boardList[0] == boardList[3] == boardList[6]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
n | pass | n | |
| elif boardList[1] == boardList[4] and boardList[4] == boardList [7]: | | if boardList[1] == boardList[4] == boardList[7]: |
| if boardList[1] == 1: | | if boardList[1] == 1: |
| return 'X' | | return 'X' |
| if boardList[1] == 2: | | if boardList[1] == 2: |
| return 'O' | | return 'O' |
n | pass | n | |
| elif boardList[2] == boardList[5] and boardList[5] == boardList [8]: | | if boardList[2] == boardList[5] == boardList[8]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| if boardList[2] == 2: | | if boardList[2] == 2: |
| return 'O' | | return 'O' |
n | pass | n | |
| elif boardList[0] == boardList[4] and boardList[4] == boardList [8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| if boardList[0] == 2: | | if boardList[0] == 2: |
| return 'O' | | return 'O' |
n | pass | n | |
| elif boardList[2] == boardList[5] and boardList[5] == boardList [6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| if boardList[2] == 2: | | if boardList[2] == 2: |
| return 'O' | | return 'O' |
n | pass | n | |
| else: | | |
| return '-' | | return '-' |
| pass | | |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for i in seq: | n | cg_percentage = 0.0 |
| | | for i in range(0, len(seq)): |
| if i == 'A': | | if seq[i] == 'A': |
| A += 1 | | A += 1 |
n | elif i == 'C': | n | if seq[i] == 'C': |
| C += 1 | | C += 1 |
n | elif i == 'G': | n | if seq[i] == 'G': |
| G += 1 | | G += 1 |
n | elif i == 'T': | n | if seq[i] == 'T': |
| T += 1 | | T += 1 |
n | cg_percentage = ((C + G) / (C +G + A + T)) * 100 | n | cg_percentage = ((C + G) / len(seq)) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | list(seq_a) | n | count = 0 |
| list(seq_b) | | |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
t | sim_count = 0 | t | |
| for j in range(len(seq_a)): | | for i in range(0, len(seq_a)): |
| if seq_a[j] != seq_b [j]: | | if seq_a[i] != seq_b[i]: |
| sim_count += 1 | | count += 1 |
| return sim_count | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 42
Student ID: 170, P-Value: 4.10e-02
Nearest Neighbor ID: 176
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
n | return 'X' | n | |
| elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | | |
| return 'X' | | |
| elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | | |
| return 'X' | | return 'X' |
| elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
| elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
| | | return 'X' |
| | | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| | | return 'X' |
| elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] ==1: | n | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: | | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
n | return 'O' | n | |
| elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | | |
| return 'O' | | |
| elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | |
| return 'O' | | return 'O' |
| elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
| return 'O' | | return 'O' |
| elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | | n | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| | | return 'O' |
| | | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] ==2: | n | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
| pass | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
| for digit in range(8,-1,-1): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | passdef countBases(seq): | n | passdef countBases(seq_a): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for k in range(0,len(seq)): | n | for d in seq_a: |
| if seq[k] == "C": | | if d == 'A': |
| | | A += 1 |
| | | elif d == 'C': |
| C += 1 | | C += 1 |
n | if seq[k] == "A": | n | elif d == 'G': |
| A += 1 | | |
| if seq[k] == "G": | | |
| G += 1 | | G += 1 |
n | if seq[k] == "T": | n | elif d == 'T': |
| T += 1 | | T += 1 |
n | cg_percentage = C/len(seq)*100 + G/len(seq)*100 | n | cg_percentage = float((C + G) / ((len(seq_a))) * 100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
n | def hammingdistance(s, t): | n | def hammingdistance(seq_a, seq_b): |
| difference = 0 | | |
| if len(s) == len(t): | | if len(seq_a) == len(seq_b): |
| | | diff = 0 |
| for k in range(0,len(s)): | | for i in range(len(seq_a)): |
| if s[k] != t[k]: | | if seq_a[i] != seq_b[i]: |
| difference += 1 | | diff += 1 |
| return difference | | |
| else: | | else: |
t | return "Error: Sequences Length Mismatch" | t | return 'Error: Sequences Length Mismatch' |
| | | return diff |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 43
Student ID: 236, P-Value: 4.31e-02
Nearest Neighbor ID: 196
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
| | | return 'O' |
| elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
n | return'X' | n | return 'X' |
| | | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| | | return 'O' |
| elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| | | return 'O' |
| elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
| | | return 'O' |
| elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: | | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: | n | |
| return 'O' | | |
| elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | | |
| return 'O' | | |
| elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | |
| return 'O' | | |
| elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | | |
| return 'O' | | |
| elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: | | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
n | | n | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
n | nRemainder = nBoard | n | nRemainder=nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
n | A=0 | n | A = 0 |
| C=0 | | |
| G=0 | | |
| T=0 | | |
| for r in seq: | | for i in seq: |
| if r == 'A': | | if i == 'A': |
| A = 1 + A | | A = A + 1 |
| | | C = 0 |
| | | for j in seq: |
| if r == 'C': | | if j == 'C': |
| C = 1 + C | | C = C + 1 |
| | | G = 0 |
| | | for k in seq: |
| if r == 'G': | | if k == 'G': |
| G = 1 + G | | G = G + 1 |
| | | T = 0 |
| | | for l in seq: |
| if r == 'T': | | if l == 'T': |
| T = 1+T | | T = T + 1 |
| cg_percentage = ((G + C)/(len(seq)))*100 | | cg_percentage = (C + G)/len(seq) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
| return 'Error: Sequences Length Mismatch' | | return 'Error: Sequences Length Mismatch' |
t | else: | t | count = 0 |
| pog = 0 | | |
| for gaming in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[gaming] != seq_b[gaming]: | | if seq_a[i] != seq_b[i]: |
| pog += 1 | | count = count + 1 |
| return pog | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 44
Student ID: 164, P-Value: 4.61e-02
Nearest Neighbor ID: 196
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | | n | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
| | | return 'X' |
| if boardList[0] == 2 and boardList[1] ==2 and boardList[2] == 2: | | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
| return 'O' | | return 'O' |
n | | n | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
| | | return 'X' |
| elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| return 'O' | | return 'O' |
n | | n | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| | | return 'X' |
| elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
n | return 'O' | n | return 'O' |
| | | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
| | | return 'X' |
| elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
n | | n | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
| | | return 'X' |
| elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
| return 'O' | | return 'O' |
n | | n | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
| | | return 'X' |
| elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | | n | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
| | | return 'X' |
| elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | | n | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| | | return 'X' |
| elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: | | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | n | |
| return 'X' | | |
| elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | | |
| return 'X' | | |
| elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | | |
| return 'X' | | |
| elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | | |
| return 'X' | | |
| elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | |
| return 'X' | | |
| elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | |
| return 'X' | | |
| elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | | |
| return 'X' | | |
| elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: | | |
| return 'X' | | |
| else: | | else: |
| return '-' | | return '-' |
n | | n | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
n | for digit in range(8,-1,-1): | n | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
n | seq = list(seq) | n | A = 0 |
| A = seq.count("A") | | for i in seq: |
| C = seq.count("C") | | if i == 'A': |
| G = seq.count("G") | | A = A + 1 |
| T = seq.count("T") | | C = 0 |
| | | for j in seq: |
| | | if j == 'C': |
| | | C = C + 1 |
| | | G = 0 |
| | | for k in seq: |
| | | if k == 'G': |
| | | G = G + 1 |
| | | T = 0 |
| | | for l in seq: |
| | | if l == 'T': |
| | | T = T + 1 |
| cg_percentage = (C + G)/(A + C + G + T) * 100 | | cg_percentage = (C + G)/len(seq) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | if len(seq_a) is len(seq_b): | n | if len(seq_a) != len(seq_b): |
| count = 0 | | |
| for i in range(int(len(seq_a))): | | |
| if seq_a[i] == seq_b[i]: | | |
| count = count + 1 | | |
| ham_distance = len(seq_a) - count | | |
| return ham_distance | | |
| else: | | |
| return 'Error: Sequences Length Mismatch' | | return 'Error: Sequences Length Mismatch' |
t | | t | count = 0 |
| | | for i in range(len(seq_a)): |
| | | if seq_a[i] != seq_b[i]: |
| | | count = count + 1 |
| | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 45
Student ID: 399, P-Value: 4.84e-02
Nearest Neighbor ID: 370
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
n | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | n | if boardList[row * 3] == boardList[row * 3+1] == boardList[row * 3+2]: |
| if boardList[row*3] == 1: | | if boardList[row * 3] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[row*3] == 2: | n | elif boardList[row * 3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
n | return'X' | n | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
n | return 'O' | n | return '0' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| if boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return'-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
n | nRemainder = nBoard | n | nRemainder = nBoard |
| for digit in range(8,-1,-1): | | for digit in range(8, -1, -1): |
| x = nRemainder/(3**digit) | | x = nRemainder / (3 ** digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - (x*(3**digit)) | n | nRemainder = nRemainder - (x * (3 ** digit)) |
| boardList.append(x) | | boardList.append(x) |
n | return boardListdef countBases(seq): | n | return boardList |
| A = seq.count("A") | | def countBases(seq): |
| C = seq.count("C") | | A, C, G, T = 0, 0, 0, 0 |
| G = seq.count("G") | | for i in seq: |
| T = seq.count("T") | | if i == 'A' : A += 1 |
| | | if i == 'C' : C += 1 |
| | | if i == 'G' : G += 1 |
| | | if i == 'T' : T += 1 |
| cg_percentage = (C + G)/(len(seq)) * 100 | | cg_percentage = (C+G)/(A+C+G+T) * 100 |
| return '{:d} {:d} {:d} {:d} \n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
| if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch' | | if len(seq_a) != len(seq_b) : return 'Error: Sequences Length Mismatch' |
n | seq_a_count = countBases(seq_a) | n | seq_a_count=countBases(seq_a) |
| seq_b_count = countBases(seq_b) | | seq_b_count=countBases(seq_b) |
| seq_a_count = seq_a_count.split(' ') | | seq_a_count=seq_a_count.split(' ') |
| seq_b_count = seq_b_count.split(' ') | | seq_b_count=seq_b_count.split(' ') |
| seq_a_count[3] = seq_a_count[3][:seq_a_count[3].index('\n')] | | seq_a_count[3]=seq_a_count[3][:seq_a_count[3].index('\n')] |
| seq_b_count[3] = seq_b_count[3][:seq_b_count[3].index('\n')] | | seq_b_count[3]=seq_b_count[3][:seq_b_count[3].index('\n')] |
| difference = 0 | | difference = 0 |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if (seq_a[i] == seq_b[i]): | | if (seq_a[i] == seq_b[i]): |
| pass | | pass |
| else: | | else: |
n | difference += 1 | n | difference +=1 |
| return difference | | return difference |
t | if __name__ == "__main__": | t | if __name__=="__main__": |
| print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT')) | | print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT')) |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 46
Student ID: 459, P-Value: 5.16e-02
Nearest Neighbor ID: 467
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == boardList[1] == boardList[2]: | | if boardList[0] == boardList[1] == boardList[2]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[0] == 2: | n | if boardList[0] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[3] == boardList[4] == boardList[5]: | n | if boardList[3] == boardList[4] == boardList[5]: |
| if boardList[3] == 1: | | if boardList[3] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[3] == 2: | n | if boardList[3] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[6] == boardList[7] == boardList[8]: | n | if boardList[6] == boardList[7] == boardList[8]: |
| if boardList[6] == 1: | | if boardList[6] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[6] == 2: | n | if boardList[6] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[0] == boardList[3] == boardList[6]: | n | if boardList[0] == boardList[3] == boardList[6]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[0] == 2: | n | if boardList[0] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[1] == boardList[4] == boardList[7]: | n | if boardList[1] == boardList[4] == boardList[7]: |
| if boardList[1] == 1: | | if boardList[1] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[1] == 2: | n | if boardList[1] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[2] == boardList[5] == boardList[8]: | n | if boardList[2] == boardList[5] == boardList[8]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[2] == 2: | n | if boardList[2] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[0] == boardList[4] == boardList[8]: | n | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[0] == 2: | n | if boardList[0] == 2: |
| return 'O' | | return 'O' |
n | elif boardList[2] == boardList[4] == boardList[6]: | n | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[2] == 2: | n | if boardList[2] == 2: |
| return 'O' | | return 'O' |
n | else: | n | |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | a = int(input()) | n | |
| b = decodeBoard(a) | | |
| findWinner(b) | | |
| def countBases(seq): | | passdef countBases(seq): |
| A = seq.count('A') | | A = 0 |
| C = seq.count('C') | | C = 0 |
| G = seq.count('G') | | G = 0 |
| T = seq.count('T') | | T = 0 |
| | | cg_percentage = 0.0 |
| | | for i in range(0, len(seq)): |
| | | if seq[i] == 'A': |
| | | A += 1 |
| | | if seq[i] == 'C': |
| | | C += 1 |
| | | if seq[i] == 'G': |
| | | G += 1 |
| | | if seq[i] == 'T': |
| | | T += 1 |
| cg_percentage = (C + G) / (A+C+G+T) * 100 | | cg_percentage = ((C + G) / len(seq)) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | diff_char = 0 | n | count = 0 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
n | return 'Error: Sequences Length Mismatch' | n | return "Error: Sequences Length Mismatch" |
| else: | | else: |
n | for i in range(len(seq_a)): | n | for i in range(0, len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
n | diff_char += 1 | n | count += 1 |
| return diff_char | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
t | | t | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 47
Student ID: 288, P-Value: 5.49e-02
Nearest Neighbor ID: 176
Student (left) and Nearest Neighbor (right).
n | | n | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
n | return 'X' | n | |
| elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | | |
| return 'X' | | |
| elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | | |
| return 'X' | | return 'X' |
| elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | | elif boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
| elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
n | | n | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
| | | return 'X' |
| | | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| | | return 'X' |
| elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | | elif boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: | | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: | | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
n | return 'O' | n | |
| elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | | |
| return 'O' | | |
| elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | |
| return 'O' | | return 'O' |
| elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
| return 'O' | | return 'O' |
| elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | | n | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| | | return 'O' |
| | | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
| | | return 'O' |
| elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
| elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: | | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
| return '-' | | return '-' |
n | | n | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
| for digit in range(8,-1,-1): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
n | import math | n | |
| if __name__=="__main__": | | if __name__=="__main__": |
n | passdef countBases(seq): | n | passdef countBases(seq_a): |
| As=0 | | A = 0 |
| Cs=0 | | C = 0 |
| Gs=0 | | G = 0 |
| Ts=0 | | T = 0 |
| for _ in seq: | | for d in seq_a: |
| if _ == 'A': | | if d == 'A': |
| As +=1 | | A += 1 |
| elif _ == 'C': | | elif d == 'C': |
| Cs+=1 | | C += 1 |
| elif _ == 'G': | | elif d == 'G': |
| Gs+=1 | | G += 1 |
| elif _ == 'T': | | elif d == 'T': |
| Ts+=1 | | T += 1 |
| cg_percentage = 100 * (Cs+Gs) / (len(seq)) | | cg_percentage = float((C + G) / ((len(seq_a))) * 100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(As, Cs, Gs, Ts, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | num_diff=0 | n | |
| if len(seq_a) != len(seq_b): | | if len(seq_a) == len(seq_b): |
| | | diff = 0 |
| | | for i in range(len(seq_a)): |
| | | if seq_a[i] != seq_b[i]: |
| | | diff += 1 |
| | | else: |
| return 'Error: Sequences Length Mismatch' | | return 'Error: Sequences Length Mismatch' |
t | else: | t | |
| for i in range(0,len(seq_a)): | | |
| if seq_a[i] != seq_b[i]: | | |
| num_diff+=1 | | |
| return num_diff | | return diff |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 48
Student ID: 374, P-Value: 7.61e-02
Nearest Neighbor ID: 30
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
n | for column in range(3): | n | for col in range(3): |
| if boardList[column] == boardList[column + 3] == boardList[column + 6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[column] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
n | elif boardList[column] == 2: | n | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
n | pass | n | |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList=[] | n | boardList = [] |
| nRemainder=nBoard | | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | testing = decodeBoard(1607) | n | |
| print(testing) | | |
| print(findWinner(testing)) | | |
| passdef countBases(seq): | | passdef countBases(seq): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | cg_percentage = 0 | n | |
| for i in range(len(seq)): | | for n in range(len(seq)): |
| if seq[i] == 'A': | | if seq[n] == 'A': |
| A += 1 | | A += 1 |
n | elif seq[i] == 'C': | n | elif seq[n] == 'C': |
| C += 1 | | C += 1 |
n | elif seq[i] == 'G': | n | elif seq[n] == 'G': |
| G += 1 | | G += 1 |
n | elif seq[i] == 'T': | n | elif seq[n] == 'T': |
| T += 1 | | T += 1 |
n | cg_percentage = (C + G)/(A+C+G+T) * 100 | n | cg_percentage = (C + G) / len(seq) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | dif_sym = 0 | n | diff = 0 |
| if len(seq_a) == len(seq_b): | | if len(seq_a) == len(seq_b): |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
n | dif_sym += 1 | n | diff += 1 |
| else: | | return diff |
| continue | | |
| else: | | else: |
| return 'Error: Sequences Length Mismatch' | | return 'Error: Sequences Length Mismatch' |
t | return dif_sym | t | |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 49
Student ID: 323, P-Value: 7.61e-02
Nearest Neighbor ID: 273
Student (left) and Nearest Neighbor (right).
n | import math | n | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[2:9:3 | n | if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[1:8:3 |
| ]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardList[3:6:1]==[1,1,1] or boardLis | | ]==[1,1,1] or boardList[2:9:3]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardLis |
| t[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or boardList[2:7:2]==[1,1,1]: | | t[3:6:1]==[1,1,1] or boardList[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or b |
| | | oardList[2:7:2]==[1,1,1]: |
| return 'X' | | return 'X' |
| elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[2:9 | | elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[1:8 |
| :3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardList[3:6:1]==[2,2,2] or boardL | | :3]==[2,2,2] or boardList[2:9:3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardL |
| ist[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or boardList[2:7:2]==[2,2,2]: | | ist[3:6:1]==[2,2,2] or boardList[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or |
| | | boardList[2:7:2]==[2,2,2]: |
| return 'O' | | return 'O' |
n | else: | n | else: |
| return '-' | | return '-' |
n | pass | n | |
| pass | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
n | nRemainder=nBoard | n | nRemainder=int(nBoard) |
| for digit in range(8,-1,-1): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for s in range(0,len(seq)): | n | for n in range(0,len(seq)): |
| if seq[s] == 'A': | | if seq[n]=='A': |
| A+=1 | | A = A+1 |
| elif seq[s] == 'C': | | elif seq[n]=='C': |
| C+=1 | | C = C+1 |
| elif seq[s] == 'G': | | elif seq[n]=='G': |
| G+=1 | | G = G+1 |
| elif seq[s] == 'T': | | elif seq[n]=='T': |
| T+=1 | | T = T+1 |
| else: | | |
| pass | | |
| cg_percentage = (100*(C+G))/(len(seq)) | | cg_percentage = 100*((C+G)/(len(seq))) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | if len(seq_a) == len(seq_b): | n | if len(seq_a)==len(seq_b): |
| count = -1 | | count = -1 |
| for i in range (0,len(seq_a)): | | for i in range(0,len(seq_a)): |
| if seq_a[i] == seq_b[i]: | | if seq_a[i]==seq_b[i]: |
| count += 1 | | count = count+1 |
| return count | | return count |
| else: | | |
| return 'Error: Sequences Length Mismatch' | | |
| if __name__=="__main__": | | |
| basecount=countBases(seq_a,seq_b) | | |
| else: | | else: |
t | | t | return 'Error: Sequences Length Mismatch' |
| | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 50
Student ID: 172, P-Value: 7.71e-02
Nearest Neighbor ID: 30
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | for row in range(3) : | n | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
n | return '0' | n | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList = [] | | boardList = [] |
n | nRemainder = nBoard | n | nRemainder = nBoard |
| for digit in range(8, -1, -1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
n | | n | if __name__=="__main__": |
| def countBases(seq): | | passdef countBases(seq): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for i in seq : | n | for n in range(len(seq)): |
| if i == 'A': | | if seq[n] == 'A': |
| A += 1 | | A += 1 |
n | elif i == 'C': | n | elif seq[n] == 'C': |
| C += 1 | | C += 1 |
n | elif i == 'G': | n | elif seq[n] == 'G': |
| G += 1 | | G += 1 |
n | else: | n | elif seq[n] == 'T': |
| T += 1 | | T += 1 |
n | cg_percentage = ((C + G) / (len(seq))) * 100 | n | cg_percentage = (C + G) / len(seq) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | | n | diff = 0 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) == len(seq_b): |
| | | for i in range(len(seq_a)): |
| | | if seq_a[i] != seq_b[i]: |
| | | diff += 1 |
| | | return diff |
| | | else: |
| return 'Error: Sequences Length Mismatch' | | return 'Error: Sequences Length Mismatch' |
n | distance = 0 | n | |
| L = len(seq_a) | | |
| for i in range(L): | | |
| if seq_a[i] != seq_b[i]: | | |
| distance += 1 | | |
| return distance | | |
| if __name__=="__main__": | | if __name__=="__main__": |
t | print(hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT')) | t | |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 51
Student ID: 287, P-Value: 7.93e-02
Nearest Neighbor ID: 398
Student (left) and Nearest Neighbor (right).
n | import math | n | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == boardList[1] == boardList[2] == 1: | | if boardList[0] == boardList[1] == boardList[2] == 1: |
n | return ('X') | n | return 'X' |
| elif boardList[0] == boardList[1] == boardList[2] == 2: | | |
| return ('O') | | |
| elif boardList[3] == boardList[4] == boardList[5] == 1: | | elif boardList[3] == boardList[4] == boardList[5] == 1: |
n | return ('X') | n | return 'X' |
| | | elif boardList[6] == boardList[7] == boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[0] == boardList[3] == boardList[6] == 1: |
| | | return 'X' |
| | | elif boardList[1] == boardList[4] == boardList[7] == 1: |
| | | return 'X' |
| | | elif boardList[2] == boardList[5] == boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[0] == boardList[4] == boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[2] == boardList[4] == boardList[6] == 1: |
| | | return 'X' |
| | | if boardList[0] == boardList[1] == boardList[2] == 2: |
| | | return 'O' |
| elif boardList[3] == boardList[4] == boardList[5] == 2: | | elif boardList[3] == boardList[4] == boardList[5] == 2: |
n | return ('O') | n | return 'O' |
| elif boardList[6] == boardList[7] == boardList[8] == 1: | | |
| return ('X') | | |
| elif boardList[6] == boardList[7] == boardList[8] == 2: | | elif boardList[6] == boardList[7] == boardList[8] == 2: |
n | return ('O') | n | return 'O' |
| elif boardList[0] == boardList[3] == boardList[6] == 1: | | |
| return ('X') | | |
| elif boardList[0] == boardList[3] == boardList[6] == 2: | | elif boardList[0] == boardList[3] == boardList[6] == 2: |
n | return ('O') | n | return 'O' |
| elif boardList[1] == boardList[4] == boardList[7] == 1: | | |
| return ('X') | | |
| elif boardList[1] == boardList[4] == boardList[7] == 2: | | elif boardList[1] == boardList[4] == boardList[7] == 2: |
n | return ('O') | n | return 'O' |
| elif boardList[2] == boardList[5] == boardList[8] == 1: | | |
| return ('X') | | |
| elif boardList[2] == boardList[5] == boardList[8] == 2: | | elif boardList[2] == boardList[5] == boardList[8] == 2: |
n | return ('O') | n | return 'O' |
| elif boardList[0] == boardList[4] == boardList[8] == 1: | | |
| return ('X') | | |
| elif boardList[0] == boardList[4] == boardList[8] == 2: | | elif boardList[0] == boardList[4] == boardList[8] == 2: |
n | return ('O') | n | return 'O' |
| elif boardList[2] == boardList[4] == boardList[6] == 1: | | |
| return ('X') | | |
| elif boardList[2] == boardList[4] == boardList[6] == 2: | | elif boardList[2] == boardList[4] == boardList[6] == 2: |
n | return ('O') | n | return 'O' |
| else: | | else: |
n | return ('-') | n | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
n | nRemainder=nBoard | n | nRemainder=nBoard |
| for digit in reversed(range(0,8+1)): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | print() | n | print(findWinner) |
| passdef countBases(seq): | | passdef countBases(seq): |
| A = seq.count('A') | | A = seq.count('A') |
| C = seq.count('C') | | C = seq.count('C') |
| G = seq.count('G') | | G = seq.count('G') |
| T = seq.count('T') | | T = seq.count('T') |
n | cg_percentage = float(((C + G) / len(seq))*100) | n | cg_percentage = ((C + G) / len(seq)) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | if len(seq_a) != len(seq_b): | n | if len(seq_b) != len(seq_a): |
| return("Error: Sequences Length Mismatch") | | return("Error: Sequences Length Mismatch") |
t | if len(seq_a) == len(seq_b): | t | else: |
| difference = 0 | | return sum(seq_a[i] != seq_b[i] for i in range(len(seq_a))) |
| for i in range(len(seq_a)): | | if __name__=="__main__": |
| if seq_a[i] != seq_b[i]: | | print(countBases) |
| difference += 1 | | pass |
| return difference | | |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 52
Student ID: 398, P-Value: 7.93e-02
Nearest Neighbor ID: 287
Student (left) and Nearest Neighbor (right).
n | import math | n | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| if boardList[0] == boardList[1] == boardList[2] == 1: | | if boardList[0] == boardList[1] == boardList[2] == 1: |
n | return 'X' | n | return ('X') |
| | | elif boardList[0] == boardList[1] == boardList[2] == 2: |
| | | return ('O') |
| elif boardList[3] == boardList[4] == boardList[5] == 1: | | elif boardList[3] == boardList[4] == boardList[5] == 1: |
n | return 'X' | n | return ('X') |
| | | elif boardList[3] == boardList[4] == boardList[5] == 2: |
| | | return ('O') |
| elif boardList[6] == boardList[7] == boardList[8] == 1: | | elif boardList[6] == boardList[7] == boardList[8] == 1: |
n | return 'X' | n | return ('X') |
| | | elif boardList[6] == boardList[7] == boardList[8] == 2: |
| | | return ('O') |
| elif boardList[0] == boardList[3] == boardList[6] == 1: | | elif boardList[0] == boardList[3] == boardList[6] == 1: |
n | return 'X' | n | return ('X') |
| | | elif boardList[0] == boardList[3] == boardList[6] == 2: |
| | | return ('O') |
| elif boardList[1] == boardList[4] == boardList[7] == 1: | | elif boardList[1] == boardList[4] == boardList[7] == 1: |
n | return 'X' | n | return ('X') |
| | | elif boardList[1] == boardList[4] == boardList[7] == 2: |
| | | return ('O') |
| elif boardList[2] == boardList[5] == boardList[8] == 1: | | elif boardList[2] == boardList[5] == boardList[8] == 1: |
n | return 'X' | n | return ('X') |
| | | elif boardList[2] == boardList[5] == boardList[8] == 2: |
| | | return ('O') |
| elif boardList[0] == boardList[4] == boardList[8] == 1: | | elif boardList[0] == boardList[4] == boardList[8] == 1: |
n | return 'X' | n | return ('X') |
| | | elif boardList[0] == boardList[4] == boardList[8] == 2: |
| | | return ('O') |
| elif boardList[2] == boardList[4] == boardList[6] == 1: | | elif boardList[2] == boardList[4] == boardList[6] == 1: |
n | return 'X' | n | return ('X') |
| if boardList[0] == boardList[1] == boardList[2] == 2: | | |
| return 'O' | | |
| elif boardList[3] == boardList[4] == boardList[5] == 2: | | |
| return 'O' | | |
| elif boardList[6] == boardList[7] == boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[0] == boardList[3] == boardList[6] == 2: | | |
| return 'O' | | |
| elif boardList[1] == boardList[4] == boardList[7] == 2: | | |
| return 'O' | | |
| elif boardList[2] == boardList[5] == boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[0] == boardList[4] == boardList[8] == 2: | | |
| return 'O' | | |
| elif boardList[2] == boardList[4] == boardList[6] == 2: | | elif boardList[2] == boardList[4] == boardList[6] == 2: |
n | return 'O' | n | return ('O') |
| else: | | else: |
n | return '-' | n | return ('-') |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
n | nRemainder=nBoard | n | nRemainder=nBoard |
| for digit in range(8,-1,-1): | | for digit in reversed(range(0,8+1)): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | print(findWinner) | n | print() |
| passdef countBases(seq): | | passdef countBases(seq): |
| A = seq.count('A') | | A = seq.count('A') |
| C = seq.count('C') | | C = seq.count('C') |
| G = seq.count('G') | | G = seq.count('G') |
| T = seq.count('T') | | T = seq.count('T') |
n | cg_percentage = ((C + G) / len(seq)) * 100 | n | cg_percentage = float(((C + G) / len(seq))*100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | if len(seq_b) != len(seq_a): | n | if len(seq_a) != len(seq_b): |
| return("Error: Sequences Length Mismatch") | | return("Error: Sequences Length Mismatch") |
t | else: | t | if len(seq_a) == len(seq_b): |
| return sum(seq_a[i] != seq_b[i] for i in range(len(seq_a))) | | difference = 0 |
| if __name__=="__main__": | | for i in range(len(seq_a)): |
| print(countBases) | | if seq_a[i] != seq_b[i]: |
| pass | | difference += 1 |
| | | return difference |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 53
Student ID: 145, P-Value: 8.85e-02
Nearest Neighbor ID: 459
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | if boardList[0] == boardList[1] and boardList[1] == boardList[2]: | n | if boardList[0] == boardList[1] == boardList[2]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
n | return '0' | n | return 'O' |
| if boardList[3] == boardList[4] and boardList[4] == boardList[5]: | | elif boardList[3] == boardList[4] == boardList[5]: |
| if boardList[3] == 1: | | if boardList[3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[3] == 2: | | elif boardList[3] == 2: |
| return 'O' | | return 'O' |
n | if boardList[6] == boardList[7] and boardList[7] == boardList[8]: | n | elif boardList[6] == boardList[7] == boardList[8]: |
| if boardList[6] == 1: | | if boardList[6] == 1: |
| return 'X' | | return 'X' |
| elif boardList[6] == 2: | | elif boardList[6] == 2: |
| return 'O' | | return 'O' |
n | if boardList[0] == boardList[3] and boardList[3] == boardList[6]: | n | elif boardList[0] == boardList[3] == boardList[6]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
n | if boardList[1] == boardList[4] and boardList[4] == boardList[7]: | n | elif boardList[1] == boardList[4] == boardList[7]: |
| if boardList[1] == 1: | | if boardList[1] == 1: |
| return 'X' | | return 'X' |
| elif boardList[1] == 2: | | elif boardList[1] == 2: |
| return 'O' | | return 'O' |
n | if boardList[2] == boardList[5] and boardList[5] == boardList[8]: | n | elif boardList[2] == boardList[5] == boardList[8]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
n | if boardList[0] == boardList[4] and boardList[4] == boardList[8]: | n | elif boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
n | if boardList[2] == boardList[4] and boardList[4] == boardList[6]: | n | elif boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| else: | | else: |
n | return("-") | n | return '-' |
| pass | | |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
n | nRemainder = nBoard | n | nRemainder=nBoard |
| for digit in range(8,-1,-1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
n | | n | a = int(input()) |
| | | b = decodeBoard(a) |
| | | findWinner(b) |
| passdef countBases(seq): | | def countBases(seq): |
| A = seq.count('A') | | A = seq.count('A') |
| C = seq.count('C') | | C = seq.count('C') |
| G = seq.count('G') | | G = seq.count('G') |
| T = seq.count('T') | | T = seq.count('T') |
n | cg_percentage = ((C + G)/len(seq)) * 100 | n | cg_percentage = (C + G) / (A+C+G+T) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | | n | diff_char = 0 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
| return 'Error: Sequences Length Mismatch' | | return 'Error: Sequences Length Mismatch' |
n | char_count = 0 | n | else: |
| if len(seq_a) == len(seq_b): | | |
| char_count = 0 | | |
| length = len(seq_a) | | |
| for char in range(length): | | for i in range(len(seq_a)): |
| if seq_a[char] != seq_b[char]: | | if seq_a[i] != seq_b[i]: |
| char_count += 1 | | diff_char += 1 |
| return (char_count) | | return diff_char |
| print(char_count) | | |
| if __name__=="__main__": | | if __name__=="__main__": |
t | pass | t | |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 54
Student ID: 192, P-Value: 9.45e-02
Nearest Neighbor ID: 37
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
| for row in range(3): | | for row in range(3): |
| if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: | | if boardList[row*3] == boardList[row*3+1] == boardList[row*3+2]: |
| if boardList[row*3] == 1: | | if boardList[row*3] == 1: |
| return 'X' | | return 'X' |
| elif boardList[row*3] == 2: | | elif boardList[row*3] == 2: |
| return 'O' | | return 'O' |
| for col in range(3): | | for col in range(3): |
| if boardList[col] == boardList[col+3] == boardList[col+6]: | | if boardList[col] == boardList[col+3] == boardList[col+6]: |
| if boardList[col] == 1: | | if boardList[col] == 1: |
| return 'X' | | return 'X' |
| elif boardList[col] == 2: | | elif boardList[col] == 2: |
| return 'O' | | return 'O' |
| if boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| if boardList[0] == 1: | | if boardList[0] == 1: |
| return 'X' | | return 'X' |
| elif boardList[0] == 2: | | elif boardList[0] == 2: |
| return 'O' | | return 'O' |
| if boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| if boardList[2] == 1: | | if boardList[2] == 1: |
| return 'X' | | return 'X' |
| elif boardList[2] == 2: | | elif boardList[2] == 2: |
| return 'O' | | return 'O' |
| return '-' | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList=[] | n | boardList = [] |
| nRemainder=nBoard | | nRemainder = nBoard |
| for digit in range(8,-1,-1): | | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder = nRemainder - ( x * (3**digit) ) | n | nRemainder = nRemainder - (x * (3**digit)) |
| boardList.append(x) | | boardList.append(x) |
| return boardList | | return boardListdef countBases(seq): |
| def countBases(seq): | | |
| numA = seq.count('A') | | A = str(seq).count('A') |
| numC = seq.count('C') | | |
| numG = seq.count('G') | | |
| numT = seq.count('T') | | T = str(seq).count('T') |
| cg_percentage = (numC + numG)/(numA + numC + numG + numT)*100 | | C = str(seq).count('C') |
| | | G = str(seq).count('G') |
| | | cg_percentage = ((C / len(str(seq)))*100) + ((G / len(str(seq)))*100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(numA, numC, numG, numT, cg_perc | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| entage) | | |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | | n | s= seq_a |
| | | t= seq_b |
| | | count=0 |
| | | for i in range(len(s)): |
| | | if s[i]!= t[i]: |
| | | count+=1 |
| if len(seq_a) != len(seq_b): | | if len(seq_a) != len(seq_b): |
| return "Error: Sequences Length Mismatch" | | return "Error: Sequences Length Mismatch" |
| else: | | else: |
t | seq_a = set(seq_a) | t | return count |
| seq_b = set(seq_b) | | |
| diff = seq_a.symmetric_difference(seq_b) | | |
| len_diff = seq_a.difference(seq_b) | | |
| return len(len_diff)+7 | | |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 55
Student ID: 159, P-Value: 9.70e-02
Nearest Neighbor ID: 467
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | x = '' | n | |
| if boardList[0] == boardList[1] == boardList[2]: | | if boardList[0] == boardList[1] == boardList[2]: |
n | x = boardList[0] | n | if boardList[0] == 1: |
| | | return 'X' |
| | | if boardList[0] == 2: |
| | | return 'O' |
| elif boardList[3] == boardList[4] == boardList[5]: | | if boardList[3] == boardList[4] == boardList[5]: |
| x = boardList[3] | | if boardList[3] == 1: |
| | | return 'X' |
| | | if boardList[3] == 2: |
| | | return 'O' |
| elif boardList[6] == boardList[7] == boardList[8]: | | if boardList[6] == boardList[7] == boardList[8]: |
| x = boardList[6] | | if boardList[6] == 1: |
| | | return 'X' |
| | | if boardList[6] == 2: |
| | | return 'O' |
| elif boardList[0] == boardList[3] == boardList[6]: | | if boardList[0] == boardList[3] == boardList[6]: |
| x = boardList[0] | | if boardList[0] == 1: |
| | | return 'X' |
| | | if boardList[0] == 2: |
| | | return 'O' |
| elif boardList[1] == boardList[4] == boardList[7]: | | if boardList[1] == boardList[4] == boardList[7]: |
| x = boardList[1] | | if boardList[1] == 1: |
| | | return 'X' |
| | | if boardList[1] == 2: |
| | | return 'O' |
| elif boardList[2] == boardList[5] == boardList[8]: | | if boardList[2] == boardList[5] == boardList[8]: |
| x = boardList[2] | | if boardList[2] == 1: |
| | | return 'X' |
| | | if boardList[2] == 2: |
| | | return 'O' |
| elif boardList[0] == boardList[4] == boardList[8]: | | if boardList[0] == boardList[4] == boardList[8]: |
| x = boardList[0] | | if boardList[0] == 1: |
| | | return 'X' |
| | | if boardList[0] == 2: |
| | | return 'O' |
| elif boardList[2] == boardList[4] == boardList[6]: | | if boardList[2] == boardList[4] == boardList[6]: |
| x = boardList[2] | | if boardList[2] == 1: |
| else: | | return 'X' |
| x = '-' | | if boardList[2] == 2: |
| if x == 0: | | return 'O' |
| x = '-' | | |
| elif x == 1: | | |
| x = 'X' | | |
| elif x == 2: | | |
| x = 'O' | | |
| return x | | return '-' |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
n | for digit in range(8,-1,-1): | n | for digit in range(8, -1, -1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
| A = 0 | | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
| T = 0 | | T = 0 |
n | for i in seq: | n | cg_percentage = 0.0 |
| | | for i in range(0, len(seq)): |
| if i == 'A': | | if seq[i] == 'A': |
| A += 1 | | A += 1 |
n | elif i == 'C': | n | if seq[i] == 'C': |
| C += 1 | | C += 1 |
n | elif i == 'G': | n | if seq[i] == 'G': |
| G += 1 | | G += 1 |
| elif i == 'T': | | if seq[i] == 'T': |
| T += 1 | | T += 1 |
| cg_percentage = ((C + G)/len(seq))*100 | | cg_percentage = ((C + G) / len(seq)) * 100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | x = 0 | n | count = 0 |
| if len(seq_a) == len(seq_b): | | if len(seq_a) != len(seq_b): |
| | | return "Error: Sequences Length Mismatch" |
| | | else: |
| for i in range(len(seq_a)): | | for i in range(0, len(seq_a)): |
| if seq_a[i] != seq_b[i]: | | if seq_a[i] != seq_b[i]: |
n | x += 1 | n | count += 1 |
| else: | | |
| x = "Error: Sequences Length Mismatch" | | |
| return x | | return count |
| if __name__=="__main__": | | if __name__=="__main__": |
t | seq = input() | t | |
| seq_a = input() | | |
| seq_b = input() | | |
| print(countBases(seq)) | | |
| print(hammingdistance(seq_a, seq_b)) | | |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 56
Student ID: 405, P-Value: 9.82e-02
Nearest Neighbor ID: 63
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | | n | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: |
| | | return 'X' |
| | | elif boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: |
| | | return 'X' |
| | | elif boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: |
| | | return 'O' |
| | | elif boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: |
| | | return 'O' |
| | | elif boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: |
| | | return 'O' |
| if boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: | | if boardList[0] == 1 and boardList[3] == 1 and boardList[6] == 1: |
n | return 'X' | n | |
| if boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: | | |
| return 'X' | | |
| if boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: | | |
| return 'X' | | return 'X' |
n | if boardList[0] == 1 and boardList[1] == 1 and boardList[2] == 1: | n | |
| return 'X' | | |
| if boardList[3] == 1 and boardList[4] == 1 and boardList[5] == 1: | | elif boardList[1] == 1 and boardList[4] == 1 and boardList[7] == 1: |
| return 'X' | | |
| if boardList[6] == 1 and boardList[7] == 1 and boardList[8] == 1: | | |
| return 'X' | | |
| if boardList[6] == 1 and boardList[4] == 1 and boardList[2] == 1: | | |
| return 'X' | | return 'X' |
n | | n | elif boardList[2] == 1 and boardList[5] == 1 and boardList[8] == 1: |
| | | return 'X' |
| | | elif boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: |
| | | return 'O' |
| | | elif boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: |
| | | return 'O' |
| | | elif boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: |
| | | return 'O' |
| if boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: | | if boardList[0] == 1 and boardList[4] == 1 and boardList[8] == 1: |
n | return 'X' | n | return 'X' |
| | | elif boardList[2] == 1 and boardList[4] == 1 and boardList[6] == 1: |
| | | return 'X' |
| if boardList[0] == 2 and boardList[3] == 2 and boardList[6] == 2: | | elif boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: |
| return 'O' | | return 'O' |
n | if boardList[1] == 2 and boardList[4] == 2 and boardList[7] == 2: | n | elif boardList[2] == 2 and boardList[4] == 2 and boardList[6] == 2: |
| return 'O' | | |
| if boardList[2] == 2 and boardList[5] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| if boardList[0] == 2 and boardList[1] == 2 and boardList[2] == 2: | | |
| return 'O' | | return 'O' |
n | if boardList[3] == 2 and boardList[4] == 2 and boardList[5] == 2: | n | else: |
| return 'O' | | return'-' |
| if boardList[6] == 2 and boardList[7] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| if boardList[6] == 2 and boardList[4] == 2 and boardList[2] == 2: | | |
| return 'O' | | |
| if boardList[0] == 2 and boardList[4] == 2 and boardList[8] == 2: | | |
| return 'O' | | |
| return '-' | | |
| pass | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
| boardList=[] | | boardList=[] |
| nRemainder=nBoard | | nRemainder=nBoard |
n | for digit in range(8, -1, -1): | n | for digit in range(8, -1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | | n | boardList.append(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
n | A = C = G = T = 0 | n | A = 0 |
| for i in range(0,len(seq)): | | C = 0 |
| | | G = 0 |
| | | T = 0 |
| | | for x in seq: |
| if seq[i] == 'A': | | if x == 'A': |
| A += 1 | | A += 1 |
| elif seq[i] == 'C': | | elif x == 'C': |
| C += 1 | | C += 1 |
| elif seq[i] == 'G': | | elif x == 'G': |
| G += 1 | | G += 1 |
| elif seq[i] == 'T': | | elif x == 'T': |
| T += 1 | | T += 1 |
| cg_percentage = ((C + G)/(A + C + G + T))*100 | | else: |
| | | continue |
| | | cg_percentage = (((C + G) / (len(seq))) * 100) |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
t | def hammingdistance(s, t): | t | def hammingdistance(seq_a, seq_b): |
| if len(s) != len(t): | | if len(seq_a) != len(seq_b): |
| return('Error: Sequences Length Mismatch') | | return "Error: Sequences Length Mismatch" |
| | | else: |
| diff = 0 | | diff = 0 |
| for i in range(0, len(s)): | | for i in range(0, len(seq_a)): |
| if s[i] != t[i]: | | if seq_a[i] != seq_b[i]: |
| diff += 1 | | diff += 1 |
| return diff | | return diff |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 57
Student ID: 174, P-Value: 9.95e-02
Nearest Neighbor ID: 273
Student (left) and Nearest Neighbor (right).
n | import math | n | import math |
| def findWinner(boardList): | | def findWinner(boardList): |
n | if boardList[0:3:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or boardList[0:8:3 | n | if boardList[0:8:3]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[1:8:3 |
| ]==[1,1,1] or boardList[1:8:3]==[1,1,1] or boardList[2:7:2]==[1,1,1] or boardLis | | ]==[1,1,1] or boardList[2:9:3]==[1,1,1] or boardList[0:3:1]==[1,1,1] or boardLis |
| t[2:9:3]==[1,1,1] or boardList[3:6:1]==[1,1,1] or boardList[6:9:1]==[1,1,1]: | | t[3:6:1]==[1,1,1] or boardList[6:9:1]==[1,1,1] or boardList[0:9:4]==[1,1,1] or b |
| | | oardList[2:7:2]==[1,1,1]: |
| return ('X') | | return 'X' |
| elif boardList[0:3:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or boardList[0:8 | | elif boardList[0:8:3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[1:8 |
| :3]==[2,2,2] or boardList[1:8:3]==[2,2,2] or boardList[2:7:2]==[2,2,2] or boardL | | :3]==[2,2,2] or boardList[2:9:3]==[2,2,2] or boardList[0:3:1]==[2,2,2] or boardL |
| ist[2:9:3]==[2,2,2] or boardList[3:6:1]==[2,2,2] or boardList[6:9:1]==[2,2,2]: | | ist[3:6:1]==[2,2,2] or boardList[6:9:1]==[2,2,2] or boardList[0:9:4]==[2,2,2] or |
| | | boardList[2:7:2]==[2,2,2]: |
| return ('O') | | return 'O' |
| else: | | else: |
| return ('-') | | return '-' |
| pass | | pass |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList=[] | n | boardList=[] |
| nRemainder=nBoard | | nRemainder=int(nBoard) |
| for digit in range(8,-1,-1): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3**digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
| nRemainder = nRemainder - ( x * (3**digit) ) | | nRemainder = nRemainder - ( x * (3**digit) ) |
n | boardList.append(x) | n | boardList.append(x) |
| return boardList | | return boardList |
| if __name__=="__main__": | | if __name__=="__main__": |
| passdef countBases(seq): | | passdef countBases(seq): |
n | A = 0 | n | A = 0 |
| C = 0 | | C = 0 |
| G = 0 | | G = 0 |
n | T = 0 | n | T = 0 |
| for i in range(0,len(seq)): | | for n in range(0,len(seq)): |
| if seq[i] == 'A': | | if seq[n]=='A': |
| A+=1 | | A = A+1 |
| if seq[i] == 'C': | | elif seq[n]=='C': |
| C+=1 | | C = C+1 |
| if seq[i] == 'G': | | elif seq[n]=='G': |
| G+=1 | | G = G+1 |
| if seq[i] == 'T': | | elif seq[n]=='T': |
| T+=1 | | T = T+1 |
| cg_percentage = ((C+G)/len(seq))*100 | | cg_percentage = 100*((C+G)/(len(seq))) |
| return '{:d} {:d} {:d} {:d}\n{:3.1f}'.format(A, C, G, T, cg_percentage) | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
t | if len(seq_a) == len(seq_b): | t | if len(seq_a)==len(seq_b): |
| diff = 0 | | count = -1 |
| for i in len(seq_a): | | for i in range(0,len(seq_a)): |
| if i not in len(seq_b): | | if seq_a[i]==seq_b[i]: |
| diff+=1 | | count = count+1 |
| return diff | | return count |
| for i in len(seq_b): | | else: |
| if i not in len(seq_a): | | |
| diff+=1 | | |
| return diff | | |
| if len(seq_a) != len(seq_b): | | |
| return ('Error: Sequences Length Mismatch') | | return 'Error: Sequences Length Mismatch' |
| if __name__=="__main__": | | if __name__=="__main__": |
| pass | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 58
Student ID: 311, P-Value: 9.93e-01
Nearest Neighbor ID: 253
Student (left) and Nearest Neighbor (right).
f | import math | f | import math |
n | import array as arr | n | from math import floor |
| import numpy as np | | |
| def checkRows(board): | | |
| for row in board: | | |
| if len(set(row)) == 1: | | |
| return row[0] | | |
| return 0 | | |
| def checkDiagonals(board): | | |
| if len(set([board[i][i] for i in range(len(board))])) == 1: | | |
| return board[0][0] | | |
| if len(set([board[i][len(board) - i - 1] for i in range(len(board))])) == 1: | | |
| return board[0][len(board) - 1] | | |
| return 0 | | |
| def findWinner(board): | | def findWinner(boardList): |
| for newBoard in [board, np.transpose(board)]: | | win = [ |
| result = checkRows(newBoard) | | [0, 1, 2], |
| if result: | | [3, 4, 5], |
| return result | | [6, 7, 8], |
| return checkDiagonals(board) | | [0, 3, 6], |
| | | [1, 4, 7], |
| | | [2, 5, 8], |
| | | [0, 4, 8], |
| | | [2, 4, 6], |
| | | ] |
| | | winner = '-' |
| | | for sub_list in win: |
| | | if (boardList[sub_list[0]] == 1) and (boardList[sub_list[1]] == 1) and ( |
| | | boardList[sub_list[2]] == 1): |
| | | winner = 'X' |
| | | break |
| | | if (boardList[sub_list[0]] == 2) and (boardList[sub_list[1]] == 2) and ( |
| | | boardList[sub_list[2]] == 2): |
| | | winner = 'O' |
| | | break |
| | | return winner |
| def decodeBoard(nBoard): | | def decodeBoard(nBoard): |
n | boardList = arr.array('i', [0, 0, 0, 0, 0, 0, 0, 0, 0]) | n | boardList=[] |
| startIndex = 8 | | |
| stopIndex = 0 | | |
| step = -1 | | |
| nRemainder = nBoard | | nRemainder=nBoard |
| for digit in range(startIndex, stopIndex, step): | | for digit in range(8,-1,-1): |
| x = nRemainder / (3 ** digit) | | x = nRemainder / (3**digit) |
| x = math.floor(x) | | x = math.floor(x) |
n | nRemainder -= (x * (3 ** digit)) | n | nRemainder = nRemainder - ( x * (3**digit) ) |
| boardList[digit] = x | | boardList.append(x) |
| return boardList | | return boardList |
n | if __name__ == "__main__": | n | |
| testArray = [] | | |
| nBoard = 1815 | | |
| testArray = decodeBoard(nBoard) | | |
| testArray = np.array(testArray) | | |
| print(testArray.reshape((3, 3))) | | |
| testArray2 = [['-', 'O', '-'], | | |
| ['X', 'X', 'X'], | | |
| ['O', '-', '-']] | | |
| print('Winner is ', findWinner(testArray2)) | | |
| pass | | |
| def countBases(s): | | |
| number2 = s.count('C') + s.count('G') / s.count('A') + s.count('C') + s.coun | | |
| t('G') + s.count('T') | | |
| number = '{:d},{:d},{:d},{:d}\n{:.1f}'.format(s.count('A'), s.count('C'), s. | | |
| count('G'), s.count('T'),number2) | | |
| return number | | |
| def hammingdistance(s1, s2): | | |
| if len(s1) != len(s2): | | |
| raise ValueError("Sequence Length Mismatch") | | |
| return sum(ch1 != ch2 for ch1,ch2 in zip(s1,s2)) | | |
| if __name__=="__main__": | | if __name__=="__main__": |
n | basecount=countBases('ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGAACGGTAAATAAA') | n | board = decodeBoard(2291) |
| print(basecount) | | winner = findWinner(board) |
| print(hammingdistance('GATATCGTCTGGGACCT','CATCGCATTTACGGCCT')) | | print(winner) |
| | | passfrom itertools import count |
| | | def countBases(seq): |
| | | A = 0 |
| | | C = 0 |
| | | G = 0 |
| | | T = 0 |
| | | seq_list = [char for char in seq] |
| | | for item in seq_list: |
| | | if item == 'A': A += 1 |
| | | if item == 'C': C += 1 |
| | | if item == 'G': G += 1 |
| | | if item == 'T': T += 1 |
| | | sum_CG = C + G |
| | | cg_percentage = sum_CG / len(seq_list) * 100 |
| | | return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) |
| | | def hammingdistance(seq_a, seq_b): |
| | | a_list = [char for char in seq_a] |
| | | b_list = [char for char in seq_b] |
| | | hamming_sum = 0 |
| | | if len(a_list) == len(b_list): |
| | | for a, b in zip(a_list, b_list): |
| | | if a == b: hamming_sum += 1 |
| | | else: continue |
| | | return hamming_sum - 1 |
| | | else: return('Error: Sequences Length Mismatch') |
| pass | | pass |
t | | t | if __name__=="__main__": |
| | | baseCount = countBases('ATTTTAAGGAGTTTAAAATGGATAAGAAGCAAGTAACGGATTTAAGGTCGGA |
| | | ACTACTCGATTCACGTTT') |
| | | print(baseCount) |
| | | hamming_count = hammingdistance('GATATCGTCTGGGACCT', 'CATCGCATTTACGGCCT') |
| | | print(hamming_count) |
| | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|
Page 59
Student ID: 226, P-Value: 9.91e-01
Nearest Neighbor ID: 464
Student (left) and Nearest Neighbor (right).
n | def ternary (n): | n | import math |
| if n == 0: | | def findWinner(boardList): |
| | | if boardList[0]==1 and boardList[1]==1 and boardList[2]==1: |
| return '0' | | return'X' |
| nums = [] | | elif boardList[3]==1 and boardList[4]==1 and boardList[5]==1: |
| while n: | | |
| n, r = divmod(n, 3) | | |
| nums.append(str(r)) | | |
| kacy=int(''.join(reversed(nums))) | | |
| newlist= list(f'{kacy:09d}') | | |
| result =list(map(int,newlist)) | | |
| return result | | |
| def int2str(result): | | |
| for i in range(len(result)): | | |
| if result[i]==0: | | |
| result[i]='-' | | |
| elif result[i]==1: | | |
| result[i]='X' | | |
| elif result[i]==2: | | |
| result[i]='O' | | |
| return result | | |
| def checkwinner(y,z): | | |
| if (z[0]==y)and(z[1]==y)and(z[2]==y): | | |
| return True | | return'X' |
| elif (z[3]==y)and(z[4]==y)and(z[5]==y): | | elif boardList[6]==1 and boardList[7]==1 and boardList[8]==1: |
| return True | | return'X' |
| elif (z[6]==y)and(z[7]==y)and(z[8]==y): | | elif boardList[0]==1 and boardList[3]==1 and boardList[6]==1: |
| return True | | return'X' |
| elif (z[0]==y)and(z[3]==y)and(z[6]==y): | | elif boardList[1]==1 and boardList[4]==1 and boardList[7]==1: |
| return True | | return'X' |
| elif (z[1]==y)and(z[4]==y)and(z[7]==y): | | elif boardList[2]==1 and boardList[5]==1 and boardList[8]==1: |
| return True | | return'X' |
| elif (z[2]==y)and(z[5]==y)and(z[8]==y): | | elif boardList[0]==1 and boardList[4]==1 and boardList[4]==1: |
| return True | | return'X' |
| elif (z[0]==y)and(z[4]==y)and(z[8]==y): | | elif boardList[2]==1 and boardList[4]==1 and boardList[6]==1: |
| return True | | return'X' |
| elif (z[2]==y)and(z[4]==y)and(z[6]==y): | | |
| return True | | |
| else: | | else: |
n | return False | n | if boardList[0]==2 and boardList[1]==2 and boardList[2]==2: |
| a=ternary(int(input())) | | return'O' |
| print(int2str(a)) | | elif boardList[3]==2 and boardList[4]==2 and boardList[5]==2: |
| p='X' | | return'O' |
| q='O' | | elif boardList[6]==2 and boardList[7]==2 and boardList[8]==2: |
| if checkwinner(p,a): | | return'O' |
| final='X' | | elif boardList[0]==2 and boardList[3]==2 and boardList[6]==2: |
| elif checkwinner(q,a): | | return'O' |
| final='O' | | elif boardList[1]==2 and boardList[4]==2 and boardList[7]==2: |
| else: | | return'O' |
| final='-' | | elif boardList[2]==2 and boardList[5]==2 and boardList[8]==2: |
| print (final) | | return'O' |
| | | elif boardList[0]==2 and boardList[4]==2 and boardList[4]==2: |
| | | return'O' |
| | | elif boardList[2]==2 and boardList[4]==2 and boardList[6]==2: |
| | | return'O' |
| | | else: |
| | | return('-') |
| | | pass |
| | | def decodeBoard(nBoard): |
| | | boardList=[] |
| | | nRemainder=nBoard |
| | | for digit in range(0,8): |
| | | x = nRemainder / (3**digit) |
| | | x = math.floor(x) |
| | | nRemainder = nRemainder - ( x * (3**digit) ) |
| | | boardList.append(x) |
| | | return boardList |
| | | if __name__=="__main__": |
| | | nBoard = int(input()) |
| | | boardList = decodeBoard(nBoard) |
| | | print(findWinner(boardList)) |
| def countBases(seq): | | passdef countBases(seq): |
| A=0 | | A=0 |
| C=0 | | C=0 |
| G=0 | | G=0 |
| T=0 | | T=0 |
n | for i in seq: | n | for i in range(len(seq)): |
| if i=='A': | | if seq[i]=='A': |
| A+=1 | | A = A+1 |
| elif i=='C': | | elif seq[i]=='C': |
| C+=1 | | C = C+1 |
| elif i=='G': | | elif seq[i]=='G': |
| G+=1 | | G = G+1 |
| elif i=='T': | | else: |
| T+=1 | | T = T+1 |
| cg_percentage=float(((C+G)/(A+C+G+T))*100) | | totalcount=(A+C+G+T) |
| | | c_percent=C/totalcount |
| | | g_percent=G/totalcount |
| | | cg_percentage=(c_percent+g_percent)*100 |
| return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage) | | return ('{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)) |
| sequence=input() | | |
| result=countBases(sequence) | | |
| print (result) | | |
| def hammingdistance(seq_a, seq_b): | | def hammingdistance(seq_a, seq_b): |
n | | n | diff=0 |
| if len(seq_a)==len(seq_b): | | if len(seq_a)==len(seq_b): |
n | count=0 | n | |
| for i in range(len(seq_a)): | | for i in range(len(seq_a)): |
| if seq_a[i]!=seq_b[i]: | | if seq_a[i]!=seq_b[i]: |
n | count+=1 | n | diff+=1 |
| return count | | else: |
| | | diff+=0 |
| | | return(diff) |
| else: | | else: |
t | return'Error: Sequences Length Mismatch' | t | return('Error: Sequences Length Mismatch') |
| set1=input() | | if __name__=="__main__": |
| set2=input() | | slist=input() |
| result2=hammingdistance(set1,set2) | | seq=list(slist) |
| print(result2) | | s=input() |
| | | t=input() |
| | | seq_a=list(s) |
| | | seq_b=list(t) |
| | | print(countBases(seq)) |
| | | print(hammingdistance(seq_a,seq_b)) |
| | | pass |
Legends |
Colors |
Added |
Changed |
Deleted |
|
Links |
(f)irst change |
(n)ext change |
(t)op |
|