| | 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 = "D00328.003" |
| |
|
| | 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/{self.config.name}.txt" |
| | selex_url = f"{URL}/ERP001824-deepbind.xlsx" |
| | tf_url = f"{URL}/ERP001824-UniprotKB.xlsx" |
| | downloaded_files = dl_manager.download([param_url, 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") |
| | |
| |
|
| |
|