{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Simple showcase of the PyGeneBe library\n",
    "\n",
    "Install genebe using \n",
    "```\n",
    "pip install -U genebe\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Version:0.1.15\n"
     ]
    }
   ],
   "source": [
    "import genebe as gnb\n",
    "\n",
    "print('Version:' + gnb.__version__)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "GeneBe makes it easy to parse HGVS, dbSNP and other variants. It works with `c`, `m`, `g` and `n` representation. It does support `p` partially."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "  0%|          | 0/1 [00:00<?, ?it/s]WARNING:root:Warning: Not recognized invalid one\n",
      "100%|██████████| 1/1 [00:00<00:00,  2.14it/s]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "['1-230710021-G-A',\n",
       " '22-28695868-AG-A',\n",
       " '3-39394574-A-T',\n",
       " 'M-1243-T-C',\n",
       " '22-28695868-AG-A',\n",
       " '22-28695868-A-AG',\n",
       " '1-230710048-A-G',\n",
       " 'X-153803772-C-A',\n",
       " '7-11324574-C-T',\n",
       " '',\n",
       " '12-102894918-C-T']"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "parsed = gnb.parse_variants(['ENST00000679957.1:c.803C>T',\n",
    "                         'ENST00000404276.6:c.1100del',\n",
    "                         'NC_000003.12:g.39394574A>T',\n",
    "                         'NC_012920.1:m.1243T>C',\n",
    "                         '22 28695868 AG A',\n",
    "                         '22-28695869--G', # look, there is no ref here as this is a deletion\n",
    "                         'AGT M259T', # just gene with protein change\n",
    "                         'chrX:153803771:1:A', # SPDI\n",
    "                         'rs11', # rsID\n",
    "                         'invalid one', # invalid query, should return ''\n",
    "                         'PAH:p.Glu57Lys'] # HGVS query with protein change\n",
    "                         )\n",
    "parsed"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here is an example of annotating a list of genetic variants represented as `chr-pos-ref-alt` to the `dict` data structure."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:root:I will try to log in as ps209497@gmail.com\n",
      "100%|██████████| 1/1 [00:00<00:00,  2.79it/s]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[{'chr': '1',\n",
       "  'pos': 230710021,\n",
       "  'ref': 'G',\n",
       "  'alt': 'A',\n",
       "  'effect': 'missense_variant',\n",
       "  'transcript': 'ENST00000366667.6',\n",
       "  'consequences': 'missense_variant',\n",
       "  'gene_symbol': 'AGT',\n",
       "  'gene_hgnc_id': 333,\n",
       "  'dbsnp': 'rs1228544607',\n",
       "  'frequency_reference_population': 6.8406566e-06,\n",
       "  'hom_count_reference_population': 0,\n",
       "  'allele_count_reference_population': 10,\n",
       "  'gnomad_exomes_af': 6.840659807494376e-06,\n",
       "  'gnomad_genomes_af': None,\n",
       "  'gnomad_exomes_ac': 10,\n",
       "  'gnomad_genomes_ac': None,\n",
       "  'gnomad_exomes_homalt': 0,\n",
       "  'gnomad_genomes_homalt': None,\n",
       "  'gnomad_mito_homoplasmic': None,\n",
       "  'gnomad_mito_heteroplasmic': None,\n",
       "  'computational_score_selected': 0.14022260904312134,\n",
       "  'computational_prediction_selected': 'Benign',\n",
       "  'computational_source_selected': 'MetaRNN',\n",
       "  'splice_score_selected': 0.0,\n",
       "  'splice_prediction_selected': 'Benign',\n",
       "  'splice_source_selected': 'max_spliceai',\n",
       "  'revel_score': 0.18700000643730164,\n",
       "  'revel_prediction': 'Benign',\n",
       "  'alphamissense_score': 0.06610000133514404,\n",
       "  'alphamissense_prediction': 'Benign',\n",
       "  'bayesdelnoaf_score': -0.3700000047683716,\n",
       "  'bayesdelnoaf_prediction': 'Benign',\n",
       "  'phylop100way_score': 4.302999973297119,\n",
       "  'phylop100way_prediction': 'Uncertain_significance',\n",
       "  'spliceai_max_score': 0.0,\n",
       "  'spliceai_max_prediction': 'Benign',\n",
       "  'dbscsnv_ada_score': None,\n",
       "  'dbscsnv_ada_prediction': None,\n",
       "  'apogee2_score': None,\n",
       "  'apogee2_prediction': None,\n",
       "  'mitotip_score': None,\n",
       "  'mitotip_prediction': None,\n",
       "  'acmg_score': 0,\n",
       "  'acmg_classification': 'Uncertain_significance',\n",
       "  'acmg_criteria': 'PM2,BP4_Moderate',\n",
       "  'acmg_by_gene': [],\n",
       "  'clinvar_disease': '',\n",
       "  'clinvar_classification': '',\n",
       "  'phenotype_combined': '',\n",
       "  'pathogenicity_classification_combined': None,\n",
       "  'custom_annotations': None,\n",
       "  'hgvs_c': 'c.803C>T'},\n",
       " {'chr': '22',\n",
       "  'pos': 28695868,\n",
       "  'ref': 'AG',\n",
       "  'alt': 'A',\n",
       "  'effect': 'frameshift_variant',\n",
       "  'transcript': 'ENST00000404276.6',\n",
       "  'consequences': 'frameshift_variant',\n",
       "  'gene_symbol': 'CHEK2',\n",
       "  'gene_hgnc_id': 16627,\n",
       "  'dbsnp': 'rs555607708',\n",
       "  'frequency_reference_population': 0.0017200179,\n",
       "  'hom_count_reference_population': 0,\n",
       "  'allele_count_reference_population': 262,\n",
       "  'gnomad_exomes_af': 0.0021966800559312105,\n",
       "  'gnomad_genomes_af': 0.0017200199654325843,\n",
       "  'gnomad_exomes_ac': 3205,\n",
       "  'gnomad_genomes_ac': 262,\n",
       "  'gnomad_exomes_homalt': 5,\n",
       "  'gnomad_genomes_homalt': 0,\n",
       "  'gnomad_mito_homoplasmic': None,\n",
       "  'gnomad_mito_heteroplasmic': None,\n",
       "  'computational_score_selected': None,\n",
       "  'computational_prediction_selected': None,\n",
       "  'computational_source_selected': None,\n",
       "  'splice_score_selected': 0.009999999776482582,\n",
       "  'splice_prediction_selected': 'Benign',\n",
       "  'splice_source_selected': 'max_spliceai',\n",
       "  'revel_score': None,\n",
       "  'revel_prediction': None,\n",
       "  'alphamissense_score': None,\n",
       "  'alphamissense_prediction': None,\n",
       "  'bayesdelnoaf_score': None,\n",
       "  'bayesdelnoaf_prediction': None,\n",
       "  'phylop100way_score': 8.668000221252441,\n",
       "  'phylop100way_prediction': 'Pathogenic',\n",
       "  'spliceai_max_score': 0.009999999776482582,\n",
       "  'spliceai_max_prediction': 'Benign',\n",
       "  'dbscsnv_ada_score': None,\n",
       "  'dbscsnv_ada_prediction': None,\n",
       "  'apogee2_score': None,\n",
       "  'apogee2_prediction': None,\n",
       "  'mitotip_score': None,\n",
       "  'mitotip_prediction': None,\n",
       "  'acmg_score': 16,\n",
       "  'acmg_classification': 'Pathogenic',\n",
       "  'acmg_criteria': 'PVS1,PP5_Very_Strong',\n",
       "  'acmg_by_gene': [],\n",
       "  'clinvar_disease': 'Li-Fraumeni syndrome 2,Hereditary cancer-predisposing syndrome,Familial cancer of breast,Breast and colorectal cancer, susceptibility to,not provided,Breast neoplasm,Leiomyosarcoma,Bone osteosarcoma,Malignant tumor of prostate,Breast cancer,Inflammation of the large intestine,Thrombocytopenia,Hematochezia,Colitis,Li-Fraumeni syndrome,Astrocytoma,Malignant tumor of breast,Breast and/or ovarian cancer,Carcinoma of pancreas,Breast carcinoma,Hereditary breast ovarian cancer syndrome,Predisposition to cancer,Colorectal cancer,Li-Fraumeni syndrome 1,CHEK2-related cancer predisposition,Inherited breast cancer and ovarian cancer,Ovarian neoplasm,CHEK2-related disorder,TUMOR PREDISPOSITION SYNDROME 4, BREAST/PROSTATE/COLORECTAL,Breast-ovarian cancer, familial, 1,NICE approved PARP inhibitor treatment',\n",
       "  'clinvar_classification': 'Pathogenic',\n",
       "  'phenotype_combined': 'Li-Fraumeni syndrome 2|Hereditary cancer-predisposing syndrome|Familial cancer of breast|Breast and colorectal cancer, susceptibility to|not provided|Breast neoplasm|Leiomyosarcoma;Breast neoplasm|Familial cancer of breast;Bone osteosarcoma;Malignant tumor of prostate;Li-Fraumeni syndrome 2|Breast cancer, susceptibility to|Inflammation of the large intestine;Thrombocytopenia;Hematochezia;Colitis|Li-Fraumeni syndrome|Astrocytoma|Malignant tumor of breast|Breast and/or ovarian cancer|Carcinoma of pancreas|Breast carcinoma|Hereditary breast ovarian cancer syndrome|Predisposition to cancer|Colorectal cancer|Bone osteosarcoma|Li-Fraumeni syndrome 1|Familial cancer of breast;Malignant tumor of prostate;Colorectal cancer|CHEK2-related cancer predisposition|Inherited breast cancer and ovarian cancer|Ovarian neoplasm|Malignant tumor of prostate|CHEK2-related disorder|TUMOR PREDISPOSITION SYNDROME 4, BREAST/PROSTATE/COLORECTAL|Breast-ovarian cancer, familial, susceptibility to, 1|NICE approved PARP inhibitor treatment',\n",
       "  'pathogenicity_classification_combined': 'Pathogenic',\n",
       "  'custom_annotations': None,\n",
       "  'hgvs_c': 'c.1100delC'},\n",
       " {'chr': '3',\n",
       "  'pos': 39394574,\n",
       "  'ref': 'A',\n",
       "  'alt': 'T',\n",
       "  'effect': 'stop_gained,splice_region_variant',\n",
       "  'transcript': 'ENST00000650617.1',\n",
       "  'consequences': 'stop_gained,splice_region_variant',\n",
       "  'gene_symbol': 'SLC25A38',\n",
       "  'gene_hgnc_id': 26054,\n",
       "  'dbsnp': 'rs121918332',\n",
       "  'frequency_reference_population': 1.3681538e-06,\n",
       "  'hom_count_reference_population': 0,\n",
       "  'allele_count_reference_population': 2,\n",
       "  'gnomad_exomes_af': 1.368150037706073e-06,\n",
       "  'gnomad_genomes_af': None,\n",
       "  'gnomad_exomes_ac': 2,\n",
       "  'gnomad_genomes_ac': None,\n",
       "  'gnomad_exomes_homalt': 0,\n",
       "  'gnomad_genomes_homalt': None,\n",
       "  'gnomad_mito_homoplasmic': None,\n",
       "  'gnomad_mito_heteroplasmic': None,\n",
       "  'computational_score_selected': 0.5899999737739563,\n",
       "  'computational_prediction_selected': 'Pathogenic',\n",
       "  'computational_source_selected': 'BayesDel_noAF',\n",
       "  'splice_score_selected': 0.9039999842643738,\n",
       "  'splice_prediction_selected': 'Pathogenic',\n",
       "  'splice_source_selected': 'dbscSNV1_RF',\n",
       "  'revel_score': None,\n",
       "  'revel_prediction': None,\n",
       "  'alphamissense_score': None,\n",
       "  'alphamissense_prediction': None,\n",
       "  'bayesdelnoaf_score': 0.5899999737739563,\n",
       "  'bayesdelnoaf_prediction': 'Pathogenic',\n",
       "  'phylop100way_score': 4.756999969482422,\n",
       "  'phylop100way_prediction': 'Uncertain_significance',\n",
       "  'spliceai_max_score': 0.029999999329447746,\n",
       "  'spliceai_max_prediction': 'Benign',\n",
       "  'dbscsnv_ada_score': 0.9972096085548401,\n",
       "  'dbscsnv_ada_prediction': 'Pathogenic',\n",
       "  'apogee2_score': None,\n",
       "  'apogee2_prediction': None,\n",
       "  'mitotip_score': None,\n",
       "  'mitotip_prediction': None,\n",
       "  'acmg_score': 9,\n",
       "  'acmg_classification': 'Likely_pathogenic',\n",
       "  'acmg_criteria': 'PVS1_Strong,PM2,PP3,PP5_Moderate',\n",
       "  'acmg_by_gene': [],\n",
       "  'clinvar_disease': 'Sideroblastic anemia 2',\n",
       "  'clinvar_classification': 'Pathogenic',\n",
       "  'phenotype_combined': 'Sideroblastic anemia 2',\n",
       "  'pathogenicity_classification_combined': 'Pathogenic',\n",
       "  'custom_annotations': None,\n",
       "  'hgvs_c': 'c.790A>T'},\n",
       " {'chr': 'M',\n",
       "  'pos': 1243,\n",
       "  'ref': 'T',\n",
       "  'alt': 'C',\n",
       "  'effect': '',\n",
       "  'transcript': None,\n",
       "  'consequences': [],\n",
       "  'gene_symbol': None,\n",
       "  'gene_hgnc_id': None,\n",
       "  'dbsnp': 'rs28358572',\n",
       "  'frequency_reference_population': 0.0159,\n",
       "  'hom_count_reference_population': 975,\n",
       "  'allele_count_reference_population': 975,\n",
       "  'gnomad_exomes_af': None,\n",
       "  'gnomad_genomes_af': None,\n",
       "  'gnomad_exomes_ac': None,\n",
       "  'gnomad_genomes_ac': None,\n",
       "  'gnomad_exomes_homalt': None,\n",
       "  'gnomad_genomes_homalt': None,\n",
       "  'gnomad_mito_homoplasmic': 839,\n",
       "  'gnomad_mito_heteroplasmic': 1,\n",
       "  'computational_score_selected': None,\n",
       "  'computational_prediction_selected': None,\n",
       "  'computational_source_selected': None,\n",
       "  'splice_score_selected': None,\n",
       "  'splice_prediction_selected': None,\n",
       "  'splice_source_selected': None,\n",
       "  'revel_score': None,\n",
       "  'revel_prediction': None,\n",
       "  'alphamissense_score': None,\n",
       "  'alphamissense_prediction': None,\n",
       "  'bayesdelnoaf_score': None,\n",
       "  'bayesdelnoaf_prediction': None,\n",
       "  'phylop100way_score': -1.902999997138977,\n",
       "  'phylop100way_prediction': 'Benign',\n",
       "  'spliceai_max_score': None,\n",
       "  'spliceai_max_prediction': None,\n",
       "  'dbscsnv_ada_score': None,\n",
       "  'dbscsnv_ada_prediction': None,\n",
       "  'apogee2_score': None,\n",
       "  'apogee2_prediction': None,\n",
       "  'mitotip_score': None,\n",
       "  'mitotip_prediction': None,\n",
       "  'acmg_score': -16,\n",
       "  'acmg_classification': 'Benign',\n",
       "  'acmg_criteria': 'BP6_Very_Strong,BA1',\n",
       "  'acmg_by_gene': [],\n",
       "  'clinvar_disease': 'not provided,not specified',\n",
       "  'clinvar_classification': 'Benign',\n",
       "  'phenotype_combined': 'not provided|not specified',\n",
       "  'pathogenicity_classification_combined': 'Benign',\n",
       "  'custom_annotations': None},\n",
       " {'chr': '22',\n",
       "  'pos': 28695868,\n",
       "  'ref': 'AG',\n",
       "  'alt': 'A',\n",
       "  'effect': 'frameshift_variant',\n",
       "  'transcript': 'ENST00000404276.6',\n",
       "  'consequences': 'frameshift_variant',\n",
       "  'gene_symbol': 'CHEK2',\n",
       "  'gene_hgnc_id': 16627,\n",
       "  'dbsnp': 'rs555607708',\n",
       "  'frequency_reference_population': 0.0017200179,\n",
       "  'hom_count_reference_population': 0,\n",
       "  'allele_count_reference_population': 262,\n",
       "  'gnomad_exomes_af': 0.0021966800559312105,\n",
       "  'gnomad_genomes_af': 0.0017200199654325843,\n",
       "  'gnomad_exomes_ac': 3205,\n",
       "  'gnomad_genomes_ac': 262,\n",
       "  'gnomad_exomes_homalt': 5,\n",
       "  'gnomad_genomes_homalt': 0,\n",
       "  'gnomad_mito_homoplasmic': None,\n",
       "  'gnomad_mito_heteroplasmic': None,\n",
       "  'computational_score_selected': None,\n",
       "  'computational_prediction_selected': None,\n",
       "  'computational_source_selected': None,\n",
       "  'splice_score_selected': 0.009999999776482582,\n",
       "  'splice_prediction_selected': 'Benign',\n",
       "  'splice_source_selected': 'max_spliceai',\n",
       "  'revel_score': None,\n",
       "  'revel_prediction': None,\n",
       "  'alphamissense_score': None,\n",
       "  'alphamissense_prediction': None,\n",
       "  'bayesdelnoaf_score': None,\n",
       "  'bayesdelnoaf_prediction': None,\n",
       "  'phylop100way_score': 8.668000221252441,\n",
       "  'phylop100way_prediction': 'Pathogenic',\n",
       "  'spliceai_max_score': 0.009999999776482582,\n",
       "  'spliceai_max_prediction': 'Benign',\n",
       "  'dbscsnv_ada_score': None,\n",
       "  'dbscsnv_ada_prediction': None,\n",
       "  'apogee2_score': None,\n",
       "  'apogee2_prediction': None,\n",
       "  'mitotip_score': None,\n",
       "  'mitotip_prediction': None,\n",
       "  'acmg_score': 16,\n",
       "  'acmg_classification': 'Pathogenic',\n",
       "  'acmg_criteria': 'PVS1,PP5_Very_Strong',\n",
       "  'acmg_by_gene': [],\n",
       "  'clinvar_disease': 'Li-Fraumeni syndrome 2,Hereditary cancer-predisposing syndrome,Familial cancer of breast,Breast and colorectal cancer, susceptibility to,not provided,Breast neoplasm,Leiomyosarcoma,Bone osteosarcoma,Malignant tumor of prostate,Breast cancer,Inflammation of the large intestine,Thrombocytopenia,Hematochezia,Colitis,Li-Fraumeni syndrome,Astrocytoma,Malignant tumor of breast,Breast and/or ovarian cancer,Carcinoma of pancreas,Breast carcinoma,Hereditary breast ovarian cancer syndrome,Predisposition to cancer,Colorectal cancer,Li-Fraumeni syndrome 1,CHEK2-related cancer predisposition,Inherited breast cancer and ovarian cancer,Ovarian neoplasm,CHEK2-related disorder,TUMOR PREDISPOSITION SYNDROME 4, BREAST/PROSTATE/COLORECTAL,Breast-ovarian cancer, familial, 1,NICE approved PARP inhibitor treatment',\n",
       "  'clinvar_classification': 'Pathogenic',\n",
       "  'phenotype_combined': 'Li-Fraumeni syndrome 2|Hereditary cancer-predisposing syndrome|Familial cancer of breast|Breast and colorectal cancer, susceptibility to|not provided|Breast neoplasm|Leiomyosarcoma;Breast neoplasm|Familial cancer of breast;Bone osteosarcoma;Malignant tumor of prostate;Li-Fraumeni syndrome 2|Breast cancer, susceptibility to|Inflammation of the large intestine;Thrombocytopenia;Hematochezia;Colitis|Li-Fraumeni syndrome|Astrocytoma|Malignant tumor of breast|Breast and/or ovarian cancer|Carcinoma of pancreas|Breast carcinoma|Hereditary breast ovarian cancer syndrome|Predisposition to cancer|Colorectal cancer|Bone osteosarcoma|Li-Fraumeni syndrome 1|Familial cancer of breast;Malignant tumor of prostate;Colorectal cancer|CHEK2-related cancer predisposition|Inherited breast cancer and ovarian cancer|Ovarian neoplasm|Malignant tumor of prostate|CHEK2-related disorder|TUMOR PREDISPOSITION SYNDROME 4, BREAST/PROSTATE/COLORECTAL|Breast-ovarian cancer, familial, susceptibility to, 1|NICE approved PARP inhibitor treatment',\n",
       "  'pathogenicity_classification_combined': 'Pathogenic',\n",
       "  'custom_annotations': None,\n",
       "  'hgvs_c': 'c.1100delC'},\n",
       " {'chr': '22',\n",
       "  'pos': 28695868,\n",
       "  'ref': 'A',\n",
       "  'alt': 'AG',\n",
       "  'effect': 'frameshift_variant',\n",
       "  'transcript': 'ENST00000404276.6',\n",
       "  'consequences': 'frameshift_variant',\n",
       "  'gene_symbol': 'CHEK2',\n",
       "  'gene_hgnc_id': 16627,\n",
       "  'dbsnp': 'rs2052566665',\n",
       "  'frequency_reference_population': None,\n",
       "  'hom_count_reference_population': 0,\n",
       "  'allele_count_reference_population': 0,\n",
       "  'gnomad_exomes_af': None,\n",
       "  'gnomad_genomes_af': None,\n",
       "  'gnomad_exomes_ac': None,\n",
       "  'gnomad_genomes_ac': None,\n",
       "  'gnomad_exomes_homalt': None,\n",
       "  'gnomad_genomes_homalt': None,\n",
       "  'gnomad_mito_homoplasmic': None,\n",
       "  'gnomad_mito_heteroplasmic': None,\n",
       "  'computational_score_selected': None,\n",
       "  'computational_prediction_selected': None,\n",
       "  'computational_source_selected': None,\n",
       "  'splice_score_selected': 0.0,\n",
       "  'splice_prediction_selected': 'Benign',\n",
       "  'splice_source_selected': 'max_spliceai',\n",
       "  'revel_score': None,\n",
       "  'revel_prediction': None,\n",
       "  'alphamissense_score': None,\n",
       "  'alphamissense_prediction': None,\n",
       "  'bayesdelnoaf_score': None,\n",
       "  'bayesdelnoaf_prediction': None,\n",
       "  'phylop100way_score': 8.668000221252441,\n",
       "  'phylop100way_prediction': 'Pathogenic',\n",
       "  'spliceai_max_score': 0.0,\n",
       "  'spliceai_max_prediction': 'Benign',\n",
       "  'dbscsnv_ada_score': None,\n",
       "  'dbscsnv_ada_prediction': None,\n",
       "  'apogee2_score': None,\n",
       "  'apogee2_prediction': None,\n",
       "  'mitotip_score': None,\n",
       "  'mitotip_prediction': None,\n",
       "  'acmg_score': 12,\n",
       "  'acmg_classification': 'Pathogenic',\n",
       "  'acmg_criteria': 'PVS1,PM2,PP5_Moderate',\n",
       "  'acmg_by_gene': [],\n",
       "  'clinvar_disease': 'Hereditary cancer-predisposing syndrome',\n",
       "  'clinvar_classification': 'Pathogenic',\n",
       "  'phenotype_combined': 'Hereditary cancer-predisposing syndrome',\n",
       "  'pathogenicity_classification_combined': 'Pathogenic',\n",
       "  'custom_annotations': None,\n",
       "  'hgvs_c': 'c.1100dupC'},\n",
       " {'chr': '1',\n",
       "  'pos': 230710048,\n",
       "  'ref': 'A',\n",
       "  'alt': 'G',\n",
       "  'effect': 'missense_variant',\n",
       "  'transcript': 'ENST00000366667.6',\n",
       "  'consequences': 'missense_variant',\n",
       "  'gene_symbol': 'AGT',\n",
       "  'gene_hgnc_id': 333,\n",
       "  'dbsnp': 'rs699',\n",
       "  'frequency_reference_population': 0.46934396,\n",
       "  'hom_count_reference_population': 191182,\n",
       "  'allele_count_reference_population': 757462,\n",
       "  'gnomad_exomes_af': 0.4580099880695343,\n",
       "  'gnomad_genomes_af': 0.5782089829444885,\n",
       "  'gnomad_exomes_ac': 669469,\n",
       "  'gnomad_genomes_ac': 87993,\n",
       "  'gnomad_exomes_homalt': 163148,\n",
       "  'gnomad_genomes_homalt': 28034,\n",
       "  'gnomad_mito_homoplasmic': None,\n",
       "  'gnomad_mito_heteroplasmic': None,\n",
       "  'computational_score_selected': 8.121764949464705e-07,\n",
       "  'computational_prediction_selected': 'Benign',\n",
       "  'computational_source_selected': 'MetaRNN',\n",
       "  'splice_score_selected': 0.0,\n",
       "  'splice_prediction_selected': 'Benign',\n",
       "  'splice_source_selected': 'max_spliceai',\n",
       "  'revel_score': 0.15700000524520874,\n",
       "  'revel_prediction': 'Benign',\n",
       "  'alphamissense_score': 0.054099999368190765,\n",
       "  'alphamissense_prediction': 'Benign',\n",
       "  'bayesdelnoaf_score': -0.5400000214576721,\n",
       "  'bayesdelnoaf_prediction': 'Benign',\n",
       "  'phylop100way_score': 0.5139999985694885,\n",
       "  'phylop100way_prediction': 'Benign',\n",
       "  'spliceai_max_score': 0.0,\n",
       "  'spliceai_max_prediction': 'Benign',\n",
       "  'dbscsnv_ada_score': None,\n",
       "  'dbscsnv_ada_prediction': None,\n",
       "  'apogee2_score': None,\n",
       "  'apogee2_prediction': None,\n",
       "  'mitotip_score': None,\n",
       "  'mitotip_prediction': None,\n",
       "  'acmg_score': -20,\n",
       "  'acmg_classification': 'Benign',\n",
       "  'acmg_criteria': 'BP4_Strong,BP6_Very_Strong,BA1',\n",
       "  'acmg_by_gene': [],\n",
       "  'clinvar_disease': 'Hypertension, essential, susceptibility to,not specified,Renal tubular dysgenesis,not provided,Hypertensive disorder',\n",
       "  'clinvar_classification': 'Benign',\n",
       "  'phenotype_combined': 'Hypertension, essential, susceptibility to|not specified|Renal tubular dysgenesis|not provided|Hypertensive disorder',\n",
       "  'pathogenicity_classification_combined': 'Benign',\n",
       "  'custom_annotations': None,\n",
       "  'hgvs_c': 'c.776T>C'},\n",
       " {'chr': 'X',\n",
       "  'pos': 153803772,\n",
       "  'ref': 'C',\n",
       "  'alt': 'A',\n",
       "  'effect': 'missense_variant',\n",
       "  'transcript': 'ENST00000393758.7',\n",
       "  'consequences': 'missense_variant',\n",
       "  'gene_symbol': 'PDZD4',\n",
       "  'gene_hgnc_id': 21167,\n",
       "  'dbsnp': None,\n",
       "  'frequency_reference_population': None,\n",
       "  'hom_count_reference_population': 0,\n",
       "  'allele_count_reference_population': 0,\n",
       "  'gnomad_exomes_af': None,\n",
       "  'gnomad_genomes_af': None,\n",
       "  'gnomad_exomes_ac': None,\n",
       "  'gnomad_genomes_ac': None,\n",
       "  'gnomad_exomes_homalt': None,\n",
       "  'gnomad_genomes_homalt': None,\n",
       "  'gnomad_mito_homoplasmic': None,\n",
       "  'gnomad_mito_heteroplasmic': None,\n",
       "  'computational_score_selected': 0.8714672327041626,\n",
       "  'computational_prediction_selected': 'Pathogenic',\n",
       "  'computational_source_selected': 'MetaRNN',\n",
       "  'splice_score_selected': 0.0,\n",
       "  'splice_prediction_selected': 'Benign',\n",
       "  'splice_source_selected': 'max_spliceai',\n",
       "  'revel_score': 0.6700000166893005,\n",
       "  'revel_prediction': 'Pathogenic',\n",
       "  'alphamissense_score': 0.998199999332428,\n",
       "  'alphamissense_prediction': 'Pathogenic',\n",
       "  'bayesdelnoaf_score': 0.25,\n",
       "  'bayesdelnoaf_prediction': 'Pathogenic',\n",
       "  'phylop100way_score': 6.0970001220703125,\n",
       "  'phylop100way_prediction': 'Uncertain_significance',\n",
       "  'spliceai_max_score': 0.0,\n",
       "  'spliceai_max_prediction': 'Benign',\n",
       "  'dbscsnv_ada_score': None,\n",
       "  'dbscsnv_ada_prediction': None,\n",
       "  'apogee2_score': None,\n",
       "  'apogee2_prediction': None,\n",
       "  'mitotip_score': None,\n",
       "  'mitotip_prediction': None,\n",
       "  'acmg_score': 4,\n",
       "  'acmg_classification': 'Uncertain_significance',\n",
       "  'acmg_criteria': 'PM2,PP3_Moderate',\n",
       "  'acmg_by_gene': [],\n",
       "  'clinvar_disease': '',\n",
       "  'clinvar_classification': '',\n",
       "  'phenotype_combined': '',\n",
       "  'pathogenicity_classification_combined': None,\n",
       "  'custom_annotations': None,\n",
       "  'hgvs_c': 'c.1909G>T'},\n",
       " {'chr': '7',\n",
       "  'pos': 11324574,\n",
       "  'ref': 'C',\n",
       "  'alt': 'T',\n",
       "  'effect': 'intron_variant',\n",
       "  'transcript': 'ENST00000421121.5',\n",
       "  'consequences': 'intron_variant',\n",
       "  'gene_symbol': 'ENSG00000230333',\n",
       "  'gene_hgnc_id': None,\n",
       "  'dbsnp': 'rs11',\n",
       "  'frequency_reference_population': 0.0005984165,\n",
       "  'hom_count_reference_population': 0,\n",
       "  'allele_count_reference_population': 91,\n",
       "  'gnomad_exomes_af': None,\n",
       "  'gnomad_genomes_af': 0.0005984160234220326,\n",
       "  'gnomad_exomes_ac': None,\n",
       "  'gnomad_genomes_ac': 91,\n",
       "  'gnomad_exomes_homalt': None,\n",
       "  'gnomad_genomes_homalt': 0,\n",
       "  'gnomad_mito_homoplasmic': None,\n",
       "  'gnomad_mito_heteroplasmic': None,\n",
       "  'computational_score_selected': -0.9599999785423279,\n",
       "  'computational_prediction_selected': 'Benign',\n",
       "  'computational_source_selected': 'BayesDel_noAF',\n",
       "  'splice_score_selected': None,\n",
       "  'splice_prediction_selected': None,\n",
       "  'splice_source_selected': None,\n",
       "  'revel_score': None,\n",
       "  'revel_prediction': None,\n",
       "  'alphamissense_score': None,\n",
       "  'alphamissense_prediction': None,\n",
       "  'bayesdelnoaf_score': -0.9599999785423279,\n",
       "  'bayesdelnoaf_prediction': 'Benign',\n",
       "  'phylop100way_score': -2.007999897003174,\n",
       "  'phylop100way_prediction': 'Benign',\n",
       "  'spliceai_max_score': None,\n",
       "  'spliceai_max_prediction': None,\n",
       "  'dbscsnv_ada_score': None,\n",
       "  'dbscsnv_ada_prediction': None,\n",
       "  'apogee2_score': None,\n",
       "  'apogee2_prediction': None,\n",
       "  'mitotip_score': None,\n",
       "  'mitotip_prediction': None,\n",
       "  'acmg_score': -2,\n",
       "  'acmg_classification': 'Likely_benign',\n",
       "  'acmg_criteria': 'PM2,BP4_Strong',\n",
       "  'acmg_by_gene': [],\n",
       "  'clinvar_disease': '',\n",
       "  'clinvar_classification': '',\n",
       "  'phenotype_combined': '',\n",
       "  'pathogenicity_classification_combined': None,\n",
       "  'custom_annotations': None,\n",
       "  'hgvs_c': 'n.114-54713C>T'},\n",
       " {'chr': None,\n",
       "  'pos': None,\n",
       "  'ref': None,\n",
       "  'alt': None,\n",
       "  'effect': '',\n",
       "  'transcript': None,\n",
       "  'consequences': [],\n",
       "  'gene_symbol': None,\n",
       "  'gene_hgnc_id': None,\n",
       "  'dbsnp': None,\n",
       "  'frequency_reference_population': None,\n",
       "  'hom_count_reference_population': None,\n",
       "  'allele_count_reference_population': None,\n",
       "  'gnomad_exomes_af': None,\n",
       "  'gnomad_genomes_af': None,\n",
       "  'gnomad_exomes_ac': None,\n",
       "  'gnomad_genomes_ac': None,\n",
       "  'gnomad_exomes_homalt': None,\n",
       "  'gnomad_genomes_homalt': None,\n",
       "  'gnomad_mito_homoplasmic': None,\n",
       "  'gnomad_mito_heteroplasmic': None,\n",
       "  'computational_score_selected': None,\n",
       "  'computational_prediction_selected': None,\n",
       "  'computational_source_selected': None,\n",
       "  'splice_score_selected': None,\n",
       "  'splice_prediction_selected': None,\n",
       "  'splice_source_selected': None,\n",
       "  'revel_score': None,\n",
       "  'revel_prediction': None,\n",
       "  'alphamissense_score': None,\n",
       "  'alphamissense_prediction': None,\n",
       "  'bayesdelnoaf_score': None,\n",
       "  'bayesdelnoaf_prediction': None,\n",
       "  'phylop100way_score': None,\n",
       "  'phylop100way_prediction': None,\n",
       "  'spliceai_max_score': None,\n",
       "  'spliceai_max_prediction': None,\n",
       "  'dbscsnv_ada_score': None,\n",
       "  'dbscsnv_ada_prediction': None,\n",
       "  'apogee2_score': None,\n",
       "  'apogee2_prediction': None,\n",
       "  'mitotip_score': None,\n",
       "  'mitotip_prediction': None,\n",
       "  'acmg_score': None,\n",
       "  'acmg_classification': None,\n",
       "  'acmg_criteria': '',\n",
       "  'acmg_by_gene': [],\n",
       "  'clinvar_disease': None,\n",
       "  'clinvar_classification': None,\n",
       "  'phenotype_combined': '',\n",
       "  'pathogenicity_classification_combined': None,\n",
       "  'custom_annotations': None},\n",
       " {'chr': '12',\n",
       "  'pos': 102894918,\n",
       "  'ref': 'C',\n",
       "  'alt': 'T',\n",
       "  'effect': 'missense_variant,splice_region_variant',\n",
       "  'transcript': 'ENST00000553106.6',\n",
       "  'consequences': 'missense_variant,splice_region_variant',\n",
       "  'gene_symbol': 'PAH',\n",
       "  'gene_hgnc_id': 8582,\n",
       "  'dbsnp': 'rs140945592',\n",
       "  'frequency_reference_population': 1.9234993e-05,\n",
       "  'hom_count_reference_population': 0,\n",
       "  'allele_count_reference_population': 31,\n",
       "  'gnomad_exomes_af': 2.0553599824779667e-05,\n",
       "  'gnomad_genomes_af': 6.576869964192156e-06,\n",
       "  'gnomad_exomes_ac': 30,\n",
       "  'gnomad_genomes_ac': 1,\n",
       "  'gnomad_exomes_homalt': 0,\n",
       "  'gnomad_genomes_homalt': 0,\n",
       "  'gnomad_mito_homoplasmic': None,\n",
       "  'gnomad_mito_heteroplasmic': None,\n",
       "  'computational_score_selected': 0.5768682360649109,\n",
       "  'computational_prediction_selected': 'Uncertain_significance',\n",
       "  'computational_source_selected': 'MetaRNN',\n",
       "  'splice_score_selected': 0.843999981880188,\n",
       "  'splice_prediction_selected': 'Pathogenic',\n",
       "  'splice_source_selected': 'dbscSNV1_RF',\n",
       "  'revel_score': 0.5070000290870667,\n",
       "  'revel_prediction': 'Uncertain_significance',\n",
       "  'alphamissense_score': 0.11500000208616257,\n",
       "  'alphamissense_prediction': 'Benign',\n",
       "  'bayesdelnoaf_score': 0.1899999976158142,\n",
       "  'bayesdelnoaf_prediction': 'Pathogenic',\n",
       "  'phylop100way_score': 5.27400016784668,\n",
       "  'phylop100way_prediction': 'Uncertain_significance',\n",
       "  'spliceai_max_score': 0.6399999856948853,\n",
       "  'spliceai_max_prediction': 'Pathogenic',\n",
       "  'dbscsnv_ada_score': 0.9995666146278381,\n",
       "  'dbscsnv_ada_prediction': 'Pathogenic',\n",
       "  'apogee2_score': None,\n",
       "  'apogee2_prediction': None,\n",
       "  'mitotip_score': None,\n",
       "  'mitotip_prediction': None,\n",
       "  'acmg_score': 5,\n",
       "  'acmg_classification': 'Uncertain_significance',\n",
       "  'acmg_criteria': 'PM2,PP4_Moderate,PM3_Supporting',\n",
       "  'acmg_by_gene': [],\n",
       "  'clinvar_disease': 'not provided,Phenylketonuria',\n",
       "  'clinvar_classification': 'Uncertain significance',\n",
       "  'phenotype_combined': 'not provided|Phenylketonuria',\n",
       "  'pathogenicity_classification_combined': 'Uncertain significance',\n",
       "  'custom_annotations': None,\n",
       "  'hgvs_c': 'c.169G>A'}]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "flat = gnb.annotate(parsed, flatten_consequences=True, use_refseq=False, output_format=\"list\")\n",
    "flat"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "It is natural to work with a lists of data in represented as Pandas dataframe. Here is an example of annotating a list of variants to the Pandas dataframe. In the `clingen-erepo.ipynb` example file you can find more examples of annotating and joining variants using Pandas."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1/1 [00:00<00:00,  3.36it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Index(['chr', 'pos', 'ref', 'alt', 'effect', 'transcript', 'consequences',\n",
      "       'gene_symbol', 'gene_hgnc_id', 'dbsnp',\n",
      "       'frequency_reference_population', 'hom_count_reference_population',\n",
      "       'allele_count_reference_population', 'gnomad_exomes_af',\n",
      "       'gnomad_genomes_af', 'gnomad_exomes_ac', 'gnomad_genomes_ac',\n",
      "       'gnomad_exomes_homalt', 'gnomad_genomes_homalt',\n",
      "       'gnomad_mito_homoplasmic', 'gnomad_mito_heteroplasmic',\n",
      "       'computational_score_selected', 'computational_prediction_selected',\n",
      "       'computational_source_selected', 'splice_score_selected',\n",
      "       'splice_prediction_selected', 'splice_source_selected', 'revel_score',\n",
      "       'revel_prediction', 'alphamissense_score', 'alphamissense_prediction',\n",
      "       'bayesdelnoaf_score', 'bayesdelnoaf_prediction', 'phylop100way_score',\n",
      "       'phylop100way_prediction', 'spliceai_max_score',\n",
      "       'spliceai_max_prediction', 'dbscsnv_ada_score',\n",
      "       'dbscsnv_ada_prediction', 'apogee2_score', 'apogee2_prediction',\n",
      "       'mitotip_score', 'mitotip_prediction', 'acmg_score',\n",
      "       'acmg_classification', 'acmg_criteria', 'acmg_by_gene',\n",
      "       'clinvar_disease', 'clinvar_classification', 'phenotype_combined',\n",
      "       'pathogenicity_classification_combined', 'custom_annotations',\n",
      "       'hgvs_c'],\n",
      "      dtype='object')\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>chr</th>\n",
       "      <th>pos</th>\n",
       "      <th>ref</th>\n",
       "      <th>alt</th>\n",
       "      <th>effect</th>\n",
       "      <th>transcript</th>\n",
       "      <th>consequences</th>\n",
       "      <th>gene_symbol</th>\n",
       "      <th>gene_hgnc_id</th>\n",
       "      <th>dbsnp</th>\n",
       "      <th>...</th>\n",
       "      <th>acmg_score</th>\n",
       "      <th>acmg_classification</th>\n",
       "      <th>acmg_criteria</th>\n",
       "      <th>acmg_by_gene</th>\n",
       "      <th>clinvar_disease</th>\n",
       "      <th>clinvar_classification</th>\n",
       "      <th>phenotype_combined</th>\n",
       "      <th>pathogenicity_classification_combined</th>\n",
       "      <th>custom_annotations</th>\n",
       "      <th>hgvs_c</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>230710021.0</td>\n",
       "      <td>G</td>\n",
       "      <td>A</td>\n",
       "      <td>missense_variant</td>\n",
       "      <td>NM_001384479.1</td>\n",
       "      <td>missense_variant</td>\n",
       "      <td>AGT</td>\n",
       "      <td>333.0</td>\n",
       "      <td>rs1228544607</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>Uncertain_significance</td>\n",
       "      <td>PM2,BP4_Moderate</td>\n",
       "      <td>[]</td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>c.803C&gt;T</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>22</td>\n",
       "      <td>28695868.0</td>\n",
       "      <td>AG</td>\n",
       "      <td>A</td>\n",
       "      <td>frameshift_variant</td>\n",
       "      <td>NM_007194.4</td>\n",
       "      <td>frameshift_variant</td>\n",
       "      <td>CHEK2</td>\n",
       "      <td>16627.0</td>\n",
       "      <td>rs555607708</td>\n",
       "      <td>...</td>\n",
       "      <td>16.0</td>\n",
       "      <td>Pathogenic</td>\n",
       "      <td>PVS1,PP5_Very_Strong</td>\n",
       "      <td>[]</td>\n",
       "      <td>Li-Fraumeni syndrome 2,Hereditary cancer-predi...</td>\n",
       "      <td>Pathogenic</td>\n",
       "      <td>Li-Fraumeni syndrome 2|Hereditary cancer-predi...</td>\n",
       "      <td>Pathogenic</td>\n",
       "      <td>None</td>\n",
       "      <td>c.1100delC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>39394574.0</td>\n",
       "      <td>A</td>\n",
       "      <td>T</td>\n",
       "      <td>stop_gained,splice_region_variant</td>\n",
       "      <td>NM_017875.4</td>\n",
       "      <td>stop_gained,splice_region_variant</td>\n",
       "      <td>SLC25A38</td>\n",
       "      <td>26054.0</td>\n",
       "      <td>rs121918332</td>\n",
       "      <td>...</td>\n",
       "      <td>9.0</td>\n",
       "      <td>Likely_pathogenic</td>\n",
       "      <td>PVS1_Strong,PM2,PP3,PP5_Moderate</td>\n",
       "      <td>[]</td>\n",
       "      <td>Sideroblastic anemia 2</td>\n",
       "      <td>Pathogenic</td>\n",
       "      <td>Sideroblastic anemia 2</td>\n",
       "      <td>Pathogenic</td>\n",
       "      <td>None</td>\n",
       "      <td>c.790A&gt;T</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>M</td>\n",
       "      <td>1243.0</td>\n",
       "      <td>T</td>\n",
       "      <td>C</td>\n",
       "      <td>non_coding_transcript_exon_variant</td>\n",
       "      <td>None</td>\n",
       "      <td>[{'protein_coding': False, 'consequences': ['n...</td>\n",
       "      <td>RNR1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>rs28358572</td>\n",
       "      <td>...</td>\n",
       "      <td>-16.0</td>\n",
       "      <td>Benign</td>\n",
       "      <td>BP6_Very_Strong,BA1</td>\n",
       "      <td>[]</td>\n",
       "      <td>not provided,not specified</td>\n",
       "      <td>Benign</td>\n",
       "      <td>not provided|not specified</td>\n",
       "      <td>Benign</td>\n",
       "      <td>None</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>22</td>\n",
       "      <td>28695868.0</td>\n",
       "      <td>AG</td>\n",
       "      <td>A</td>\n",
       "      <td>frameshift_variant</td>\n",
       "      <td>NM_007194.4</td>\n",
       "      <td>frameshift_variant</td>\n",
       "      <td>CHEK2</td>\n",
       "      <td>16627.0</td>\n",
       "      <td>rs555607708</td>\n",
       "      <td>...</td>\n",
       "      <td>16.0</td>\n",
       "      <td>Pathogenic</td>\n",
       "      <td>PVS1,PP5_Very_Strong</td>\n",
       "      <td>[]</td>\n",
       "      <td>Li-Fraumeni syndrome 2,Hereditary cancer-predi...</td>\n",
       "      <td>Pathogenic</td>\n",
       "      <td>Li-Fraumeni syndrome 2|Hereditary cancer-predi...</td>\n",
       "      <td>Pathogenic</td>\n",
       "      <td>None</td>\n",
       "      <td>c.1100delC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>22</td>\n",
       "      <td>28695868.0</td>\n",
       "      <td>A</td>\n",
       "      <td>AG</td>\n",
       "      <td>frameshift_variant</td>\n",
       "      <td>NM_007194.4</td>\n",
       "      <td>frameshift_variant</td>\n",
       "      <td>CHEK2</td>\n",
       "      <td>16627.0</td>\n",
       "      <td>rs2052566665</td>\n",
       "      <td>...</td>\n",
       "      <td>12.0</td>\n",
       "      <td>Pathogenic</td>\n",
       "      <td>PVS1,PM2,PP5_Moderate</td>\n",
       "      <td>[]</td>\n",
       "      <td>Hereditary cancer-predisposing syndrome</td>\n",
       "      <td>Pathogenic</td>\n",
       "      <td>Hereditary cancer-predisposing syndrome</td>\n",
       "      <td>Pathogenic</td>\n",
       "      <td>None</td>\n",
       "      <td>c.1100dupC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1</td>\n",
       "      <td>230710048.0</td>\n",
       "      <td>A</td>\n",
       "      <td>G</td>\n",
       "      <td>missense_variant</td>\n",
       "      <td>NM_001384479.1</td>\n",
       "      <td>missense_variant</td>\n",
       "      <td>AGT</td>\n",
       "      <td>333.0</td>\n",
       "      <td>rs699</td>\n",
       "      <td>...</td>\n",
       "      <td>-20.0</td>\n",
       "      <td>Benign</td>\n",
       "      <td>BP4_Strong,BP6_Very_Strong,BA1</td>\n",
       "      <td>[]</td>\n",
       "      <td>Hypertension, essential, susceptibility to,not...</td>\n",
       "      <td>Benign</td>\n",
       "      <td>Hypertension, essential, susceptibility to|not...</td>\n",
       "      <td>Benign</td>\n",
       "      <td>None</td>\n",
       "      <td>c.776T&gt;C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>X</td>\n",
       "      <td>153803772.0</td>\n",
       "      <td>C</td>\n",
       "      <td>A</td>\n",
       "      <td>missense_variant</td>\n",
       "      <td>NM_001303512.2</td>\n",
       "      <td>missense_variant</td>\n",
       "      <td>PDZD4</td>\n",
       "      <td>21167.0</td>\n",
       "      <td>None</td>\n",
       "      <td>...</td>\n",
       "      <td>4.0</td>\n",
       "      <td>Uncertain_significance</td>\n",
       "      <td>PM2,PP3_Moderate</td>\n",
       "      <td>[]</td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>c.1909G&gt;T</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>7</td>\n",
       "      <td>11324574.0</td>\n",
       "      <td>C</td>\n",
       "      <td>T</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>[]</td>\n",
       "      <td>None</td>\n",
       "      <td>NaN</td>\n",
       "      <td>rs11</td>\n",
       "      <td>...</td>\n",
       "      <td>-2.0</td>\n",
       "      <td>Likely_benign</td>\n",
       "      <td>PM2,BP4_Strong</td>\n",
       "      <td>[]</td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>None</td>\n",
       "      <td>NaN</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>[]</td>\n",
       "      <td>None</td>\n",
       "      <td>NaN</td>\n",
       "      <td>None</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>None</td>\n",
       "      <td></td>\n",
       "      <td>[]</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>12</td>\n",
       "      <td>102894918.0</td>\n",
       "      <td>C</td>\n",
       "      <td>T</td>\n",
       "      <td>missense_variant,splice_region_variant</td>\n",
       "      <td>NM_000277.3</td>\n",
       "      <td>missense_variant,splice_region_variant</td>\n",
       "      <td>PAH</td>\n",
       "      <td>8582.0</td>\n",
       "      <td>rs140945592</td>\n",
       "      <td>...</td>\n",
       "      <td>5.0</td>\n",
       "      <td>Uncertain_significance</td>\n",
       "      <td>PM2,PP4_Moderate,PM3_Supporting</td>\n",
       "      <td>[]</td>\n",
       "      <td>not provided,Phenylketonuria</td>\n",
       "      <td>Uncertain significance</td>\n",
       "      <td>not provided|Phenylketonuria</td>\n",
       "      <td>Uncertain significance</td>\n",
       "      <td>None</td>\n",
       "      <td>c.169G&gt;A</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>11 rows × 53 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     chr          pos   ref   alt                                  effect  \\\n",
       "0      1  230710021.0     G     A                        missense_variant   \n",
       "1     22   28695868.0    AG     A                      frameshift_variant   \n",
       "2      3   39394574.0     A     T       stop_gained,splice_region_variant   \n",
       "3      M       1243.0     T     C      non_coding_transcript_exon_variant   \n",
       "4     22   28695868.0    AG     A                      frameshift_variant   \n",
       "5     22   28695868.0     A    AG                      frameshift_variant   \n",
       "6      1  230710048.0     A     G                        missense_variant   \n",
       "7      X  153803772.0     C     A                        missense_variant   \n",
       "8      7   11324574.0     C     T                                           \n",
       "9   None          NaN  None  None                                           \n",
       "10    12  102894918.0     C     T  missense_variant,splice_region_variant   \n",
       "\n",
       "        transcript                                       consequences  \\\n",
       "0   NM_001384479.1                                   missense_variant   \n",
       "1      NM_007194.4                                 frameshift_variant   \n",
       "2      NM_017875.4                  stop_gained,splice_region_variant   \n",
       "3             None  [{'protein_coding': False, 'consequences': ['n...   \n",
       "4      NM_007194.4                                 frameshift_variant   \n",
       "5      NM_007194.4                                 frameshift_variant   \n",
       "6   NM_001384479.1                                   missense_variant   \n",
       "7   NM_001303512.2                                   missense_variant   \n",
       "8             None                                                 []   \n",
       "9             None                                                 []   \n",
       "10     NM_000277.3             missense_variant,splice_region_variant   \n",
       "\n",
       "   gene_symbol  gene_hgnc_id         dbsnp  ...  acmg_score  \\\n",
       "0          AGT         333.0  rs1228544607  ...         0.0   \n",
       "1        CHEK2       16627.0   rs555607708  ...        16.0   \n",
       "2     SLC25A38       26054.0   rs121918332  ...         9.0   \n",
       "3         RNR1           NaN    rs28358572  ...       -16.0   \n",
       "4        CHEK2       16627.0   rs555607708  ...        16.0   \n",
       "5        CHEK2       16627.0  rs2052566665  ...        12.0   \n",
       "6          AGT         333.0         rs699  ...       -20.0   \n",
       "7        PDZD4       21167.0          None  ...         4.0   \n",
       "8         None           NaN          rs11  ...        -2.0   \n",
       "9         None           NaN          None  ...         NaN   \n",
       "10         PAH        8582.0   rs140945592  ...         5.0   \n",
       "\n",
       "       acmg_classification                     acmg_criteria  acmg_by_gene  \\\n",
       "0   Uncertain_significance                  PM2,BP4_Moderate            []   \n",
       "1               Pathogenic              PVS1,PP5_Very_Strong            []   \n",
       "2        Likely_pathogenic  PVS1_Strong,PM2,PP3,PP5_Moderate            []   \n",
       "3                   Benign               BP6_Very_Strong,BA1            []   \n",
       "4               Pathogenic              PVS1,PP5_Very_Strong            []   \n",
       "5               Pathogenic             PVS1,PM2,PP5_Moderate            []   \n",
       "6                   Benign    BP4_Strong,BP6_Very_Strong,BA1            []   \n",
       "7   Uncertain_significance                  PM2,PP3_Moderate            []   \n",
       "8            Likely_benign                    PM2,BP4_Strong            []   \n",
       "9                     None                                              []   \n",
       "10  Uncertain_significance   PM2,PP4_Moderate,PM3_Supporting            []   \n",
       "\n",
       "                                      clinvar_disease  clinvar_classification  \\\n",
       "0                                                                               \n",
       "1   Li-Fraumeni syndrome 2,Hereditary cancer-predi...              Pathogenic   \n",
       "2                              Sideroblastic anemia 2              Pathogenic   \n",
       "3                          not provided,not specified                  Benign   \n",
       "4   Li-Fraumeni syndrome 2,Hereditary cancer-predi...              Pathogenic   \n",
       "5             Hereditary cancer-predisposing syndrome              Pathogenic   \n",
       "6   Hypertension, essential, susceptibility to,not...                  Benign   \n",
       "7                                                                               \n",
       "8                                                                               \n",
       "9                                                None                    None   \n",
       "10                       not provided,Phenylketonuria  Uncertain significance   \n",
       "\n",
       "                                   phenotype_combined  \\\n",
       "0                                                       \n",
       "1   Li-Fraumeni syndrome 2|Hereditary cancer-predi...   \n",
       "2                              Sideroblastic anemia 2   \n",
       "3                          not provided|not specified   \n",
       "4   Li-Fraumeni syndrome 2|Hereditary cancer-predi...   \n",
       "5             Hereditary cancer-predisposing syndrome   \n",
       "6   Hypertension, essential, susceptibility to|not...   \n",
       "7                                                       \n",
       "8                                                       \n",
       "9                                                       \n",
       "10                       not provided|Phenylketonuria   \n",
       "\n",
       "    pathogenicity_classification_combined  custom_annotations      hgvs_c  \n",
       "0                                    None                None    c.803C>T  \n",
       "1                              Pathogenic                None  c.1100delC  \n",
       "2                              Pathogenic                None    c.790A>T  \n",
       "3                                  Benign                None         NaN  \n",
       "4                              Pathogenic                None  c.1100delC  \n",
       "5                              Pathogenic                None  c.1100dupC  \n",
       "6                                  Benign                None    c.776T>C  \n",
       "7                                    None                None   c.1909G>T  \n",
       "8                                    None                None         NaN  \n",
       "9                                    None                None         NaN  \n",
       "10                 Uncertain significance                None    c.169G>A  \n",
       "\n",
       "[11 rows x 53 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = gnb.annotate(parsed, flatten_consequences=True, use_ensembl=False, output_format=\"dataframe\")\n",
    "print(df.columns)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Liftover example\n",
    "It's easy to make a liftover with `GeneBe`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1/1 [00:00<00:00,  3.77it/s]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "['chr6-160585140-T-G']"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import genebe as gnb\n",
    "gnb.lift_over_variants(['chr6-161006172-T-G'], from_genome='hg19', dest_genome='hg38')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "# Showcase example\n",
    "data = {\n",
    "    \"chr\": [\"1\", \"1\", \"2\"],\n",
    "    \"pos\": [100000, 200000, 300000],\n",
    "    \"ref\": [\"A\", \"G\", \"T\"],\n",
    "    \"alt\": [\"C\", \"T\", \"A\"],\n",
    "}\n",
    "df = pd.DataFrame(data)\n",
    "\n",
    "print(\"Before LiftOver:\")\n",
    "print(df)\n",
    "\n",
    "# Perform lift over\n",
    "df_lifted = gnb.lift_over_variants_df(df, from_genome='hg19', dest_genome='hg38')\n",
    "\n",
    "print(\"\\nAfter LiftOver:\")\n",
    "print(df_lifted)"
   ]
  }
 ],
 "metadata": {
  "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.11.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
