davidkartchner commited on
Commit
41ab023
1 Parent(s): 049c340

Remove false-positive entity normalization artifacts from nlm_gene

Browse files

This PR corrects three types of errors in the current NLM-Gene dataset loader:

* This corrects an artifact in the previous code that incorrectly linked every unnormalized entity to NCBIGene:1 (alpha-1-B glycoprotein)
* This also corrects errors in two abstracts in which the "code" attribute of an entity was mistakenly included in the "NCBI Gene Identifier" attribute. The "code" of an entity specifies additional characteristics of the entity that are different from its normalization, such as whether that entity was part of a protein family/complex, etc. Details can be found in the [dataset annotation guidelines](https://ftp.ncbi.nlm.nih.gov/pub/lu/NLMGene/NLM-Gene-Annotation-Guidelines.docx)
* The first error occurs in the document with PMID 26820130 where the "code" attribute of unnormalized entities was placed in the "NCBI Gene Identifier" category (error is plainly visible when inspecting [this source data](https://ftp.ncbi.nlm.nih.gov/pub/lu/NLMGene/Corpus/26820130.BioC.XML)).
* The second corrected error error with the entity in PMID 24886643 at offset [2249, 2257] where the "code" attribute of an entity was prepended to the comma-delimited string of entity normalizations. It is clear from inspection that [NCBI Gene Identifier 222](https://www.ncbi.nlm.nih.gov/gene/?term=222) (aldehyde dehydrogenase 3 family member B2) is not related to cytokines.
* Finally, this fixes single instances in PMIDs 25698444, 25732851, 28260056, and 27110092 where entities with no normalization have NCBI Gene Identifier = "-"

Files changed (1) hide show
  1. nlm_gene.py +18 -8
nlm_gene.py CHANGED
@@ -176,14 +176,24 @@ class NLMGeneDataset(datasets.GeneratorBasedBuilder):
176
  """Parse BioC entity annotation."""
177
  offsets, texts = get_texts_and_offsets_from_bioc_ann(span)
178
  db_ids = span.infons.get(db_id_key, "-1")
179
- # Find connector between db_ids for the normalization, if not found, use default
180
- connector = "|"
181
- for splitter in list(splitters):
182
- if splitter in db_ids:
183
- connector = splitter
184
- normalized = [
185
- {"db_name": "NCBIGene", "db_id": db_id} for db_id in db_ids.split(connector)
186
- ]
 
 
 
 
 
 
 
 
 
 
187
 
188
  return {
189
  "id": span.id,
 
176
  """Parse BioC entity annotation."""
177
  offsets, texts = get_texts_and_offsets_from_bioc_ann(span)
178
  db_ids = span.infons.get(db_id_key, "-1")
179
+
180
+ # Correct an annotation error in PMID 24886643
181
+ if db_ids.startswith('-222'):
182
+ db_ids = db_ids.lstrip('-222,')
183
+
184
+ # No listed entity for a mention
185
+ if db_ids in ['-1','-000','-111']:
186
+ normalized = []
187
+
188
+ else:
189
+ # Find connector between db_ids for the normalization, if not found, use default
190
+ connector = "|"
191
+ for splitter in list(splitters):
192
+ if splitter in db_ids:
193
+ connector = splitter
194
+ normalized = [
195
+ {"db_name": "NCBIGene", "db_id": db_id} for db_id in db_ids.split(connector)
196
+ ]
197
 
198
  return {
199
  "id": span.id,