{"id":34687874,"url":"https://github.com/arvkevi/generif2vec","last_synced_at":"2026-05-22T21:34:10.434Z","repository":{"id":66080053,"uuid":"228685229","full_name":"arvkevi/generif2vec","owner":"arvkevi","description":"Doc2vec model trained on NCBI Gene Reference into Function (GeneRIF)-annotated PubMed abstracts.","archived":false,"fork":false,"pushed_at":"2019-12-17T19:19:44.000Z","size":717,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-09T10:37:11.631Z","etag":null,"topics":["doc2vec","genomics","nlp"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arvkevi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-12-17T19:16:33.000Z","updated_at":"2021-06-24T18:31:57.000Z","dependencies_parsed_at":"2023-04-09T04:32:37.480Z","dependency_job_id":null,"html_url":"https://github.com/arvkevi/generif2vec","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arvkevi/generif2vec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvkevi%2Fgenerif2vec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvkevi%2Fgenerif2vec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvkevi%2Fgenerif2vec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvkevi%2Fgenerif2vec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arvkevi","download_url":"https://codeload.github.com/arvkevi/generif2vec/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvkevi%2Fgenerif2vec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33369912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T12:23:38.849Z","status":"online","status_checked_at":"2026-05-22T02:00:06.671Z","response_time":265,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["doc2vec","genomics","nlp"],"created_at":"2025-12-24T21:55:31.906Z","updated_at":"2026-05-22T21:34:10.429Z","avatar_url":"https://github.com/arvkevi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# generif2vec\nResources and tools to work with [Doc2vec](https://radimrehurek.com/gensim/models/doc2vec.html) and NCBI's [gene reference into\n function (GeneRIF)](https://www.ncbi.nlm.nih.gov/gene/about-generif).\n\n![umap](figures/umap.generif2vec.png)\n\n## GeneRIF Abstracts\nGeneRIF is a resource that includes gene annotations curated by genetics experts. The file used for training the \nDoc2vec model and for linking PubMed ID to Gene ID is \n[hosted by NCBI](ftp://ftp.ncbi.nih.gov/gene/GeneRIF/generifs_basic.gz).  \n\nThe [generif2vec/text](generif2vec/text) module has code to:\n* Download the abstracts for GeneRIF PubMed articles.\n* Process the abstracts from raw text into `TaggedDocuments` for Doc2vec using [spacy](https://spacy.io/).\n\n*NOTE: The annotated gene symbol in each abstract was replaced with @gene$*\n\n## Pretrained Doc2vec model\nDownload the pretrained 100-dimension Doc2vec model [here](https://generif2vec.s3.amazonaws.com/generif2vec.doc2vec)\n and use it as shown below.   \n\nThe parameter settings for this model were chosen after hyperparameter tuning was performed on Google Cloud AI Platform \nfollowing the methods described in [trainer/README](trainer/README.md).\n\nThis model achieved `59.1%` top 5 accuracy and `64.1%` top 10 accuracy on a held out test set (25%) of abstracts.\nMore information regarding the evaluation of the model can be found in [evaluation](#evaluation).\n\n### Installation\nInstalling the package makes it easy to work with your own text.\n```shell script\ngit clone https:@github.com:arvkevi/generif2vec.git\ncd generif2vec\npython setup.py install\n```\n\n### Library Usage\nLoad the downloaded model as a Doc2vec model:\n```python\nfrom gensim.models.doc2vec import Doc2Vec\ngenerif2vec_model = '/path/to/downloaded_model'\nmodel = Doc2Vec.load(generif2vec_model)\n```\nProcess sample text:  \nFrom unseen text summary description of *STAT1* from Uniprot:\n```python\nstat1_uniprot = \"\"\"\nSignal transducer and transcription activator that mediates cellular responses to \ninterferons, cytokine KITLG/SCF and other cytokines and other growth factors. Following type I IFN \n(IFN-alpha and IFN-beta) binding to cell surface receptors, signaling via protein kinases leads to activation of \nJak kinases and to tyrosine phosphorylation of STAT1 and STAT2. The phosphorylated @genes dimerize and associate \nwith ISGF3G/IRF-9 to form a complex termed ISGF3 transcription factor, that enters the nucleus.\n\"\"\"\n```\nProcess the text:\n```python\nfrom generif2vec.text.util import tokenize\ntest_tokens = tokenize([stat1_uniprot])\n```\nExplore the most similar results:\n```python\ntest_vec = model.infer_vector(test_tokens[0])\nmodel.docvecs.most_similar([test_vec], topn=10)\n\n[('STAT2', 0.6756633520126343),\n ('STAT1', 0.6652628183364868),\n ('IRF9', 0.59737229347229),\n ('JAK1', 0.5927700996398926),\n ('IKBKB', 0.5757358074188232),\n ('TYK2', 0.567344069480896),\n ('IKBKE', 0.565180778503418),\n ('IFNB1', 0.5631940364837646),\n ('STAT3', 0.5513948798179626),\n ('IFNAR2', 0.5507417917251587)]\n```\n\n### Command Line Usage\nThere are currently two commands: `train-models` and `similar-genes`.\n\nTrain the Doc2vec models with different parameters.\n```bash\ngenerif2vec train-models -- --help\n```\nPredict the most similar gene for a directory of text files.\n```bash\ngenerif2vec similar-genes -- --help\n```\n\n## Abstracts stats\nNumber of unique genes with at least 10 PubMed IDs: `7704`  \nNumber of abstracts with genes having at least 10 PubMed IDs: `731,297`\n\n## Evaluation\nThe `trainer` module will evaluate document embeddings by default.\nEvaluation of the document embeddings was performed by splitting the abstracts into training and test data stratified \nby gene symbol for equal proportions of gene symbols in each set. The model was trained on the training data set and\nevaluated on the test data set.\n\n| Top 5 Accuracy | Top 10 Accuracy | Median Gene Rank | Median Similarity Difference |\n| -------------- | --------------- | ---------------- | ---------------------------- |\n| 59.1% | 64.9% | 4  | 0.049 |\n\n* `top_k accuracy`: The percentage of abstracts in the test set where the true gene label was in the top `k` most similar \npredicted gene labels. (Top `5` of `7704` = `0.06% of all gene labels`)  \n* `median gene rank`: The median ranking of the true gene label among all `7704` gene labels in the test set.  \n* `median similarity difference`: The median difference between the top ranked document similarity value (using Doc2vec \n[most_similar](https://radimrehurek.com/gensim/models/keyedvectors.html#gensim.models.keyedvectors.Doc2VecKeyedVectors.most_similar))\n and the document similarity for the true gene label.\n\n### Comparison to Gene Ontolgoy\nUse [this notebook](notebooks/go_semantic_similarity.ipynb) to compare the results of `Doc2vec` embeddings to gene similarity using \nthe molecular function branch of the Gene Ontology with [GoSemSim](https://bioconductor.org/packages/devel/bioc/vignettes/GOSemSim/inst/doc/GOSemSim.html).\n\n![STAT1](figures/stat1_gosemsim_d2v.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farvkevi%2Fgenerif2vec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farvkevi%2Fgenerif2vec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farvkevi%2Fgenerif2vec/lists"}