-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04_fetch_annotations.py
More file actions
53 lines (49 loc) · 1.31 KB
/
04_fetch_annotations.py
File metadata and controls
53 lines (49 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import argparse
from gdcutil import GDCClient
# https://api.gdc.cancer.gov/annotations/_mapping
ENDPOINT = '/annotations'
fields = [
"annotation_id",
"submitter_id",
"case_id",
"case_submitter_id",
"entity_id",
"entity_submitter_id",
"entity_type",
"category",
"classification",
"notes",
"created_datetime",
"updated_datetime",
"legacy_created_datetime",
"legacy_updated_datetime",
"state",
"status",
"annotation_autocomplete",
"project.code",
# "project.dbgap_accession_number",
# "project.disease_type",
# "project.intended_release_date",
# "project.name",
# "project.primary_site",
# "project.program.dbgap_accession_number",
# "project.program.name",
# "project.program.program_id",
# "project.project_id",
# "project.releasable",
# "project.released",
# "project.state",
]
filters = {
"op": "=",
"content": {
"field": "project.program.name",
"value": ["TCGA"]
}
}
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Fetch annotation metadata from GDC API')
parser.add_argument('-o', '--output', type=str, required=True, help='Output file path')
args = parser.parse_args()
client = GDCClient(ENDPOINT, fields, filters)
client.to_json(args.output)