Update tmvar_v3 based on git version 842f9dd
Browse files- tmvar_v3.py +26 -21
 
    	
        tmvar_v3.py
    CHANGED
    
    | 
         @@ -27,23 +27,16 @@ from bioc import pubtator 
     | 
|
| 27 | 
         
             
            from .bigbiohub import BigBioConfig, Tasks, kb_features
         
     | 
| 28 | 
         | 
| 29 | 
         
             
            _CITATION = """\
         
     | 
| 30 | 
         
            -
            @ 
     | 
| 31 | 
         
            -
              title 
     | 
| 32 | 
         
            -
              author 
     | 
| 33 | 
         
            -
             
     | 
| 34 | 
         
            -
             
     | 
| 35 | 
         
            -
              },
         
     | 
| 36 | 
         
            -
               
     | 
| 37 | 
         
            -
               
     | 
| 38 | 
         
            -
               
     | 
| 39 | 
         
            -
              url          = {https://arxiv.org/abs/2204.03637},
         
     | 
| 40 | 
         
            -
              copyright    = {Creative Commons Attribution 4.0 International},
         
     | 
| 41 | 
         
            -
              keywords     = {
         
     | 
| 42 | 
         
            -
                Computation and Language (cs.CL), FOS: Computer and information sciences,
         
     | 
| 43 | 
         
            -
                FOS: Computer and information sciences
         
     | 
| 44 | 
         
            -
              }
         
     | 
| 45 | 
         
             
            }
         
     | 
| 46 | 
         
            -
             
     | 
| 47 | 
         
             
            """
         
     | 
| 48 | 
         
             
            _LANGUAGES = ["English"]
         
     | 
| 49 | 
         
             
            _PUBMED = True
         
     | 
| 
         @@ -60,9 +53,9 @@ identifiers from the ClinGen Allele Registry It can be used for NER tasks and \ 
     | 
|
| 60 | 
         
             
            NED tasks, This dataset does NOT have splits.
         
     | 
| 61 | 
         
             
            """
         
     | 
| 62 | 
         | 
| 63 | 
         
            -
            _HOMEPAGE = "https:// 
     | 
| 64 | 
         | 
| 65 | 
         
            -
            _LICENSE = " 
     | 
| 66 | 
         | 
| 67 | 
         
             
            _URLS = {_DATASETNAME: "ftp://ftp.ncbi.nlm.nih.gov/pub/lu/tmVar3/tmVar3Corpus.txt"}
         
     | 
| 68 | 
         
             
            _SUPPORTED_TASKS = [Tasks.NAMED_ENTITY_RECOGNITION, Tasks.NAMED_ENTITY_DISAMBIGUATION]
         
     | 
| 
         @@ -90,6 +83,15 @@ class TmvarV3Dataset(datasets.GeneratorBasedBuilder): 
     | 
|
| 90 | 
         
             
                        subset_id=f"{_DATASETNAME}",
         
     | 
| 91 | 
         
             
                    )
         
     | 
| 92 | 
         
             
                )
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 93 | 
         
             
                BUILDER_CONFIGS.append(
         
     | 
| 94 | 
         
             
                    BigBioConfig(
         
     | 
| 95 | 
         
             
                        name=f"{_DATASETNAME}_bigbio_kb",
         
     | 
| 
         @@ -258,9 +260,12 @@ class TmvarV3Dataset(datasets.GeneratorBasedBuilder): 
     | 
|
| 258 | 
         
             
                                }
         
     | 
| 259 | 
         
             
                                for mention in doc.annotations
         
     | 
| 260 | 
         
             
                            ]
         
     | 
| 261 | 
         
            -
             
     | 
| 262 | 
         
            -
             
     | 
| 263 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 264 | 
         
             
                            yield document
         
     | 
| 265 | 
         | 
| 266 | 
         
             
                def pubtator_to_bigbio_kb(self, filepath):
         
     | 
| 
         | 
|
| 27 | 
         
             
            from .bigbiohub import BigBioConfig, Tasks, kb_features
         
     | 
| 28 | 
         | 
| 29 | 
         
             
            _CITATION = """\
         
     | 
