reset
#Please run this code block only once, the first time you are running this notebook
!pip3 install google.cloud
#To be able to retrieve data from google cloud bigquery tables
from google.cloud import bigquery
# authentication in myBinder
!./google-cloud-sdk/bin/gcloud auth application-default login
# If you install google cloud sdk
#!gcloud auth application-default login
Go to the following link in your browser: https://accounts.google.com/o/oauth2/auth?client_id=764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth&code_challenge=YersnwhVgYOV3cr4BZNoOv5q8zoGEPEK3l8Ll6lzqIk&code_challenge_method=S256&access_type=offline&response_type=code&prompt=select_account Enter verification code: ^C Command killed by keyboard interrupt
project_id='syntheticlethality' #please replace syntheticlethality with your own projectid
client = bigquery.Client(project_id)
#client = bigquery.Client(credentials=credentials, project=credentials.project_id)
# Retireve BRCA1 gene effect score of the first data entry for gene BRCA1 from CRISPR dataset
crispr_query="""
SELECT * FROM
`syntheticlethality.DepMap_public_20Q3.Achilles_gene_effect`
WHERE Hugo_Symbol='BRCA1'
LIMIT 10
"""
brca1_gene_effect=client.query(crispr_query).result().to_dataframe()
brca1_gene_effect
# Retrieve the first 10 records for BRCA1 gene expression from pancancer atlas dataset
pancancer_atlas_query="""
SELECT * FROM
`pancancer-atlas.Filtered.EBpp_AdjustPANCAN_IlluminaHiSeq_RNASeqV2_genExp_filtered`
WHERE Symbol='BRCA1'
LIMIT 10
"""
brca1_gene_exp=client.query(pancancer_atlas_query).result().to_dataframe()
brca1_gene_exp