-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (30 loc) · 1.07 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from seq_input import read_fasta
from read_orf import readingFrames
from read_orf import ORFData
from read_orf import printORFs
from read_orf import sequenceORFs
from seq_output import maxLenIndex
from seq_output import outputORF
print("This program will find ORFs for sequences.\n When prompted, please enter a FASTA file with 1 or more sequences.")
file_path = input("Enter a FASTA file: ")
min_bp = int(input("Enter minimum length in bp for ORFs: "))
seq = read_fasta(file_path)
# Test
#import sys
#sys.path.append('D:/share/divergene/script/final')
#seq = read_fasta("D:/share/divergene/script/final/sequence.fasta")
#min_bp = 300
rf = {}
ORF_dict = {}
ORF_pair_dict = {}
ORF_seq_dict = {}
min_aa = round(min_bp/3)
str = ""
for i in seq.keys():
rf[i] = readingFrames(seq[i])
ORF_dict[i] = ORFData(rf[i])
ORF_pair_dict[i] = printORFs(ORF_dict[i][0],ORF_dict[i][1],min_aa)
ORF_seq_dict[i] = sequenceORFs(ORF_pair_dict[i],rf[i])
str += outputORF(ORF_pair_dict[i],ORF_seq_dict[i],max_codon=15,seq_name=i,max_only=True)
with open('output.txt', 'w') as f:
f.write(str)