# Accessing data through python

You can use the python API, [**xenaPython**](https://github.com/ucscXena/xenaPython), to programmatically access data in the public Xena Data Hubs.

## Installation

```
pip install 'git+https://github.com/ucscXena/xenaPython'
pip install --upgrade 'git+https://github.com/ucscXena/xenaPython'
```

## Usage

```
import xenaPython as xena  
```

## Example

```
import xenaPython as xena

hub = "https://toil.xenahubs.net"
dataset = "tcga_RSEM_gene_tpm"
samples = xena.dataset_samples (hub, dataset, None)
samples = xena.dataset_samples (hub, dataset, 10)
samples = ["TCGA-02-0047-01","TCGA-02-0055-01","TCGA-02-2483-01"]
probes = ['ENSG00000282740.1', 'ENSG00000000005.5']
[position, [ENSG00000282740_1, ENSG00000000005_5]] = xena.dataset_probe_values (hub, dataset, samples, probes)
ENSG00000282740_1
[-9.9658, -2.8262, -9.9658]
```

## Help

```
import xenaPython
help(xenaPython)
```

## [Jupyter notebook example](https://gist.github.com/acthp/f9828f57eb795404eddb85006375af8d)

## More Information

<https://github.com/ucscXena/xenaPython>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ucsc-xena.gitbook.io/project/overview-of-features/accessing-data-through-python.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
