Question: Don't use chatgpt please! #Lab 5 part 2 : Advanced Functions ( Convert scripts to functions. ) In this assignment, you will
Don't use chatgpt please!
#Lab part : Advanced Functions Convert scripts to functions.
In this assignment, you will go back to your working code from
previous assignments and converts your scripts to functions.
To begin, you can literally copy and paste the old code to this
file then turn it into a working function.
Test the functions with the values indicated and make sure
you get the results you expect to get.
print
########## PART ##########
#PART Convert Lab part to a function
#FUNCTION NAME: fractionGC
#PARAMETERS: A DNA sequence
#PURPOSE: The function should:
# Clean the DNA sequence.
# Use a "for" loop to iterate through the DNA sequence.
# Count the number of Gs and Cs in the DNA sequence.
# Calculate the fraction NOT PERCENT of Gs and Cs in the DNA sequence.
# Return the fraction of Gs and Cs in the DNA sequence.
#RETURN VALUES: The fraction of Gs and Cs in the DNA sequence. A float
testseq"GACCTTTAC"
testseq"GATCCTGGCTCAGGACGAACGCTGGCGGCGTGCTTAACACATGCAAGTCGAGCGGTAAGGCCCTTCGGGGTACACGAGCGGCGAACGGGTGAGTAACACGTGGGTGATCTGGGGCCCCATCTA"
# FUNCTION
def fractionGCdna:
return
#EXAMPLE:
#gccontent fractionGC
AgGctgTtgC t
#print gccontent
#The function would return:
#
#Test the function with the sequences from the example.
#Test the function again with "testseq and testseq above.
#Return the GC content of "testseq to gccontent".
#Test it again with "testseq Print the value to check it
print
########## PART ##########
#PART Convert Lab part to a function
#FUNCTION NAME: countDNAbases
#PARAMETERS: A DNA sequence
#PURPOSE: The function should:
# Count the number of each type of base in the DNA sequence.
# Return the counts of each type of base in the DNA sequence.
# Also print out a table as shown below.
#RETURN VALUES: The counts of each type of base in the DNA sequence. A tuple
# NOTE: Return the counts EXACTLY in this order: As Ts Gs and Cs
# Example tuples: mytuplexyz mytuple
# FUNCTION
#DATASET FOR PART :
testdna"AAGCTACGTGGGTGACTTTGCCGATTTAAGCCTGGGAA"
#EXAMPLE:
#DNAcountscountDNAbasestestdna
#print DNAcounts
#The function would print a table:
# A
# T
# G
# C
#The function would return:
#
print
########## PART ##########
#Part Convert Lab part to a function
#Use the random.shuffle function to make and print random lists of names.
namesTara'Merkel','Bob','Dwight','Chrysanthemum','Tiny Tim','Boba Fett','Lando',Sgt Rock','Beyonce'
printnames #prints the unshuffled names
print
########## PART ##########
#PART Convert Lab part to a function
#FUNCTION NAME: codonlist
#PARAMETERS: A sequence
#PURPOSE: The function should:
# Iterate through the sequence.
# Divide the sequence into sections of base codons with NO OVERLAPPING.
# Add the codons to a list.
# NOTE: If a group is not bases long, do not include it in the list.
# Return the list.
#RETURN VALUES: A list of codons. A list
# FUNCTION
#EXAMPLE:
#dna"AUGGGAAGC"
#codonscodonlistdna
#print codons
#The function would return:
# AUG"GGA","AGC"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
