| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| """NASA_OSDR dataset""" |
|
|
| import json |
| import os |
|
|
| import datasets |
| import pandas as pd |
|
|
| _CITATION = """ |
| @inproceedings{singh2019towards, |
| title={}, |
| author={}, |
| booktitle={}, |
| pages={}, |
| year={} |
| } |
| """ |
|
|
| _DESCRIPTION = """ |
| TODO: write description |
| """ |
|
|
| _HOMEPAGE = "https://" |
|
|
| _LICENSE = "" |
|
|
| _SPLITS = ["train"] |
|
|
| _FIFTYONE_DATASET_URL = "" |
|
|
|
|
| class NasaOsdr(datasets.GeneratorBasedBuilder): |
| """NASA OSDR dataset.""" |
|
|
| BUILDER_CONFIGS = [ |
| datasets.BuilderConfig( |
| name="NASA_OSDR", |
| version=datasets.Version("1.0.0"), |
| description=_DESCRIPTION, |
| ) |
| ] |
|
|
| DEFAULT_CONFIG_NAME = "NASA_OSDR" |
|
|
| def _info(self): |
| ASSAY_COLUMNS = ['Sample Name', 'Protocol REF', 'Parameter Value: DNA Fragmentation', |
| 'Parameter Value: DNA Fragment Size', 'Extract Name', 'Protocol REF.1', |
| 'Parameter Value: Library Strategy', |
| 'Parameter Value: Library Selection', 'Parameter Value: Library Layout', |
| 'Protocol REF.2', 'Parameter Value: Sequencing Instrument', |
| 'Assay Name', 'Parameter Value: Read Length', 'Raw Data File', |
| 'Protocol REF.3', 'Parameter Value: Read Depth', |
| 'Parameter Value: MultiQC File Names'] |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| features = datasets.Features( |
| { |
| column_name: datasets.Value("string") |
| for column_name in ASSAY_COLUMNS |
| |
| } |
| ) |
|
|
| return datasets.DatasetInfo( |
| description=_DESCRIPTION, |
| features=features, |
| supervised_keys=None, |
| homepage=_HOMEPAGE, |
| license=_LICENSE, |
| citation=_CITATION, |
| ) |
|
|
| _URL = "https://raw.githubusercontent.com/AnzorGozalishvili/NASA_ODSR_DATA/main" |
| _ASSAYS_FILE = "assays.csv" |
| _SAMPLES_FILE = "samples.csv" |
|
|
| def _split_generators(self, dl_manager): |
| downloaded_files = dl_manager.download_and_extract( |
| { |
| "train": { |
| "assays": os.path.join(self._URL, self._ASSAYS_FILE), |
| "samples": os.path.join(self._URL, self._ASSAYS_FILE) |
| }, |
| } |
| ) |
|
|
| return [ |
| datasets.SplitGenerator( |
| name=datasets.Split.TRAIN, |
| gen_kwargs={ |
| "assays_file": downloaded_files['train']['assays'], |
| "samples_file": downloaded_files['train']['samples'], |
| }, |
| ), |
| ] |
|
|
| def _generate_examples(self, assays_file: str, samples_file): |
| |
| |
| |
|
|
| assays_df = pd.read_csv(assays_file) |
| samples_df = pd.read_csv(samples_file) |
|
|
| for (idx, assay_row), (_, sample_row) in zip(assays_df.iterrows(), samples_df.iterrows()): |
| _item = {**assay_row.to_dict()} |
| |
|
|
| yield idx, _item |
|
|