DeepBindWeight / deepbindweight.py
thewall's picture
Update deepbindweight.py
73477fb
raw
history blame
1.75 kB
import os
import json
import re
import pandas as pd
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 = "D00328.003"
def _info(self):
return datasets.DatasetInfo(
features=datasets.Features(
{
"config": datasets.Value("string"),
"existed": datasets.Value("bool"),
"table": datasets.Value("string")
}
),
homepage="http://tools.genes.toronto.edu/deepbind",
)
def _split_generators(self, dl_manager):
param_url = f"{URL}/params/{self.config.name}.txt"
table_url = f"{URL}/ERP001824-deepbind.xlsx"
downloaded_files = dl_manager.download_and_extract([param_url, table_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]),
"table": filepath[1]}
if __name__=="__main__":
from datasets import load_dataset
dataset = load_dataset("thewall/deepbindweight", split="all")
# dataset.push_to_hub("thewall/DeepBindWeight")