BigQuery Python - Case Study - Comorbidity - Upset plot
docker run -v /home/ivm:/home/ivm -it eu.gcr.io/finngen-sandbox-v3-containers/anaconda_python/anaconda3:1.0 /bin/bash#
import pandas_gbq
import os, sys
# Run the following commands
os.system('export QT_PLUGIN_PATH=/home/ivm/anaconda3/plugins')
os.system('export FONTCONFIG_PATH=/home/ivm/anaconda3/etc/fonts')
from google.cloud import bigquery
import pandas as pd
from upsetplot import from_contents
from upsetplot import UpSet
# Connect to client
client = bigquery.Client()
# Queries
query_alzhdem = """ SELECT FINNGENID
FROM `finngen-production-library.sandbox_tools_r10.endpoint_cohorts_r10_v1`
WHERE ENDPOINT = 'F5_ALZHDEMENT'
"""
query_type2d = """ SELECT FINNGENID
FROM `finngen-production-library.sandbox_tools_r10.endpoint_cohorts_r10_v1`
WHERE ENDPOINT = 'T2D'
"""
query_cvd = """ SELECT FINNGENID
FROM `finngen-production-library.sandbox_tools_r10.endpoint_cohorts_r10_v1`
WHERE ENDPOINT = 'I9_CVD'
"""
query_depress = """ SELECT FINNGENID
FROM `finngen-production-library.sandbox_tools_r10.endpoint_cohorts_r10_v1`
WHERE ENDPOINT = 'F5_DEPRESSIO'
"""
query_gids = """ SELECT FINNGENID
FROM `finngen-production-library.sandbox_tools_r10.endpoint_cohorts_r10_v1`
WHERE ENDPOINT = 'K11_GIDISEASES'
"""
# Job configuration
job_config = bigquery.QueryJobConfig()
# Run the queries
query_result_alzhdem = client.query(query_alzhdem,job_config=job_config)
query_result_type2d = client.query(query_type2d,job_config=job_config)
query_result_cvd = client.query(query_cvd,job_config=job_config)
query_result_depress = client.query(query_depress,job_config=job_config)
query_result_gids = client.query(query_gids,job_config=job_config)PreviousBigQuery Python - Case Study - Sex different - Tornado plotNextBigQuery Python - Case Study - Patient Timeline - Scatter plot
Last updated
Was this helpful?