tpierrot commited on
Commit
e47472b
1 Parent(s): 5198402

Update multi_species_genomes.py

Browse files
Files changed (1) hide show
  1. multi_species_genomes.py +11 -9
multi_species_genomes.py CHANGED
@@ -48,12 +48,6 @@ _HOMEPAGE = "https://www.ncbi.nlm.nih.gov/"
48
 
49
  _LICENSE = "https://www.ncbi.nlm.nih.gov/home/about/policies/"
50
 
51
- url_df = pd.read_csv('urls.csv')
52
- urls = list(url_df['URL'])
53
- _TEST_URLS = urls[-50:] # 50 genomes for test set
54
- _VALIDATION_URLS = urls[-100:-50] # 50 genomes for validation set
55
- _TRAIN_URLS = urls[:-100] # 800 genomes for training
56
-
57
  _CHUNK_LENGTHS = [6000, 12000]
58
  _OVERLAP = 100
59
 
@@ -133,9 +127,17 @@ class MultiSpeciesGenomes(datasets.GeneratorBasedBuilder):
133
 
134
  def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
135
 
136
- train_downloaded_files = dl_manager.download_and_extract(_TRAIN_URLS)
137
- test_downloaded_files = dl_manager.download_and_extract(_TEST_URLS)
138
- validation_downloaded_files = dl_manager.download_and_extract(_VALIDATION_URLS)
 
 
 
 
 
 
 
 
139
 
140
  return [
141
  datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"files": train_downloaded_files, "chunk_length": self.config.chunk_length}),
 
48
 
49
  _LICENSE = "https://www.ncbi.nlm.nih.gov/home/about/policies/"
50
 
 
 
 
 
 
 
51
  _CHUNK_LENGTHS = [6000, 12000]
52
  _OVERLAP = 100
53
 
 
127
 
128
  def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
129
 
130
+ urls_file = dl_manager.download_and_extract('urls.csv')
131
+ urls_df = pd.read_csv(urls_file)
132
+ urls = list(urls_df['URL'])
133
+
134
+ test_urls = urls[-50:] # 50 genomes for test set
135
+ validation_urls = urls[-100:-50] # 50 genomes for validation set
136
+ train_urls = urls[:-100] # 800 genomes for training
137
+
138
+ train_downloaded_files = dl_manager.download_and_extract(train_urls)
139
+ test_downloaded_files = dl_manager.download_and_extract(test_urls)
140
+ validation_downloaded_files = dl_manager.download_and_extract(validation_urls)
141
 
142
  return [
143
  datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"files": train_downloaded_files, "chunk_length": self.config.chunk_length}),