Erva Ulusoy commited on
Commit
849b9bc
1 Parent(s): 99e9041

sort domain locations type error fix 2

Browse files
Files changed (1) hide show
  1. run_domain2go_app.py +2 -4
run_domain2go_app.py CHANGED
@@ -53,7 +53,7 @@ def find_domains(email, sequence, name):
53
  for elem in json_output['matches']:
54
  entry = elem['signature']['entry']
55
 
56
- location_list = [(i['start'], i['end']) for i in elem['locations']]
57
 
58
  if type(entry) == dict and entry['type'] == 'DOMAIN':
59
  if entry['accession'] not in entries:
@@ -72,9 +72,7 @@ def find_domains(email, sequence, name):
72
  entries[entry['accession']]['locations'].extend(location_list)
73
 
74
  entries[entry['accession']]['locations'] = list(set(entries[entry['accession']]['locations']))
75
- entries[entry['accession']]['locations'] = [(int(i[0]), int(i[1])) for i in entries[entry['accession']]['locations']]
76
- entries[entry['accession']]['locations'] = sorted(entries[entry['accession']]['locations'], key=lambda x: x[0])
77
- entries[entry['accession']]['locations'] = [f'{i[0]}-{i[1]}' for i in entries[entry['accession']]['locations']]
78
  entries[entry['accession']]['locations'] = ';'.join(entries[entry['accession']]['locations'])
79
 
80
  if entries:
 
53
  for elem in json_output['matches']:
54
  entry = elem['signature']['entry']
55
 
56
+ location_list = [f"{i['start']}-{i['end']}" for i in elem['locations']]
57
 
58
  if type(entry) == dict and entry['type'] == 'DOMAIN':
59
  if entry['accession'] not in entries:
 
72
  entries[entry['accession']]['locations'].extend(location_list)
73
 
74
  entries[entry['accession']]['locations'] = list(set(entries[entry['accession']]['locations']))
75
+ entries[entry['accession']]['locations'] = sorted(entries[entry['accession']]['locations'], key=lambda x: int(x.split('-')[0]))
 
 
76
  entries[entry['accession']]['locations'] = ';'.join(entries[entry['accession']]['locations'])
77
 
78
  if entries: