MaziyarPanahi commited on
Commit
baba427
·
verified ·
1 Parent(s): 7e7d606

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +239 -0
README.md ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: cc-by-4.0
5
+ size_categories:
6
+ - 1K<n<10K
7
+ task_categories:
8
+ - text-classification
9
+ - token-classification
10
+ tags:
11
+ - biology
12
+ - medical
13
+ - biomedical
14
+ - NLP
15
+ - relation-extraction
16
+ - drug-protein-interactions
17
+ - BioCreative
18
+ - PubMed
19
+ - pharmacology
20
+ - NER
21
+ dataset_info:
22
+ features:
23
+ - name: pmid
24
+ dtype: string
25
+ - name: title
26
+ dtype: string
27
+ - name: abstract
28
+ dtype: string
29
+ - name: text
30
+ dtype: string
31
+ - name: entities
32
+ list:
33
+ - name: id
34
+ dtype: string
35
+ - name: type
36
+ dtype: string
37
+ - name: text
38
+ dtype: string
39
+ - name: start
40
+ dtype: int64
41
+ - name: end
42
+ dtype: int64
43
+ - name: relations
44
+ list:
45
+ - name: type
46
+ dtype: string
47
+ - name: arg1
48
+ dtype: string
49
+ - name: arg2
50
+ dtype: string
51
+ splits:
52
+ - name: train
53
+ num_examples: 3500
54
+ - name: validation
55
+ num_examples: 750
56
+ configs:
57
+ - config_name: default
58
+ data_files:
59
+ - split: train
60
+ path: data/train.parquet
61
+ - split: validation
62
+ path: data/validation.parquet
63
+ ---
64
+
65
+ # DrugProt (Parquet)
66
+
67
+ A clean, ready-to-use Parquet version of the **DrugProt** corpus from [BioCreative VII Track 1](https://biocreative.bioinformatics.udel.edu/tasks/biocreative-vii/track-1/), converted for seamless use with the Hugging Face `datasets` library.
68
+
69
+ DrugProt is a gold-standard corpus of **4,250 PubMed abstracts** annotated for **drug/chemical–protein interactions**, covering **13 fine-grained relation types** and **3 entity types**. It is designed for training and evaluating biomedical relation extraction systems.
70
+
71
+ ## Quick Start
72
+
73
+ ```python
74
+ from datasets import load_dataset
75
+
76
+ dataset = load_dataset("OpenMed/drugprot-parquet")
77
+
78
+ # Access splits
79
+ train = dataset["train"] # 3,500 abstracts
80
+ val = dataset["validation"] # 750 abstracts
81
+
82
+ # Inspect a sample
83
+ example = train[0]
84
+ print(example["title"])
85
+ print(f"Entities: {len(example['entities'])}")
86
+ print(f"Relations: {len(example['relations'])}")
87
+ ```
88
+
89
+ ## Dataset Description
90
+
91
+ Each example represents a PubMed abstract with expert-annotated entity spans and relation labels:
92
+
93
+ | Field | Type | Description |
94
+ |-------|------|-------------|
95
+ | `pmid` | `string` | PubMed article ID |
96
+ | `title` | `string` | Article title |
97
+ | `abstract` | `string` | Article abstract |
98
+ | `text` | `string` | Full text (title + abstract) |
99
+ | `entities` | `list[dict]` | Annotated entity spans |
100
+ | `relations` | `list[dict]` | Annotated drug–protein relations |
101
+
102
+ ### Entity Schema
103
+
104
+ Each entity contains:
105
+
106
+ | Field | Type | Description |
107
+ |-------|------|-------------|
108
+ | `id` | `string` | Unique entity ID (e.g., `T1`, `T2`) |
109
+ | `type` | `string` | Entity type: `CHEMICAL`, `GENE-Y`, or `GENE-N` |
110
+ | `text` | `string` | Surface text of the entity mention |
111
+ | `start` | `int` | Character offset (start) in `text` field |
112
+ | `end` | `int` | Character offset (end) in `text` field |
113
+
114
+ **Entity types:**
115
+ - **CHEMICAL** — Drugs, small molecules, metabolites, and other chemical compounds
116
+ - **GENE-Y** — Gene/protein mentions that are a normalized, valid gene/protein
117
+ - **GENE-N** — Gene/protein mentions that are NOT normalized (e.g., protein families, complexes)
118
+
119
+ ### Relation Schema
120
+
121
+ Each relation contains:
122
+
123
+ | Field | Type | Description |
124
+ |-------|------|-------------|
125
+ | `type` | `string` | One of 13 relation categories (see below) |
126
+ | `arg1` | `string` | Entity ID of the first argument |
127
+ | `arg2` | `string` | Entity ID of the second argument |
128
+
129
+ ## Relation Types (13 Classes)
130
+
131
+ | Relation | Description | Train | Val |
132
+ |----------|-------------|------:|----:|
133
+ | `INHIBITOR` | Chemical inhibits the protein | 5,388 | 1,150 |
134
+ | `DIRECT-REGULATOR` | Chemical directly regulates protein (mechanism unspecified) | 2,247 | 458 |
135
+ | `SUBSTRATE` | Chemical is a substrate of the enzyme | 2,003 | 494 |
136
+ | `ACTIVATOR` | Chemical activates the protein | 1,428 | 246 |
137
+ | `INDIRECT-UPREGULATOR` | Chemical indirectly increases protein activity/expression | 1,378 | 302 |
138
+ | `INDIRECT-DOWNREGULATOR` | Chemical indirectly decreases protein activity/expression | 1,329 | 332 |
139
+ | `ANTAGONIST` | Chemical acts as antagonist of the receptor/protein | 972 | 218 |
140
+ | `PRODUCT-OF` | Chemical is a product of the enzyme | 920 | 158 |
141
+ | `PART-OF` | Chemical is part of the protein complex | 885 | 257 |
142
+ | `AGONIST` | Chemical acts as agonist of the receptor/protein | 658 | 131 |
143
+ | `AGONIST-ACTIVATOR` | Chemical is both agonist and activator | 29 | 10 |
144
+ | `SUBSTRATE_PRODUCT-OF` | Chemical is both substrate and product | 24 | 3 |
145
+ | `AGONIST-INHIBITOR` | Chemical is agonist but inhibits downstream effects | 13 | 2 |
146
+ | **Total** | | **17,274** | **3,761** |
147
+
148
+ ## Dataset Statistics
149
+
150
+ | | Train | Validation | Total |
151
+ |--|------:|-----------:|------:|
152
+ | Abstracts | 3,500 | 750 | **4,250** |
153
+ | Abstracts with relations | 2,433 | — | — |
154
+ | Total entities | 89,529 | — | — |
155
+ |  • CHEMICAL | 46,274 (51.7%) | — | — |
156
+ |  • GENE-Y | 28,421 (31.7%) | — | — |
157
+ |  • GENE-N | 14,834 (16.6%) | — | — |
158
+ | Total relations | 17,274 | 3,761 | **21,035** |
159
+ | Avg. entities / abstract | 25.6 | — | — |
160
+ | Avg. relations / abstract | 4.9 | — | — |
161
+
162
+ ## Usage Examples
163
+
164
+ ### Relation Extraction
165
+
166
+ ```python
167
+ from datasets import load_dataset
168
+
169
+ ds = load_dataset("OpenMed/drugprot-parquet", split="train")
170
+
171
+ for example in ds:
172
+ entities = {e["id"]: e for e in example["entities"]}
173
+ for rel in example["relations"]:
174
+ arg1 = entities[rel["arg1"]]
175
+ arg2 = entities[rel["arg2"]]
176
+ print(f"{arg1['text']} --[{rel['type']}]--> {arg2['text']}")
177
+ ```
178
+
179
+ ### Named Entity Recognition (NER)
180
+
181
+ ```python
182
+ from datasets import load_dataset
183
+
184
+ ds = load_dataset("OpenMed/drugprot-parquet", split="train")
185
+
186
+ for example in ds:
187
+ text = example["text"]
188
+ for ent in example["entities"]:
189
+ span = text[ent["start"]:ent["end"]]
190
+ assert span == ent["text"], f"Offset mismatch: '{span}' != '{ent['text']}'"
191
+ print(f"[{ent['type']}] {ent['text']} ({ent['start']}:{ent['end']})")
192
+ ```
193
+
194
+ ### Convert to Token Classification Format
195
+
196
+ ```python
197
+ from datasets import load_dataset
198
+
199
+ ds = load_dataset("OpenMed/drugprot-parquet", split="train")
200
+
201
+ # Build BIO tags from character offsets
202
+ example = ds[0]
203
+ text = example["text"]
204
+ char_labels = ["O"] * len(text)
205
+ for ent in sorted(example["entities"], key=lambda e: e["start"]):
206
+ tag = ent["type"]
207
+ char_labels[ent["start"]] = f"B-{tag}"
208
+ for i in range(ent["start"] + 1, ent["end"]):
209
+ char_labels[i] = f"I-{tag}"
210
+ ```
211
+
212
+ ## Source
213
+
214
+ This dataset is a Parquet conversion of the [DrugProt BioCreative VII corpus](https://biocreative.bioinformatics.udel.edu/tasks/biocreative-vii/track-1/). The original data was released under **CC BY 4.0** for the BioCreative VII shared task.
215
+
216
+ **Original paper:**
217
+
218
+ > M. Krallinger, O. Rabal, A. Lourenco, J. Oyarzabal, A. Valencia.
219
+ > *"Overview of the BioCreative VII Track 1 – DrugProt: Drug-Protein Relation Extraction."*
220
+ > Proceedings of the BioCreative VII Challenge Evaluation Workshop, 2021.
221
+
222
+ **BibTeX:**
223
+
224
+ ```bibtex
225
+ @inproceedings{drugprot2021,
226
+ title={Overview of the BioCreative VII Track 1 -- DrugProt: Drug-Protein Relation Extraction},
227
+ author={Krallinger, Martin and Rabal, Obdulia and Lourenco, Analia and Oyarzabal, Julen and Valencia, Alfonso},
228
+ booktitle={Proceedings of the BioCreative VII Challenge Evaluation Workshop},
229
+ year={2021}
230
+ }
231
+ ```
232
+
233
+ ## License
234
+
235
+ CC BY 4.0 — following the original DrugProt corpus license.
236
+
237
+ ## About OpenMed
238
+
239
+ [OpenMed](https://huggingface.co/OpenMed) provides clean, standardized biomedical datasets and RL training environments for medical AI research.