I am trying to extract gtex eqtl data from GtexPortal using their API : https://gtexportal.org/home/apiPage
I am looking to extract data for a given SNP ID and tissue location.
I am new to coding and python so I am not sure if what I am doing is right but an example of code I have tried where I give a specific Gene, tissue, and variant ID and am looking to extract the data for these paramaters from the indepndentEqtl data of gtexportal:
gencode = "ENSG00000122971"
gene_name = "ALMS1"
tissue = "Heart_Left_Ventricle"
gene_eqtls = requests.get('https://gtexportal.org/api/v2/association/independentEqtl', params = {"gencodeId" : gencode,"tissueSiteDetailId" : tissue, "datasetId" : "gtex_v8", "variantId" : 'rs58235352'})
data = json.loads(gene_eqtls.text)
data
{'data': [],
'paging_info': {'numberOfPages': 0,
'page': 0,
'maxItem
sPerPage': 250,
'totalNumberOfItems': 0}}
Everything I have been trying has been giving these empty data sets and any help in extracting the data would be greatly appreciated.
the
gencodeIdneeds to be versioned, as per GTEx API docs (e.g.ENSG00000122971.9, see ensembl).However, I also think there is no output for your example gene in this case anyway. Compare with the following example, which does return some results for me: