Question
Here is the first part of my code: import random def dnaMolecule(length): return ''.join(random.choice('GCAT') for x in range(length)) var = dnaMolecule(19) #choose length of GCAT
Here is the first part of my code:
import random
def dnaMolecule(length): return ''.join(random.choice('GCAT') for x in range(length))
var = dnaMolecule(19) #choose length of GCAT print ('The molecules are:', var) #prints dnaMolecule(x - 1) characters
gcount = var.count('G') #counts g and c content seperately ccount = var.count('C') gc = gcount + ccount
total = len(var)
gcContent = (gc / total) * 100 #divides the amount of gc by # of characters in string print('The concentration of GC is:',"%.2f" % gcContent, '%') #%.2f rounds to 2 decimal places
What is the proper way for me to take the reverse complement of my random string in this code?
Part 4 The reverse complement of a nucleotide sequence (an organic molecule important in biochemistry) is the result of complementing the nucleotides with their opposing nucleotides (in base pairs), then reversing the order of the nucleotides. The base pairs are shown below. Symbol Symbol Nucleotide guanine cytosine adenine thymine Complement cytosine uanine thymine adenine Table A1 -Nucleotide Base Pairs Write a function (reverseComplement), which takes a sequence of nucleotides (a string, encoded by the symbols in the table A1), complements each nucleotide symbol (with its complement from table A1) and then reverses the symbols. The return value for the function should be the reverse complemented sequence. Do not use the built in function reversed), or [::-1 in your solution. Some examples are given in table A2 The basic steps of the function are 1. Reverse the string 2. Replace the letters with their equivalents in A1 Complement AACTCGATAGCTGATC GCTTACCG GCCAGGTTATCTAAGCTT Sample Inputs and Outputs for Part 4 Reverse Complement CTAGTCGATAGCTCAA GCCATTCG TTCGAATCTATTGGACCG Input Sequence TTGAGCTATCGACTAG CGAATGGC CGGTCCAATAGATTCGAA Table A2 Sample Output for Part 4: >>reverseComplement( 'TTGAGCTATCGACTAG') CTAGTCGATAGCTCAA >>>reverseComplement 'CGAATGGC) GCCATTCG >>> reverseComplement( 'CGGTCCAATAGATTCGAA') TTCGAATCTATTGGACCGStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started