BigQuery Python - Case Study - Sex different - Tornado plot
# Import packages
import os, sys
from google.cloud import bigquery
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Connect to client
client = bigquery.Client()
# Run the query
query = """ WITH endpointSubSet AS(
SELECT FINNGENID
FROM `finngen-production-library.sandbox_tools_r10.endpoint_cohorts_r10_v1`
WHERE ENDPOINT = 'F5_ALZHDEMENT'
)
SELECT ESS.FINNGENID AS FINNGENID,
DL.EVENT_AGE AS EVENT_AGE,
COV.sex AS SEX
FROM endpointSubSet AS ESS
JOIN `finngen-production-library.sandbox_tools_r10.finngen_r10_service_sector_detailed_longitudinal_v1` as DL
ON ESS.FINNGENID = DL.FINNGENID
JOIN `finngen-production-library.sandbox_tools_r10.covariates_r10_v1` as COV
ON ESS.FINNGENID = COV.fid
WHERE DL.CODE1 LIKE '%F00%' # ICD code of Alzheimer's Dementia endpoint
"""
# Job configuration
job_config = bigquery.QueryJobConfig()
# Run the query
query_result = client.query(query,job_config=job_config)PreviousBigQuery Python - Downstream analysis - Active Ingredient - Bar plotNextBigQuery Python - Case Study - Comorbidity - Upset plot
Last updated
Was this helpful?