Skip to main content

querying metadata (GDC Data Portal) in python3

I am trying to query metadata from the GDC Data Portal and used the sample code from its website:

import requests
import json

cases_endpt = 'https://api.gdc.cancer.gov/cases'

# The 'fields' parameter is passed as a comma-separated string of single names.
fields = ["submitter_id",
          "case_id",
          "primary_site",
          "disease_type",
          "diagnoses.vital_status"
         ]

fields = ','.join(fields)

params = {"fields": fields,
          "format": "TSV",
          "size": "100"
         }

response = requests.get(cases_endpt, params = params)

print(response.content)

However, I am not getting a tsv file in return. I am ultimately getting an FPKM instead. Any help is appreciated!

lab
  • 33
  • 2