Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make the following changes to the code in PYTHON IDLE 3.5 nothing else . Please be very descriptive and make sure you complete both parts,

image text in transcribed

Make the following changes to the code in PYTHON IDLE 3.5 nothing else. Please be very descriptive and make sure you complete both parts, Thank you!

Code for all alignments between a pair of sequences:

# Program to find all possible alignments of a pair of strings when adding # gaps to the shorter string # Given: Two strings of nucleotides # Find: All possible alignments when adding gaps to the shorter string # Function to create a list of all ways one gap can be inserted into # a string. The input is a string, the output is a list of strings # with a gap inserted into all positions of the input string def insertOneGap(strng): alignments = [] for i in range(len(strng)): newStrng = strng[0:i] + '-' + strng[i:len(strng)] alignments = alignments + [newStrng] alignments = alignments + [strng + '-'] return alignments # Function to take a set union of a pair of lists # This is used to eliminate any duplicates in the list when they are combined def Union(list1, list2): for a in list2: if a not in list1: list1 = list1 + [a] return list1 # Function to create all possible alignments of a string with a certain number # of gaps inserted def insertAllGaps(strng, gaps): # List of alignments starts with the initial string alignments = [strng] # Loop to insert one gap at a time for i in range(gaps): # Initialize list of new alignments with i gaps in the string newAlignments = [] # For every string in the list of alignments for st in alignments: # Insert one gap in each alignment in the list al = insertOneGap(st) # Add the new alignment to the list of new alignments being created newAlignments = Union(newAlignments,al) # The alignments list now becomes the new alignments list to now # add another gap to each of the alignments in the new list alignments = newAlignments return alignments # Function to print all of the alignments def printResults(st, alignments): print("There are ", len(alignments), " alignments") for i in range(len(alignments)): print(st) print(alignments[i]) print(" ") # Main function def main(): # Get the two strings to align str1 = input("Enter string 1: ") str2 = input("Enter string 2: ") # Compute alignments adding gaps to the shorter string if len(str1) > len(str2): longStr = str1 shortStr = str2 else: longStr = str2 shortStr = str1 alignments = insertAllGaps(shortStr,len(longStr)-len(shortStr)) printResults(longStr,alignments) 

Your outputs will look like this

image text in transcribed

image text in transcribed

Eile Edit Yew Hbtory Bookmarks bols Help a SakaieURI:CSC 110 Spri... X 0 Saka URI:CSC Spri X 110 Chegg study I Guided Sol a betting stats https sakai. uriedu/p A Most visited Getting started Instructions Great Algorithms La Programming m CSC 110 Homework 10- Bioinformatics Project 1. In class we wrote the program to find all alignments between a pair of sequences when we add gaps to the shorter sequence. You can find that code on the Sample Code page. Sample Code Modify this code so that it computes the score for each alignment using the following scoring Forums match +1 mismatch 0 gap --1 CSC Links The program should find the optimal alignment(s) and print them with their score. Schedule 2. Now add two counters and some print statements to your code to count how much work is done by this algorithm to find the optimal Gradebook alignment. The main units of work in this program are adding a gap to a sequence, and comparisons to compute the score. You may use global variables to store the amount of work that is done. Test your result on the following sequences: University Course Policies AAGGTAGCCT AACGTCCACTTTACCC AGTAAGGTACCTACCTCAACTTCA Site Info How much work does the algorithm do on these sequences? Help NOTE: To use a global variable to represent the amount of work required to insert gaps into the sequences, include the following line of code in each function where you reference the variable: global gap work Similarly for the variable to count the amount of work required to compare the characters in the sequences. global compare work Eile Edit Yew Hbtory Bookmarks bols Help a SakaieURI:CSC 110 Spri... X 0 Saka URI:CSC Spri X 110 Chegg study I Guided Sol a betting stats https sakai. uriedu/p A Most visited Getting started Instructions Great Algorithms La Programming m CSC 110 Homework 10- Bioinformatics Project 1. In class we wrote the program to find all alignments between a pair of sequences when we add gaps to the shorter sequence. You can find that code on the Sample Code page. Sample Code Modify this code so that it computes the score for each alignment using the following scoring Forums match +1 mismatch 0 gap --1 CSC Links The program should find the optimal alignment(s) and print them with their score. Schedule 2. Now add two counters and some print statements to your code to count how much work is done by this algorithm to find the optimal Gradebook alignment. The main units of work in this program are adding a gap to a sequence, and comparisons to compute the score. You may use global variables to store the amount of work that is done. Test your result on the following sequences: University Course Policies AAGGTAGCCT AACGTCCACTTTACCC AGTAAGGTACCTACCTCAACTTCA Site Info How much work does the algorithm do on these sequences? Help NOTE: To use a global variable to represent the amount of work required to insert gaps into the sequences, include the following line of code in each function where you reference the variable: global gap work Similarly for the variable to count the amount of work required to compare the characters in the sequences. global compare work

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

5. Identify and describe nine social and cultural identities.

Answered: 1 week ago