-
Notifications
You must be signed in to change notification settings - Fork 33
/
gdc-api-manifest-httr.R
64 lines (52 loc) · 1.47 KB
/
gdc-api-manifest-httr.R
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
54
55
56
57
58
59
60
61
62
63
64
# Library -----------------------------------------------------------------
library(magrittr)
# GDC API -----------------------------------------------------------------
files_endpoint = "https://api.gdc.cancer.gov/files"
filter_json = '{
"filters": {
"op": "and",
"content": [{
"content": {
"field": "cases.project.program.name",
"value": ["TCGA"]
},
"op": "in"
}, {
"op": "in",
"content": {
"field": "files.access",
"value": ["open"]
}
}, {
"content": {
"field": "files.data_category",
"value": ["transcriptome profiling"]
},
"op": "in"
}, {
"op": "in",
"content": {
"field": "files.data_format",
"value": ["txt"]
}
}, {
"op": "in",
"content": {
"field": "files.data_type",
"value": ["miRNA Expression Quantification"]
}
}, {
"content": {
"field": "files.experimental_strategy",
"value": ["miRNA-Seq"]
},
"op": "in"
}]
},
"format":"JSON",
"size":20000,
"return_type":"manifest"
}'
response <- httr::POST(url = files_endpoint, body = jsonlite::fromJSON(filter_json), encode = 'json')
res_table <- httr::content(x = response, as = 'parsed', type = 'text/tab-separated-values')
readr::write_tsv(x = manifest_file, path = '/home/liucj/data/refdata/tcga-somatic-mutation-and-mirna-expression-grch38/mirna-expression/gdc_manifest_mirna_expression.txt')