Write a PYTHON program that tests to see whether a sequence has an AT repeat. For this problem, we’ll define a repeat as 3 or more occurrences of AT, i.e. ATATAT…etc. Read in the sequence from a file (in FASTA format) to test your code.
You can use the attached “Test.txt” sequence.
Return a message to the user whether or not an AT repeat exits in the sequence. Use at least one function.
Test.txt :
>TestSeq ATGCTTTACGTCTACTGTCGTATGCTTTACGTCTACTGACTGTCGTATGCTTACGTCTACTGTCG TGCTTTACGTCTACTGACTGTCGTATATATATATATATATTGCTTTACGTCTACTGACTGTCGTA
Below is the complete code as per the requirements. It is well explained inside the code using comments.
# function checks if AT repeat exists
def hasRepeat(line):
# iterate through all characters of
sequence
for i in range(len(line)-5):
# check if AT repeat is
there
if line[i:i+6] ==
'ATATAT':
return True
# if true has not been returned, repeat doesn't
exist
return False
# open the file
file = open('Test.txt')
# read all lines in the file
lines = file.read().split("\n")
# variables to keep track of sequence
seqStarted = False
found = 0
# iterate through all lines
for line in lines:
# break loop if empty line is there
if len(line) == 0:
break
# check if sequence startes
if seqStarted:
if line[0] ==
'>':
seqStarted = False
continue
else:
# check if sequence has an AT repeat
if hasRepeat(line):
# print message and break the loop
print('AT repeat exists')
found = 1
break
else:
# if it is not TestSeq,
ignore
if line !=
'>TestSeq':
continue
else:
seqStarted = True
continue
# if not found, print to use
if found == 0:
print('AT repeat does not exist')
# close the file
file.close()
Below is the screenshot of the code if there is any indentation issue:


Below is the sample output for given sequence:

This completes the requirement. Let me know if you have any queries.
Thanks!
Write a PYTHON program that tests to see whether a sequence has an AT repeat. For...
python/idle 1. Write a program that counts the number of A’s in a DNA sequence. The input is one sequence in FASTA format in a file called ‘dna.txt’. For example, if the file contains: >human ACCGT then the output of the program should be 1. Your program should work for any sequence and not just the one in the example.
Your
program write
a program to test whether a number is prime or not.
Your program should
ask user to input an integer and respond: "Prime" or "Not
prime".
Don't use any
library function that tests for prime numbers.
The program should
continue to ask for input, till it sees a 0, when it exits.
Please submit printed
pseudocodeshould ask user to input an
integer and respond: "Prime" or "Not prime".
Don't use any library function that tests for prime numbers....
This needs to be written in Python. I'm writing this but I'd love to see how others would do it. I have idea to make a program to keep track of reading. Set goal per day. Input minutes per day & book read. Could accumulate for whole month. Input daily, but you can input it all at the end of the week if you want. I want the user to be prompted to enter a numerical value and book for...
IN PYTHON 3: Write a Python program to read the attached text file containing words, count the occurrence of each unique word and store the words in alphabetical order in a text file listing the word and the total count of that word. You cannot use any advanced features such as dictionaries. The program requires user input to determine the name of the file. (example of the text file that needs to be read = for a brief moment I...
python program Use the provided shift function to create a caesar cipher program. Your program should have a menu to offer the following options: Read a file as current message Save current message Type in a new message Display current message "Encrypt" message Change the shift value For more details, see the comments in the provided code. NO GLOBAL VARIABLES! Complete the program found in assignment.py. You may not change any provided code. You may only complete the sections labeled:#YOUR...
python Write a program that calculates the AT and GC content (i.e. the percentage of G and C, and the percentage of A and T) in a given sequence. You can make up your own dummy sequence and store it in text file (use something like Notepad, not word!). Your program should read in the sequence from the file and calculate the GC and AT content. Print out the results to a file called DNA_Statistics.txt, the result should look something...
Write a python program and pseudocode The Program Using Windows Notepad (or similar program), create a file called Numbers.txt in your the same folder as your Python program. This file should contain a list on floating point numbers, one on each line. The number should be greater than zero but less than one million. Your program should read the following and display: The number of numbers in the file (i.e. count them) (counter) The maximum number in the file (maximum)...
Write a program that reads a string from the keyboard and tests whether it contains a valid time. Display the time as described below if it is valid, otherwise display a message as described below. The input date should have the format hh:mm:ss (where hh = hour, mm = minutes and ss = seconds in a 24 hour clock, for example 23:47:55). Here are the input errors (exceptions) that your program should detect and deal with: Receive the input from...
Write a C++ program that does the following : Define a class myInt that has as its single attribute an integer variable and that contains member functions for determining the following information for an object of type myInt: A. Is it multiple of 7 , 11 , or 13. B. Is the sum of its digits odd or even. C. What is the square root value. D.Is it a prime number. E. Is it a perfect number ( The sum...
In this assignment you are asked to write a Python program to determine all the prime numbers in between a range and store them in a list that will be printed when the range is searched. The user is prompted for two positive integer values as input, one is the start of the range and the other is the end of the range. If the user gives a negative value or enters a second number that is lower than the...