This script fetches literature information for a given list of SNP IDs using NCBI E-utilities, processes the information to extract diseases mentioned in the titles and abstracts, and summarizes the relevance of each SNP variant. The summarized information is saved to a CSV file.
- Python 3.8+
requests
librarybeautifulsoup4
librarypandas
libraryspacy
librarynltk
librarylxml
parser
-
Create a new conda environment:
conda create -n variant_analysis python=3.8 conda activate variant_analysis pip install requests beautifulsoup4 pandas spacy nltk lxml python -m spacy download en_core_web_sm chmod +x run.sh ./run.sh ./data/input.txt ./data/output.csv
- Fetch Literature Information:
The script fetches literature information for each SNP ID using the NCBI E-utilities API. It sends a search request to obtain the PubMed IDs (PMIDs) and then fetches the details of each publication.
- Extract Diseases from Text:
The script uses spaCy's NLP model to extract diseases mentioned in the titles and abstracts of the publications. It identifies entities labeled as "DISEASE" or "CONDITION" and also looks for specific keywords related to diseases.
- Summarize Relevance:
For each SNP ID, the script summarizes the relevance based on the diseases mentioned in the titles and abstracts. It categorizes the relevance as "High" if any diseases are mentioned; otherwise, it categorizes it as "Low".
- Save to CSV:
The summarized information is saved to a CSV file.