ImmuneSpaceConnection-class {ImmuneSpaceR} | R Documentation

## The ImmuneSpaceConnection class

### Description

A connection respresents a study or a set of studies available on ImmuneSpace. It provides function to download and display the data within these studies.

### Details

Uses global variables `labkey.url.base`, and `labkey.url.path`, to access a study. `labkey.url.base` should be `https://www.immunespace.org/`. `labkey.url.path` should be `/Studies/studyname`, where 'studyname' is the accession number of the study. The ImmunespaceConnection will initialize itself, and look for a `.netrc` file in `"~/"` the user's home directory. The `.netrc` file should contain a `machine`, `login`, and `password` entry to allow access to ImmuneSpace, where `machine` is the host name like "www.immunespace.org".

### Value

An instance of an ImmuneSpaceConnection for a study in 'labkey.url.path'

### Fields

`study`

  A `character`. The study accession number. Use an empty string ("") to create a connection at the project level.

`config`

  A `list`. Stores configuration of the connection object such as URL, path and username.

`available_datasets`

  A `data.table`. The table of datasets available in the connection object.

`data_cache`

  A `list`. Stores the data to avoid downloading the same tables multiple times.

`constants`

  A `list`. Used to store information regarding gene-expression data.

### Methods

`addTreatment(matrixName = NULL)`

  Add treatment information to the phenoData of an expression matrix available in the connection object.

  x: A character. The name of a expression matrix that has been downloaded from the connection.

`clear_cache()`

  Clear the data_cache. Remove downloaded datasets and expression matrices.

`EMNames(EM = NULL, colType = "participant_id")`

  Change the sampleNames of an ExpressionSet fetched by getGEMatrix using the information in the phenodData slot.

  x: An ExpressionSet, as returned by getGEMatrix.

  colType: A character. The type of column names. Valid options are 'expsample_accession' and 'participant_id'.

`getDataset(x, original_view = FALSE, reload = FALSE, colFilter = NULL, ...)`

  Get a dataset form the connection

  original_view: A logical. If set tot TRUE, download the ImmPort view. Else, download the default grid view.

  reload: A logical. Clear the cache. If set to TRUE, download the dataset, whether a cached version exist or not.

  colFilter: A character. A filter as returned by Rlabkey's makeFilter function.

  '...': Extra arguments to be passed to labkey.selectRows.

`getGEAnalysis(...)`

  Downloads data from the gene expression analysis results table.

  '...': A list of arguments to be passed to labkey.selectRows.

`getGEFiles(files, destdir = ".", quiet = FALSE)`

  Download gene expression raw data files.

  files: A character. Filenames as shown on the gene_expression_files dataset.

  destdir: A character. The local path to store the downloaded files.

`getGEMatrix(matrixName = NULL, cohort = NULL, outputType = "summary", annotation = "latest", reload = FALSE)`

  Downloads a normalized gene expression matrix from ImmuneSpace.

  ‘x’: A ‘character’. The name of the gene expression matrix to download.

  ‘cohort’: A ‘character’. The name of a cohort that has an associated gene expression matrix. Note that if ‘cohort’ isn't NULL, then ‘x’ is ignored.

  ‘outputType’: one of 'raw', 'normalized' or 'summary'. If 'raw' then returns an expression matrix of non-normalized values by probe. 'normalized' returns normalized values by probe. 'summary' returns normalized values averaged by gene symbol.

  ‘annotation’: one of 'default', 'latest', or 'ImmSig'. Determines which feature annotation set is used. 'default' uses the fas from when the matrix was generated. 'latest' uses a recently updated fas based on the original. 'ImmSig' is specific to studies involved in the ImmuneSignatures project and uses the annotation from when the meta-study's manuscript was created.

  ‘reload’: A ‘logical’. If set to TRUE, the matrix will be downloaded again, even if a cached cop exist in the ImmuneSpaceConnection object.

`getParticipantData(group, dataType, original_view = FALSE, ...)`

  returns a dataframe with ImmuneSpace data subset by groupId.

  group: Use con$listParticipantGroups() to find Participant groupId or groupName.

  dataType: Use con$listDatasets('datasets') to see possible dataType inputs.

`listDatasets(output = c("datasets", "expression"))`

  List the datasets available in the study or studies of the connection.

`listGEAnalysis()`

  List available gene expression analysis for the connection.

`listParticipantGroups()`

  returns a dataframe with all saved Participant Groups on ImmuneSpace.

`quick_plot(...)`

  Plots a selected dataset. This is the function used by the DataExplorer module on ImmuneSpace.

  dataset: A character. The name of the dataset to plot, as displayed by the listDataset method.

  normalize_to_baseline: A logical. If set to TRUE, the values are plotted as log2 fold-change from baseline.

  type: A character. The type of plot. Valid choices are 'auto', 'heatmap', 'boxplot', 'lineplot', 'violinplot'. If set to 'auto', the function will select an appropriate plot type for the selected data.

  filter: A filter as created by the makeFilter function from Rlabkey.

  facet: The facetting for ggplot2 based plots. Valid choices are 'grid' and 'wrap'.

  text_size: The size of all text elements in the plot.

  legend: A character. Columns of the dataset or demographics to be added as legend on the heatmap. This argument is ignored if the plot type isn't heatmap.

  show_virus_strain: A logical. Should all the virus strains be shown or should the values be averaged. Only used when dataset = 'hai'.

  interactive: A logical. If set to TRUE, an interactive plot will be created. The default is FALSE.

  '...': Extra argument to be passed to ggplot. e.g: shape = 'Age', color = 'Race'.

### See Also

`CreateConnection` `ImmuneSpaceR-package`

### Examples

    ## Not run:
      sdy269 <- CreateConnection("SDY269")
      sdy269

    ## End(Not run)

[Package ImmuneSpaceR version 1.6.2 Index]