Question: Hi, I have a function and I need to test it on a specific file (instead of sequence as seen in the code below). I

Hi, I have a function and I need to test it on a specific file (instead of sequence as seen in the code below). I tried writing:

from os import listdir sequence = os.listdir('seq_3b.txt')

however its returning an error: NotADirectoryError: [Errno 20] Not a directory: 'seq_3b.txt'

how can I run the function on the specific file?

this is the code:

def find_orf(sequence): # Find all ATG indexs. ATG is usually the start codon for the Methionine start start_position = 1 start_indexs = [] stop_indexs = [] for i in range(1, len(sequence), 3): if sequence[i:i+3] == "ATG": start_indexs.append(i)

# Find all stop codon indexs. for i in range(1, len(sequence), 3): stops =["TAA", "TAA", "TGA"] if sequence[i:i+3] in stops: stop_indexs.append(i)

orf = [] mark = 0 for i in range(0,len(start_indexs)): for j in range(0, len(stop_indexs)): if start_indexs[i] < stop_indexs[j] and start_indexs[i] > mark: orf.append(sequence[start_indexs[i]:stop_indexs[j]+3]) mark = stop_indexs[j]+3 break return orf

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!