Spaces:
Running
Running
supercat666
commited on
Commit
•
743b6b7
1
Parent(s):
242350b
fix
Browse files
app.py
CHANGED
@@ -96,12 +96,14 @@ def initiate_run():
|
|
96 |
def parse_gene_annotations(file_path):
|
97 |
gene_dict = {}
|
98 |
with open(file_path, 'r') as file:
|
99 |
-
headers = file.readline().strip().split('\t') #
|
100 |
for line in file:
|
101 |
values = line.strip().split('\t')
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
105 |
return gene_dict
|
106 |
|
107 |
# Replace 'your_annotation_file.txt' with the path to your actual gene annotation file
|
|
|
96 |
def parse_gene_annotations(file_path):
|
97 |
gene_dict = {}
|
98 |
with open(file_path, 'r') as file:
|
99 |
+
headers = file.readline().strip().split('\t') # Assuming tab-delimited file
|
100 |
for line in file:
|
101 |
values = line.strip().split('\t')
|
102 |
+
# Use min to avoid IndexError if there are fewer values than headers
|
103 |
+
gene_info = {headers[i]: values[i] if i < len(values) else '' for i in range(len(headers))}
|
104 |
+
approved_symbol = gene_info.get('Approved symbol', 'Unknown') # Use .get to avoid KeyError
|
105 |
+
if approved_symbol != 'Unknown': # Only add if there is an approved symbol
|
106 |
+
gene_dict[approved_symbol] = gene_info
|
107 |
return gene_dict
|
108 |
|
109 |
# Replace 'your_annotation_file.txt' with the path to your actual gene annotation file
|