Question

In: Computer Science

Homework: You are to locate the file ```src/mutDetect_todo_i.py``` in which you are to fix twelve bugs...

Homework:

You are to locate the file ```src/mutDetect_todo_i.py``` in which you are to fix twelve bugs to run the program. Your output should look _exactly_ like that featured in the assignment lab. Please read the assignment sheet for other details about the lab.

#mutDetect_todo_i.py

############################################################################
# TODO: There are twelve EMBARRISING silly bugs to fix. Can you find them?!
############################################################################

DATE = "16 Sept 2019"
VERSION = "i"
AUTHOR = " myName"
AUTHORMAIL = "@allegheny.edu"

def help():
h_str = " "+DATE+" | version: "+VERSION+" |"+AUTHOR+" | "+AUTHORMAIL
print(" "+len(h_str) * "-")
print(h_str)
print(" "+len(h_str) * "-")
print("\n\tThe blank-blank program to do something cool.")
#print("""\n\tLibrary installation notes:""")
print("\t+ \U0001f600 USAGE: python3 mutDetect.py <any key to launch>")

######################################################
#end of help()


def getSeq():
""" Function to get a sequence (a string) from the user"""
print(" __Getting a sequence__")

prmpt = "\tEnter a sequence :"
seq_str = int(input(prmpt))
return seq_str.lower()

######################################################
# end of getSeq()


def compareSequences(seq1_str, seq2_str):
""" Compares the sequences base by base"""
print("\n __Comparing sequences__")

for i in range(len(seq1_str)):
# check to see whether the bases are the same going through the sequences
try:
if seq1_str[i] == seq2_str[i]: # are bases _not_ the same at the same position?
print("\t + Bases not the same at pos: ",i)
print("\t\t First seq char : " seq1_str[i])
print("\t\t Second seq char : ", seq2_str[i])
except IndexError:
#print(" \t Sequences are uneven length!")
pass
# end of compareSequences()

def getSeqLength(seq_str):
""" Function to return the length of a sequence"""
l_int = len(seq_str)
if l_int % 2 = 0: # can we read triplets, groups of three?
print("\t Warning! Sequence length cannot be divided into groups of triplets!")
return l_int
######################################################
#end of getSeqLength()

def compareSeqLength(seq1_str, seq2_str):
"""Function to check the lengths of the sequences to make sure that they are the same length. This is necessary for making comparisons."""
if len(seq1_str) = len(seq2_str):
return True
else:
return True
######################################################
#end of compareSeqLength()

def translate(dna_str):
""" Function to translate the DNA. Create a protein sequence from the DNA."""

sequence = Seq(dna_str)
#make some variables to hold strings of the translated code
# give me RNA from the DNA
RNAfromDNA_str = Seq.transcribe(sequence) #transcription step: converting dna to rna
# give me DNA from the RNA
DNAfromRNA_str = Seq.back_transcribe(sequence)
# give me the protein from the dna
PROTfromRNA_str = Seq.translate(RNAfromDNA_str)

# print the output of the string variables
print("\n __Translation__")

print("\t + Original DNA :", dna_str ", length is :", len(dna_str))
# print("\t + RNA from DNA :", RNAfromDNA_str)
# print("\t + DNA from RNA :", DNAfromRNA_str)
print("\t + PROTEIN from RNA :",PROTfromRNA_str)

return PROTfromRNA_str
######################################################
#end of translate()

