Skip to contents

Overview

{GXPAinterface} is an R package with various function to access GXPA API and collection of functions to pre-process the data for importing into GXPA.

Quick Start Example

Here is a example script to grab two genes from TCGA/GTEX (Xena Toil). This dataset is open to all without needing to log in and get a token, so you don’t need a token for it. Other datasets may require it, see below for how to setup the token.

# load this library (after you install it)
library(GXPAinterface)

# get the names of all the series in gxpa that you can acces with no token
all_dat <- get_series_info_from_gxpa()
all_dat$name[1:10]

# find the one of interest (in this case, the TCGA/GTX Xena dataset)
found_rows = all_dat[grep(".*TCGA.*Xena.*", all_dat$name), ]; found_rows
series_id = found_rows$id; series_id

# get PDCD1 and LAG3
my.genes = c("PDCD1", "LAG3")
df = get_data_from_gxpa(series_id, my.genes)

# take a peek
head(df); dim(df)

Xpress 2.0 to GXPA Template

This template is a parameterized RMarkdown document for pulling data from Xpress 2.0, for a given Xpress ID, and uploading to GXPA. There are other parameters to specify QC entries and additional information you may want to pass to GXPA (i.e.  addition metadata and series description). The user may chose to load to GXPA through this template or save files and load to GXPA manually.

Xpress 2.0 to GXPA template can be used directly and edited as needed. For a new report in RStudio select File -> New File -> R Markdown -> From Template -> Xpress to GXPA Workflow, or use the rmarkdown::draft() function code.

rmarkdown::draft("xpress_01234_workflow.Rmd",
  template = "xpress_gxpa_workflow",
  package = "GXPAinterface"
)

Installation

Install the released version of {GXPAinterface} from GitHub:

remotes::install_github(
  repo = "wfulp/GXPAinterface"
)

Or install the development version with:

remotes::install_github(
  repo = "wfulp/GXPAinterface",
  ref = "devlop"
)

Note About Connecting to GXPA API

{GXPAinterface} can make use of R environments for accessing the GXPA API. When importing from GXPA your GXPA API token must be provided, and when importing from GXPA your GXPA username and password must be provided. While is it possible to provide these each time the respective function is used, it is more convenient to set these for the current R session, or even set for all sessions.

To set the token and login information for the current session:

Sys.setenv(GXPA_SERVER = "MY_GXPA_SERVER")
Sys.setenv(GXPA_TOKEN = "MY_GXPA_USER_TOKEN")
Sys.setenv(GXPA_USERNAME = "MY_GXPA_USERNAME")
Sys.setenv(GXPA_PASSWORD = "MY_GXPA_PASSWORD")

More convenient is to set the following environment variables in a .Renviron file (usethis::edit_r_environ()):

GXPA_SERVER = GXPA_SERVER
GXPA_TOKEN  = MY_GXPA_USER_TOKEN
GXPA_USERNAME = MY_GXPA_USERNAME
GXPA_PASSWORD = MY_GXPA_PASSWORD

These environment variable values will be used automatically if defined in your R session.

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.