Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write in PYTHON Lab 11: Recursion Overview Assignment Lab 12: Bioinformatics DNA

ID: 653673 • Letter: W

Question

Write in PYTHON

Lab 11: Recursion

Overview

Assignment

Lab 12: Bioinformatics

DNA (deoxyribonucleic acid) is the basis of life. It consists of 4 characters: A, C, T, G (which each stand for different nucleotides).

In this lab, you will determine the relative percentages of each nucleotide given a string of DNA.
The DNA string is given below:

AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGCAGGGCCCTTATCGATTTACGA

Copy this string into a file - name it DNA.txt. In your lab11.py file, read in the contents of DNA.txt and determine the percentage of A's, C's, T's, and G's.
For example, given the string "AAAATCCCGG", the percentage of A's = 0.4, C's = 0.3, G's = 0.2, and T's = 0.1.

Write the percentages (with descriptive labels) to another file, named "results.txt". The contents of this file, using the long DNA string given above, should look as follows:

% of A's: 0.2717391304347826
% of C's: 0.18478260869565216
% of G's: 0.2391304347826087
% of T's: 0.29347826086956524

If you would like more practice with File I/O or with Bioinformatics coding, go to rosalind.info.

Explanation / Answer

Recursion : It is tchnique in which a function calls itself within it. Follwoing Program demonstrates it

weights = [1, 2, 3]

def ev(entry, weights, weight_idx = 0):
if entry == 0:
return True

if weight_idx == len(weights):
return False

if ev(entry + weights[weight_idx], weights, weight_idx+1):
return True

if ev(entry - weights[weight_idx], weights, weight_idx+1):
return True

if ev(entry, weights, weight_idx+1):
return True

return False

print ev(4, weights)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote