thewall commited on
Commit
3b416a3
·
1 Parent(s): 72cb18c

Create deepbindweight

Browse files
Files changed (1) hide show
  1. deepbindweight +52 -0
deepbindweight ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import re
4
+ import pandas as pd
5
+ import datasets
6
+
7
+
8
+ logger = datasets.logging.get_logger(__name__)
9
+
10
+ ID_POOL = ()
11
+ URL = "https://huggingface.co/datasets/thewall/DeepBindWeight/blob/main/params"
12
+
13
+ class DeepBindConfig(datasets.BuilderConfig):
14
+ pass
15
+
16
+
17
+ class JolmaLocal(datasets.GeneratorBasedBuilder):
18
+ BUILDER_CONFIGS = [
19
+ DeepBindConfig(name=key) for key in ID_POOL
20
+ ]
21
+
22
+ DEFAULT_CONFIG_NAME = "D00328.003"
23
+
24
+ def _info(self):
25
+ return datasets.DatasetInfo(
26
+ features=datasets.Features(
27
+ {
28
+ "config": datasets.Value("string"),
29
+ "existed": datasets.Value("bool")
30
+ }
31
+ ),
32
+ homepage="http://tools.genes.toronto.edu/deepbind",
33
+ )
34
+
35
+ def _split_generators(self, dl_manager):
36
+ url = f"{URL}/{self.config.name}.txt"
37
+ downloaded_files = dl_manager.download_and_extract(url)
38
+ return [
39
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files}),
40
+ ]
41
+
42
+ def _generate_examples(self, filepath):
43
+ """This function returns the examples in the raw (text) form."""
44
+ logger.info("generating examples from = %s", filepath)
45
+ yield 0, {"config": filepath, "existed": os.path.exists(filepath)}
46
+
47
+
48
+ if __name__=="__main__":
49
+ from datasets import load_dataset
50
+ dataset = load_dataset("deepbindweight.py", split="all")
51
+ dataset.push_to_hub("thewall/DeepBindWeight")
52
+