6.58 programming project 2: Manipulate DNA
Part A:
Given: A DNA string, s, where the alphabe...
Computers and Technology, 03.02.2022 14:00 parkermacyow71bm
6.58 programming project 2: Manipulate DNA
Part A:
Given: A DNA string, s, where the alphabet of DNA is from the set {'A','C','G','T'}
Return: Four integers (separated by spaces) counting the respective number of times that the symbols 'A', 'C', 'G', and 'T' occur in s. On the next line, a float with the CG% (which is the combined percentages of Cs and Gs in the string). The percentage is from 0 to 100 and NOT a fractional percentage.
Sample Input:
Sample Output: 25 8 16 21
34.3
Part B:
Given two strings s and t of equal length, the Hamming distance between s and t, denoted
, is the number of corresponding symbols that differ in s and t.
Given: Two DNA strings s and t of equal length .
Return: The Hamming distance $d_H(s, t)$.
1st Sample Input:
GATATCGTCTGGGACCT
CATCGCATTTACGGCCT
Sample Output:
8
2nd Sample Input:
GATATCGTCTGGGACCT
CCATCGCATTTACGGCCT
Sample Output:
Error: Sequences Length Mismatch
You need to write a function for each part.
The declarations for both functions are given in the template.
You may use more functions if you find that helpful for your implementation, but only these two will be explicitly checked.
def countBases(seq):
# return count of As, count of Cs, count of Gs, count of Ts, and Percentage of Cs and Gs combined (with 3 significant digits)
return '{:d} {:d} {:d} {:d}\n{:2.1f}'.format(A, C, G, T, cg_percentage)
def hammingdistance(seq_a, seq_b):
#return the number of differences between the two sequences
#If the sequences are not the same length, return "Error: Sequences Length Mismatch"
if __name__=="__main__":
# optional - add any test code here inside this block. we do this so that when the zyBooks tests includes
# your files to call your functions directly that the testing code in this block is not invoked
#basecount=countBases( )
pass
Answers: 1
Computers and Technology, 22.06.2019 20:00
The blank button automatically displays next to the data when you select a range of numeric data which is an available option for creating a chart
Answers: 3
Computers and Technology, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
Computers and Technology, 23.06.2019 15:00
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
Computers and Technology, 23.06.2019 16:50
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percΓ© tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
Mathematics, 27.05.2020 02:05
English, 27.05.2020 02:05
History, 27.05.2020 02:05
Social Studies, 27.05.2020 02:05
History, 27.05.2020 02:05
Mathematics, 27.05.2020 02:05
Mathematics, 27.05.2020 02:05
Mathematics, 27.05.2020 02:05
History, 27.05.2020 02:05
Mathematics, 27.05.2020 02:05
Mathematics, 27.05.2020 02:05
Spanish, 27.05.2020 02:05