Update Genome_database.py
Browse files- Genome_database.py +1 -10
Genome_database.py
CHANGED
|
@@ -6,14 +6,8 @@ import os
|
|
| 6 |
import gzip
|
| 7 |
import re
|
| 8 |
|
| 9 |
-
class GenomeDatasetConfig(datasets.BuilderConfig):
|
| 10 |
-
def __init__(self, num_urls=None, **kwargs):
|
| 11 |
-
super(GenomeDatasetConfig, self).__init__(**kwargs)
|
| 12 |
-
self.num_urls = num_urls
|
| 13 |
-
|
| 14 |
class GenomeDataset(datasets.GeneratorBasedBuilder):
|
| 15 |
VERSION = datasets.Version("1.1.0")
|
| 16 |
-
BUILDER_CONFIG_CLASS = GenomeDatasetConfig
|
| 17 |
|
| 18 |
def _info(self):
|
| 19 |
return datasets.DatasetInfo(
|
|
@@ -37,9 +31,6 @@ class GenomeDataset(datasets.GeneratorBasedBuilder):
|
|
| 37 |
with open(urls_filepath) as urls_file:
|
| 38 |
downloaded_files = [line.rstrip() for line in urls_file]
|
| 39 |
|
| 40 |
-
num_urls = self.config.num_urls or len(downloaded_files)
|
| 41 |
-
downloaded_files = downloaded_files[:num_urls]
|
| 42 |
-
|
| 43 |
train_files = downloaded_files[:int(len(downloaded_files) * 0.8)] # first 80% for training
|
| 44 |
test_files = downloaded_files[int(len(downloaded_files) * 0.8):] # last 20% for testing
|
| 45 |
|
|
@@ -88,7 +79,7 @@ class GenomeDataset(datasets.GeneratorBasedBuilder):
|
|
| 88 |
elif feature.type == 'gene':
|
| 89 |
continue
|
| 90 |
else:
|
| 91 |
-
if feature.qualifiers.get('product') != ['']:
|
| 92 |
product = feature.qualifiers.get('product', ['NA'])[0]
|
| 93 |
region_type = 'coding'
|
| 94 |
specific_class = feature.type
|
|
|
|
| 6 |
import gzip
|
| 7 |
import re
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
class GenomeDataset(datasets.GeneratorBasedBuilder):
|
| 10 |
VERSION = datasets.Version("1.1.0")
|
|
|
|
| 11 |
|
| 12 |
def _info(self):
|
| 13 |
return datasets.DatasetInfo(
|
|
|
|
| 31 |
with open(urls_filepath) as urls_file:
|
| 32 |
downloaded_files = [line.rstrip() for line in urls_file]
|
| 33 |
|
|
|
|
|
|
|
|
|
|
| 34 |
train_files = downloaded_files[:int(len(downloaded_files) * 0.8)] # first 80% for training
|
| 35 |
test_files = downloaded_files[int(len(downloaded_files) * 0.8):] # last 20% for testing
|
| 36 |
|
|
|
|
| 79 |
elif feature.type == 'gene':
|
| 80 |
continue
|
| 81 |
else:
|
| 82 |
+
if feature.qualifiers.get('product') != ['NA']:
|
| 83 |
product = feature.qualifiers.get('product', ['NA'])[0]
|
| 84 |
region_type = 'coding'
|
| 85 |
specific_class = feature.type
|