File size: 1,956 Bytes
3b416a3 73477fb 3b416a3 88699e2 c8f2584 3b416a3 88699e2 3b416a3 88699e2 3b416a3 1f225f3 3b416a3 289235c f4717e7 3b416a3 1f225f3 f4717e7 1f225f3 fee8bd2 1f225f3 3b416a3 73477fb f4717e7 3b416a3 88699e2 3b416a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
import os
import datasets
logger = datasets.logging.get_logger(__name__)
ID_POOL = ()
URL = "https://huggingface.co/datasets/thewall/DeepBindWeight/resolve/main"
class DeepBindWeightConfig(datasets.BuilderConfig):
pass
class DeepBindWeight(datasets.GeneratorBasedBuilder):
BUILDER_CONFIGS = [
DeepBindWeightConfig(name=key) for key in ID_POOL
]
DEFAULT_CONFIG_NAME = "params"
def _info(self):
return datasets.DatasetInfo(
features=datasets.Features(
{
"config": datasets.Value("string"),
"existed": datasets.Value("bool"),
"selex": datasets.Value("string"),
"tf": datasets.Value("string")
}
),
homepage="http://tools.genes.toronto.edu/deepbind",
)
def _split_generators(self, dl_manager):
param_url = f"{URL}/params.tar.gz"
selex_url = f"{URL}/ERP001824-deepbind.xlsx"
tf_url = f"{URL}/ERP001824-UniprotKB.xlsx"
downloaded_files = [os.path.join(f"{dl_manager.download_and_extract(param_url)}", "params")]
downloaded_files.extend(dl_manager.download([selex_url, tf_url]))
return [
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files}),
]
def _generate_examples(self, filepath):
"""This function returns the examples in the raw (text) form."""
logger.info("generating examples from = %s", filepath)
yield 0, {"config": filepath[0],
"existed": os.path.exists(filepath[0]) and os.path.exists(filepath[1]) and os.path.exists(filepath[2]),
"selex": filepath[1],
'tf': filepath[2]}
if __name__=="__main__":
from datasets import load_dataset
dataset = load_dataset("thewall/deepbindweight", split="all")
# dataset.push_to_hub("thewall/DeepBindWeight")
|