def begin(task_str):
"""Driver function of program"""
print("\n\t Welcome to mutDetect!\n\t A program to compare DNA, make protein and compare protein sequences.)
# get first DNA sequence
seq1_str = getSeq()
# get second DNA sequence
seq2_str = getSeq()

print("\t + Length of first sequence :", getSeqLength(seq2_str))
print("\t + Length of second sequence :", getSeqLength(seq2_str))

# compare the sequences
compareSeQuences(seq1_str, seq2_str)
print("\t + Sequences are same length: ",compareSeqLength(seq1_str, seq2_str))

prot1_seq = Translate(seq1_str)
#print(type(prot1_seq))
protein1_str = str(prot1_seq)
print("\t + protein1 sequence :",protein1_str)

prot2_seq = translate(seq2_tsr)
#print(type(prot2_seq))
protein2_str = str(prot2_seq)
print("\t + protein2 sequence :",protein2_str)

compareSequences(protein1_str, protein2_str)

######################################################
#end of begin()

import os, sys
#import math
# list other libraries below

# load my biopython library
from Bio.Seq import Seq


if __name__ == '__main__':

if len(sys.argv) == 2: # one parameter at command line
# note: the number of command line parameters is n + 1
begin(sys.argv[1])
else:
help() # If no command-line parameter entered, then run the help() function
sys.exit()

Solutions

Expert Solution

Current ==> What it should be

1. seq_str = int(input(prmpt)) ==> seq_str = input(prmpt)

2. if seq1_str[i] == seq2_str[i]: ==> if seq1_str[i] != seq2_str[i]:

3. print("\t\t First seq char : " seq1_str[i]) . ==> print("\t\t First seq char : ", seq1_str[i])

4. if l_int % 2 = 0: ==> if l_int % 2 == 0:

5. if len(seq1_str) = len(seq2_str): ==> if len(seq1_str) == len(seq2_str):

6. else return True ==> else return False

7. compareSeQuences(seq1_str, seq2_str) . ==> compareSequences(seq1_str, seq2_str)

8. print("\t + Original DNA :", dna_str ", length is :", len(dna_str)) . ==> print("\t + Original DNA :", dna_str ," length is :", len(dna_str))

9. print("\n\t Welcome to mutDetect!\n\t A program to compare DNA, make protein and compare protein sequences.) ==> print("\n\t Welcome to mutDetect!\n\t A program to compare DNA, make protein and compare protein sequences.")

10. prot2_seq = translate(seq2_tsr) ==> prot2_seq = translate(seq2_str)

11. from Bio.Seq import Seq . ==> to be moved to the top of the file


Related Solutions

Find and fix the compile time bugs in the code at the end of this section....
Find and fix the compile time bugs in the code at the end of this section. Compile time bugs show as errors when you compile, but the Visual Studio IDE also gives you visual clues in the form of red squiggly underlines, as shown here. This assignment is meant to test your attention to detail and strengthen your debugging skills. Here is the code. // Week 4 Assignment-1 // Description: Compile time errors //---------------------------------- //**begin #include files************ #include <iostream> //...
Fix the bugs in this matlab program so that it solves. clear clf clc time =...
Fix the bugs in this matlab program so that it solves. clear clf clc time = linspace(0, 5, 100); m = 1; k = 100; c = 1; delta = 0.2; [period, response] = Exmp(m, k, c, delta, time); plot(time, response) grid %Exmp(m, k, c, delta, time) % %________________________________________ function [T, x] = Exmp(m, k, c, delta, t) omega = sqrt(k/m); cC = 2*m*omega; if c>= cC disp('Not an underdamped system') T = 0; x = 0; return; end %...
As a reward for completing your PChem homework you fix yourself a fruit smoothie in a...
As a reward for completing your PChem homework you fix yourself a fruit smoothie in a blender. While using your high-end blender with a vacuum filled double wall jar, you cannot help but ponder the thermodynamics of your tasty beverage. Explain the following. (a) Has heat entered the beverage while in the blender jar? (b) Did the temperature of your beverage rise as a result of the blending? (c) Did you do work on the beverage? (d) Have you changed...
Statement of Cash Flows -- Troubleshooting Homework Why doesn't this balance? Please fix it. (There are...
Statement of Cash Flows -- Troubleshooting Homework Why doesn't this balance? Please fix it. (There are 7 mistakes.) End of Beginning Balance sheet year of year Change Income statement Cash     76,000     42,000     34,000 Sales Accounts receivable 116,000 107,000       9,000 Cost of goods sold Inventory     88,000     94,000      (6,000) Gross profit Total current assets 280,000 243,000     37,000 Operating expenses Equipment, at cost 280,000 210,000     70,000 Income from operations Less: Accum. depreciation    (80,000)...
Python 3 Fix the code. It is not saving the data into the xls file Code:...
Python 3 Fix the code. It is not saving the data into the xls file Code: import tkinter as tk from tkcalendar import DateEntry from openpyxl import load_workbook from tkinter import messagebox from datetime import datetime window = tk.Tk() window.title("daily logs") window.grid_columnconfigure(1,weight=1) window.grid_rowconfigure(1,weight=1) # labels tk.Label(window, text="Bar code").grid(row=0, sticky="W", pady=20, padx=20) tk.Label(window, text="Products failed").grid(row=1, sticky="W", pady=20, padx=20) tk.Label(window, text="Money Lost").grid(row=2, sticky="W", pady=20, padx=20) tk.Label(window, text="sold by").grid(row=3, sticky="W", pady=20, padx=20) tk.Label(window, text="Working product").grid(row=4, sticky="W", pady=20, padx=20) #Working product label tk.Label(window, text="Failed...
The purpose of this homework is to test your knowledge of File IO and Collections and...
The purpose of this homework is to test your knowledge of File IO and Collections and the language would be java. Suppose that we have a file Employee.csv which contains employee information of a certain company. The first line of the file contains the following header: employeeId,firstName,lastName,dob,gender,position After the header line, each employee information is written on a separate line which consists of 6 comma-separated fields, for example:1234567, John, Smith,20/12/1989, M, Software Engineer Question 1. Write code to read the...
You have been given a style sheet file containing several errors. Locate all of the errors...
You have been given a style sheet file containing several errors. Locate all of the errors and fix the file. 1. Go to the code2-4.html file and within the head section insert link elements linking the page to the code2-4_layout.css and code2-4.css files. Review the contents of the files. 2.  Test the code2-4.css file in the CSS validator at the W3C website or with another validator of your choice. Make a note of the errors reported as a guide to debugging...
There are 11 gene transcripts for the SRC gene. Which cell types and tissues produce these...
There are 11 gene transcripts for the SRC gene. Which cell types and tissues produce these transcripts?
Python 3 Fix the code so the program reads the file and see if the bar...
Python 3 Fix the code so the program reads the file and see if the bar code was already inputted 3 times if so, it ishows a warning indicating that the item was already tested 3 times Code: import tkinter as tk from tkcalendar import DateEntry from openpyxl import load_workbook from tkinter import messagebox from datetime import datetime window = tk.Tk() window.title("daily logs") window.grid_columnconfigure(1,weight=1) window.grid_rowconfigure(1,weight=1) # labels tk.Label(window, text="Bar code").grid(row=0, sticky="W", pady=20, padx=20) tk.Label(window, text="Products failed").grid(row=1, sticky="W", pady=20, padx=20) tk.Label(window,...
Please create an Excel file with the calculated answers to the questions to the Excel homework...
Please create an Excel file with the calculated answers to the questions to the Excel homework for this week. The questions are listed in the attached PDF file.   Please also go over the Excel file attached to this assignment in order to familiarize yourself with the different ways Excel can be used to solve Time Value of Money problems when multiple cash flows are involved. There are three worksheets in the Excel file. This Excel file with examples is just...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT