Skip to content

Instantly share code, notes, and snippets.

@ahwagner
Created September 26, 2018 01:17
Show Gist options
  • Save ahwagner/b439f827cb678330ea62fb49469d4e11 to your computer and use it in GitHub Desktop.
Save ahwagner/b439f827cb678330ea62fb49469d4e11 to your computer and use it in GitHub Desktop.
civic_variant_to_clinvar
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from civicpy import civic\n",
"import csv"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"vhl = civic.get_gene_by_id(58)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"with open('civic_to_clinvar_id.csv', 'w', newline='') as f:\n",
" writer = csv.writer(f)\n",
" writer.writerow(['CIViC ID', 'CIViC Name', 'ClinVar ID'])\n",
" for variant in vhl.variants:\n",
" try:\n",
" int(variant.clinvar_entries[0])\n",
" except:\n",
" continue\n",
" writer.writerow([variant.id, variant.name, variant.clinvar_entries[0]])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"gist": {
"data": {
"description": "VHL Variants with ClinVar ID.ipynb",
"public": true
},
"id": ""
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment