-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
50 lines (41 loc) · 1.72 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
39
40
41
42
43
44
45
46
47
48
49
50
from Controllers import xfasta, xpersistency, xmitomaster, xncbi
fasta_filename = "diabetes.fasta"
filename = "haplo.csv"
def main():
# data = xmitomaster.upload_fasta(fasta_filename)
# data = xmitomaster.convert_list(data)
# xpersistency.save_data(data, "datos.cc")
data = xpersistency.load_data("datos.cc")
data = xmitomaster.convert_dataframe(data)
for index, row in data.iterrows():
print(row.to_list())
fasta = xpersistency.read_fasta(fasta_filename)
fasta = xfasta.fasta_to_dictionary(fasta)
rcrs = xfasta.get_rcrs_sequence()
rcrs += rcrs
print(type(rcrs))
print(rcrs)
print(len(rcrs))
print(type(fasta))
print(fasta)
print(rcrs.find(fasta['JF717112.1'][0:200]))
def do_all():
data = xmitomaster.do_all(
fasta_filename) # Uploads the fasta sequences to Mitomaster API and returns the data in Pandas DataFrame format
xpersistency.write_pandas_to_csv(data, filename) # Saves the data in csv format
df = xpersistency.read_pandas_from_cvs(filename)
sequencias = xfasta.do_all(fasta_filename) # Reads a fasta file and returns a Pandas Dataframe with ID and sequence
df = df.join(sequencias)
xpersistency.write_pandas_to_csv(df, filename)
print(df.describe())
for index, row in df.iterrows():
print(index)
locations = xfasta.get_positions_from_string(row["locations"])
data = xfasta.align(row["secuencias"],
locations) # Aligns the sequence with the reference sequence and returns the data [position, reference, sequence]
data = xfasta.polymorphism(data)
print(data)
for location in data:
xncbi.ncbi(location)
if __name__ == '__main__':
main()