| 30 | 
         
            +
            @article{wei2022tmvar,
         
     | 
| 31 | 
         
            +
              title={tmVar 3.0: an improved variant concept recognition and normalization tool},
         
     | 
| 32 | 
         
            +
              author={Wei, Chih-Hsuan and Allot, Alexis and Riehle, Kevin and Milosavljevic, Aleksandar and Lu, Zhiyong},
         
     | 
| 33 | 
         
            +
              journal={Bioinformatics},
         
     | 
| 34 | 
         
            +
              volume={38},
         
     | 
| 35 | 
         
            +
              number={18},
         
     | 
| 36 | 
         
            +
              pages={4449--4451},
         
     | 
| 37 | 
         
            +
              year={2022},
         
     | 
| 38 | 
         
            +
              publisher={Oxford University Press}
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 39 | 
         
             
            }
         
     | 
| 
         | 
|
| 40 | 
         
             
            """
         
     | 
| 41 | 
         
             
            _LANGUAGES = ["English"]
         
     | 
| 42 | 
         
             
            _PUBMED = True
         
     | 
| 
         | 
|
| 53 | 
         
             
            NED tasks, This dataset does NOT have splits.
         
     | 
| 54 | 
         
             
            """
         
     | 
| 55 | 
         | 
| 56 | 
         
            +
            _HOMEPAGE = "https://github.com/ncbi/tmVar3"
         
     | 
| 57 | 
         | 
| 58 | 
         
            +
            _LICENSE = "UNKNOWN"
         
     | 
| 59 | 
         | 
| 60 | 
         
             
            _URLS = {_DATASETNAME: "ftp://ftp.ncbi.nlm.nih.gov/pub/lu/tmVar3/tmVar3Corpus.txt"}
         
     | 
| 61 | 
         
             
            _SUPPORTED_TASKS = [Tasks.NAMED_ENTITY_RECOGNITION, Tasks.NAMED_ENTITY_DISAMBIGUATION]
         
     | 
| 
         | 
|
| 83 | 
         
             
                        subset_id=f"{_DATASETNAME}",
         
     | 
| 84 | 
         
             
                    )
         
     | 
| 85 | 
         
             
                )
         
     | 
| 86 | 
         
            +
                BUILDER_CONFIGS.append(
         
     | 
| 87 | 
         
            +
                    BigBioConfig(
         
     | 
| 88 | 
         
            +
                        name=f"{_DATASETNAME}_source_fixed",
         
     | 
| 89 | 
         
            +
                        version=SOURCE_VERSION,
         
     | 
| 90 | 
         
            +
                        description=f"{_DATASETNAME} source schema with fixed offsets",
         
     | 
| 91 | 
         
            +
                        schema="source",
         
     | 
| 92 | 
         
            +
                        subset_id=f"{_DATASETNAME}",
         
     | 
| 93 | 
         
            +
                    )
         
     | 
| 94 | 
         
            +
                )
         
     | 
| 95 | 
         
             
                BUILDER_CONFIGS.append(
         
     | 
| 96 | 
         
             
                    BigBioConfig(
         
     | 
| 97 | 
         
             
                        name=f"{_DATASETNAME}_bigbio_kb",
         
     | 
| 
         | 
|
| 260 | 
         
             
                                }
         
     | 
| 261 | 
         
             
                                for mention in doc.annotations
         
     | 
| 262 | 
         
             
                            ]
         
     | 
| 263 | 
         
            +
             
     | 
| 264 | 
         
            +
                            if "_fixed" in self.config.name:
         
     | 
| 265 | 
         
            +
                                document["entities"] = self._correct_wrong_offsets(
         
     | 
| 266 | 
         
            +
                                    document["entities"], doc.pmid
         
     | 
| 267 | 
         
            +
                                )
         
     | 
| 268 | 
         
            +
                                
         
     | 
| 269 | 
         
             
                            yield document
         
     | 
| 270 | 
         | 
| 271 | 
         
             
                def pubtator_to_bigbio_kb(self, filepath):
         
     |