fix: return diff key
Browse files- agro-nt-tasks.py +10 -9
agro-nt-tasks.py
CHANGED
@@ -122,17 +122,18 @@ class AgroNtTasks(datasets.GeneratorBasedBuilder):
|
|
122 |
|
123 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
124 |
def _generate_examples(self, filepath, split):
|
125 |
-
key = 0
|
126 |
with open(filepath, 'r') as f:
|
|
|
127 |
for record in SeqIO.parse(f,'fasta'):
|
128 |
# Yields examples as (key, example) tuples
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
122 |
|
123 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
124 |
def _generate_examples(self, filepath, split):
|
|
|
125 |
with open(filepath, 'r') as f:
|
126 |
+
key = 0
|
127 |
for record in SeqIO.parse(f,'fasta'):
|
128 |
# Yields examples as (key, example) tuples
|
129 |
|
130 |
+
split_name = record.name.split("|")
|
131 |
+
name = split_name[0]
|
132 |
+
labels = split_name[1]
|
133 |
|
134 |
+
yield key, {
|
135 |
+
"sequence": str(record.seq),
|
136 |
+
"name": name,
|
137 |
+
"labels": labels,
|
138 |
+
}
|
139 |
+
key += 1
|