Closed ShixiangWang closed 5 years ago
The xenaPython package has the same problem, but it works when input is a list
In [6]: xena.dataset_probe_values (hub, dataset, samples, ["TP53"])
Out[6]:
[[{'strand': '-',
'chromend': 7590868,
'chromstart': 7565097,
'chrom': 'chr17'}],
[[10.84, 9.96, 11.91, 11.39]]]
In [5]: xena.dataset_probe_values (hub, dataset, samples, "TP53")
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
<ipython-input-5-9a5309f9f398> in <module>
----> 1 xena.dataset_probe_values (hub, dataset, samples, "TP53")
~/anaconda3/lib/python3.6/site-packages/xenaPython/__init__.py in <lambda>(host, dataset, samples, probes)
~/anaconda3/lib/python3.6/site-packages/xenaPython/xenaQuery.py in post(url, query)
199 """POST a xena data query to the given url."""
200 req = Request(url + '/data/', query.encode(), headers)
--> 201 response = urlopen(req)
202 result = response.read().decode('utf-8')
203 return result
~/anaconda3/lib/python3.6/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
221 else:
222 opener = _opener
--> 223 return opener.open(url, data, timeout)
224
225 def install_opener(opener):
~/anaconda3/lib/python3.6/urllib/request.py in open(self, fullurl, data, timeout)
530 for processor in self.process_response.get(protocol, []):
531 meth = getattr(processor, meth_name)
--> 532 response = meth(req, response)
533
534 return response
~/anaconda3/lib/python3.6/urllib/request.py in http_response(self, request, response)
640 if not (200 <= code < 300):
641 response = self.parent.error(
--> 642 'http', request, response, code, msg, hdrs)
643
644 return response
~/anaconda3/lib/python3.6/urllib/request.py in error(self, proto, *args)
568 if http_err:
569 args = (dict, 'default', 'http_error_default') + orig_args
--> 570 return self._call_chain(*args)
571
572 # XXX probably also want an abstract factory that knows when it makes
~/anaconda3/lib/python3.6/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
502 for handler in handlers:
503 func = getattr(handler, meth_name)
--> 504 result = func(*args)
505 if result is not None:
506 return result
~/anaconda3/lib/python3.6/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs)
648 class HTTPDefaultErrorHandler(BaseHandler):
649 def http_error_default(self, req, fp, code, msg, hdrs):
--> 650 raise HTTPError(req.full_url, code, msg, hdrs, fp)
651
652 class HTTPRedirectHandler(BaseHandler):
HTTPError: HTTP Error 500: Server Error
The problem comes from UCSCXenaTools:::.call
\"TP53\"
should be changed to [\"TP53\"]
Fix this problem by passing a list
instead of a character vector.
> .p_dataset_probe_values(hub, dataset, samples, "TP53")
Error in UCSCXenaTools:::.xena_post(host, UCSCXenaTools:::.call(xquery, :
Internal Server Error (HTTP 500).
> .p_dataset_probe_values(hub, dataset, samples, list("TP53"))
[[1]]
strand chromend chromstart chrom
1 - 7590868 7565097 chr17
[[2]]
[,1] [,2]
[1,] 10.84 9.96
> .p_dataset_probe_values(hub, dataset, samples, list("TP53"))
[[1]]
strand chromend chromstart chrom
1 - 7590868 7565097 chr17
[[2]]
[,1] [,2]
[1,] 10.84 9.96
> .p_dataset_gene_probe_avg(hub, dataset, samples, as.list("TP53") )
gene position scores
1 TP53 -, 7590868, 7565097, chr17 10.84, 9.96
> .p_dataset_gene_probes_values(hub, dataset, list("TCGA-02-0047-01"), list("TP53"))
[[1]]
[[1]]$position
strand chromend chromstart chrom
1 - 7590868 7565097 chr17
[[1]]$name
[1] "TP53"
[[2]]
[,1]
[1,] 10.84
Use
.p_dataset_probe_values
and.p_dataset_gene_probe_avg
as example.Work:
Does not work for single sample:
Does not work for single probe (like gene):
Interesting, the
.p_dataset_gene_probes_values
works for single gene, but not single sample