Question: language to be used is PYTHON main.py #!/usr/bin/env python3 import sys import p3mod gen = p3mod.find_starts() gen.send(None) # prime the generator with open(sys.argv[1]) as f:
language to be used is PYTHON
main.py
#!/usr/bin/env python3
import sys
import p3mod
gen = p3mod.find_starts()
gen.send(None) # prime the generator
with open(sys.argv[1]) as f:
for line in f:
(seqid,seq) = line.strip().lower().split()
startAndLocs = gen.send(seq)
print(seqid, ' '.join( (str(sal) for sal in startAndLocs) ) )
gen.close()
Write a python3 module named p3mod.py
which can be imported and used as in the sample p3main.py program.
The module should provide the function named
find_starts
which receives a DNA string to analyze. That function *must* be implemented as a generator which can in turn use additional generators or generator-expressions if you wish. The program should analyze each input line and print out information about each valid start codon found, and where each is located (relative to 0). Valid start codons are 'atg' and 'gtg'. Input may be in either upper or lower case.
To test, I will run p3main.py multiple times with various inputs. Each test will import your p3mod.py module.
Each test will be run in this manner: python3 p3main.py some_input_filename
If the input file contains these lines:
s1 catgccccgtgaaaa
stwo ccgtgccccctgaaa
s3 ccctgccccctgaaa
then, the program would print:
s1 ('atg', 1) ('gtg', 8)
stwo ('gtg', 2)
s3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
