Entering edit mode
7.9 years ago
ravipriya11396
▴
10
How to retrieve sample barcode from patient barcode using R?
Thanks with regards in advance.
How to retrieve sample barcode from patient barcode using R?
Thanks with regards in advance.
TCGA provide API to get the barcode from UUID. I wrote a python script to map file UUID barcode. Just input the manifest to the script.
Now, then. You want to use r to access GDC API, is the same as python. Use httr
package in the r to post filters to return your result.
A simple example using file ID to retrieve info from GDC (GDC provides other end point, you can check it.)
require(httr)
files_endpt = "https://gdc-api.nci.nih.gov/files"
body = list("filters" = list("op" = "in", "content" = list('field'='files.file_id', 'value'='af5085c1-5b4e-4b88-9f5f-3c049cdd981f')), 'format' = 'TSV', 'fields'="file_id,file_name,cases.case_id,cases.submitter_id,cases.samples.sample_id,cases.samples.submitter_id,cases.samples.portions.analytes.aliquots.aliquot_id,cases.samples.portions.analytes.aliquots.submitter_id,cases.samples.sample_type,cases.samples.tissue_type,data_category,data_type", 'size' = 1)
r <- POST(url = files_endpt, body = body, encode = 'json')
content(r, 'parsed')
content(r)$cases_0_submitter_id
There is a bioconductor package called tcgaBiolinks. I've never used but it should have the function you are looking for.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Update, 12th May 2018
Since this post was made, a rapid way to interrogate the GDC data for the purposes of converting UUIDs to TCGA Barcodes was found using R Programming Language. See the thread here: Sample names for TCGA data from GDC-legacy archive
Kevin