Package 'isatabr'

Title: Implementation for the ISA Abstract Model
Description: ISA is a metadata framework to manage an increasingly diverse set of life science, environmental and biomedical experiments. In isatabr methods for reading, modifying and writing of files in the ISA-Tab format are implemented. It also contains methods for processing assay data.
Authors: Bart-Jan van Rossum [aut, cre] , Maikel Verouden [aut]
Maintainer: Bart-Jan van Rossum <[email protected]>
License: GPL-3
Version: 1.0.1.9000
Built: 2024-09-18 05:10:52 UTC
Source: https://github.com/biometris/isatabr

Help Index


Get and set aFiles.

Description

Get and set the list of aFiles data.frames in an object of ISA.

Usage

aFiles(x)

aFiles(x) <- value

## S4 method for signature 'ISA'
aFiles(x)

## S4 replacement method for signature 'ISA'
aFiles(x) <- value

Arguments

x

An object of class ISA.

value

A list of data.frames containing the assay files. In each data.frame at least the following columns are present: ”.

Value

A list of data.frames containing the assay files.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract list of aFiles data.frames.
aFiles(isaObject1)

S4 Class assayTab, initialization methods

Description

An S4 class to store information from an assay files.

Slots

path

A length-one character vector containing the path to the ISA-Tab data set.

sFileName

A length-one character vector containing the study file name (by definition starting with s_ and ending at .txt).

sIdentifier

A length-one character vector containing the study identifier.

aFileName

A length-one character vector containing the assay file name (by definition starting with a_ and ending at .txt).

aFile

A data.frame containing the contents of the Assay Table file.

aTechType

A length-one character vector containing the assay technology type.

aMeasType

A length-one character vector containing the assay measurement type.


Retrieve the Assay File Name(s) per Study from an ISA object.

Description

Retrieve from an object of the ISA-class the Assay File Name(s) linked to the Study Identifier(s) per Study.

Usage

getAssayFileNames(isaObject)

Arguments

isaObject

An object of the ISA-class.

Value

A named list of character vectors containing the Assay File Name(s) for each Study Identifier. The name of the character vector or names of the list elements represent(s) the Study Identifier(s).

#' @examples

Read example Atwell data set.

isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell", package = "isatabr")))

Extract assay file names per study.

getAssayFileNames(isaObject1)


Retrieve Assay Tables from an ISA object.

Description

Retrieve from an object of the ISA-class the Assay Tables.

Usage

getAssayTabs(isaObject)

Arguments

isaObject

An object of the ISA-class.

Value

A list of lists of objects of class assayTab, where each list element, named by the Study Identifier, contains a list of objects of class assayTab.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Get assay tabs for isaObject1.
aTabObjects <- getAssayTabs(isaObject1)

Retrieve the Study Identifier(s) and Study File Name(s) from an ISA object.

Description

Retrieve from an object of the ISA-class the Study Identifier(s) and Study File Name(s) as contained in the Investigation. To directly access the Study Identifier(s) use the names() function, e.g. names(getStudyFileNames(isaObject)).

Usage

getStudyFileNames(isaObject)

Arguments

isaObject

An object of the ISA-class.

Value

A named character vector containing the Study File Name(s) and the name(s) representing the Study Identifier(s).

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract study identifiers and file names.
getStudyFileNames(isaObject1)

Get and set iContacts.

Description

Get and set the iContacts data.frame in an object of ISA.

Usage

iContacts(x)

iContacts(x) <- value

## S4 method for signature 'ISA'
iContacts(x)

## S4 replacement method for signature 'ISA'
iContacts(x) <- value

Arguments

x

An object of class ISA.

value

A data.frame containing the investigation contacts information. A data.frame in which at least the following columns are present: 'Investigation Person Last Name', 'Investigation Person First Name', 'Investigation Person Mid Initials', 'Investigation Person Email', 'Investigation Person Phone', 'Investigation Person Fax', 'Investigation Person Address', 'Investigation Person Affiliation', 'Investigation Person Roles', 'Investigation Person Roles Term Accession Number', 'Investigation Person Roles Term Source REF'.

Value

A data.frame containing the investigation contacts information.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract iContacts data.frame.
iContacts(isaObject1)

Get and set iFileName

Description

Get and set the file name for the investigation file in an object of ISA.

Usage

iFileName(x)

iFileName(x) <- value

## S4 method for signature 'ISA'
iFileName(x)

## S4 replacement method for signature 'ISA'
iFileName(x) <- value

Arguments

x

An object of class ISA.

value

A length-one character vector indicating the name of the investigation file, a string starting with "i_" and ending in ".txt"

Value

The file name of the investigation file.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract investigation file name.
iFileName(isaObject1)

Get and set invest.

Description

Get and set the investigation data.frame in an object of ISA.

Usage

invest(x)

invest(x) <- value

## S4 method for signature 'ISA'
invest(x)

## S4 replacement method for signature 'ISA'
invest(x) <- value

Arguments

x

An object of class ISA.

value

A data.frame containing the investigation information. A data.frame in which at least the following columns are present: 'Investigation Identifier', 'Investigation Title', 'Investigation Description', 'Investigation Submission Date', 'Investigation Public Release Date'.

Value

A data.frame containing the investigation information.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract investigation data.frame.
invest(isaObject1)

Get and set iPubs.

Description

Get and set the iPubs data.frame in an object of ISA.

Usage

iPubs(x)

iPubs(x) <- value

## S4 method for signature 'ISA'
iPubs(x)

## S4 replacement method for signature 'ISA'
iPubs(x) <- value

Arguments

x

An object of class ISA.

value

A data.frame containing the investigation publications information. A data.frame in which at least the following columns are present: 'Investigation PubMed ID', 'Investigation Publication DOI', 'Investigation Publication Author List', 'Investigation Publication Title', 'Investigation Publication Status', 'Investigation Publication Status Term Accession Number', 'Investigation Publication Status Term Source REF'.

Value

A data.frame containing the investigation publications information.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract iPubs data.frame.
iPubs(isaObject1)

S4 Class ISA, initialization method

Description

An S4 class to store information from an ISA-Tab data set, including an investigation file, one or more study files, and one or more assay files for each study file.

When creating a new object of class ISA via: object <- new(Class = "ISA", path), the function initialize(.Object, path) is called to initialize and create the actual object. The initialize-method is seldomly used as a function itself.

Usage

## S4 method for signature 'ISA'
initialize(.Object, path)

Arguments

.Object

character, name of the object of class ISA to be initialized

path

length-one character vector containing the path to the ISA-Tab files of the dataset.

Slots

path

A length-one character vector containing the path to the ISA-Tab dataset.

iFileName

A length-one character vector containing the investigation filename (by definition starting with i_ and ending at .txt).

oSR

A data.frame containing the "ONTOLOGY SOURCE REFERENCE" section of the investigation file.

invest

A data.frame containing the "INVESTIGATION" section of the investigation file.

iPubs

A data.frame containing the "INVESTIGATION PUBLICATIONS" section of the investigation file.

iContacts

A data.frame containing the "INVESTIGATION CONTACTS" section of the investigation file.

study

A list of data.frames containing the "STUDY" sections of the investigation file. Each study has its own section and the study identifier is used to name each element in the list.

sDD

A list of data.frames containing the "STUDY DESIGN DESCRIPTORS" sections of the investigation file. Each study has its own section and the study identifier is used to name each element in the list.

sPubs

A list of data.frames containing the "STUDY PUBLICATIONS" sections of the investigation file. Each study has its own section and the study identifier is used to name each element in the list.

sFacts

A list of data.frames containing the "STUDY FACTORS" sections of the investigation file. Each study has its own section and the study identifier is used to name each element in the list.

sAssays

A list of data.frames containing the "STUDY ASSAYS" sections of the investigation file. Each study has its own section and the study identifier is used to name each element in the list.

sProts

A list of data.frames containing the "STUDY PROTOCOLS" sections of the investigation file. Each study has its own section and he study identifier is used to name each element in the list.

sContacts

A list of data.frames containing the "STUDY CONTACTS" sections of the investigation file. Each study has its own section and the study identifier is used to name each element in the list.

sFiles

A list of data.frames containing the "Study Files", containing the contents of the Study Table files belonging to the studies in the investigation. Each study has one Study Table file.

aFiles

A list of data.frames containing the "Assay Files", containing the contents of the Assay Table files belonging to the studies in the investigation. Each study can have multiple Assay Table files. Each element of the list is named by the Assay File Name.


Get and set path

Description

Get and set the file path for an object of class ISA.

Usage

isaPath(x)

isaPath(x) <- value

## S4 method for signature 'ISA'
isaPath(x)

## S4 replacement method for signature 'ISA'
isaPath(x) <- value

Arguments

x

An object of class ISA.

value

A length-one character vector indicating the isaPath to an accessible directory on the system.

Value

The path to the folder for the object of class ISA.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract path.
isaPath(isaObject1)

Get and set oSR

Description

Get and set the ontology Source Reference (oSR) data.frame in an object of ISA.

Usage

oSR(x)

oSR(x) <- value

## S4 method for signature 'ISA'
oSR(x)

## S4 replacement method for signature 'ISA'
oSR(x) <- value

Arguments

x

An object of class ISA.

value

A data.frame containing the ontology Source Reference information. data.frame in which at least the following columns are present: 'Term Source Name', 'Term Source File', 'Term Source Version', 'Term Source Description'.

Value

A data.frame containing the ontology Source Reference information.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract ontology Source Reference data.frame.
oSR(isaObject1)

Process assay tab data

Description

Process data from assay tab files

Process data from assay tab files with technology type mass spectrometry (ms). Processing those files requires the xcms package to be installed.

Process data from assay tab files with technology type DNA microarray (ms). Processing those files requires the Biobase and affy packages to be installed.

Usage

processAssay(isaObject, aTabObject, type = c("raw", "derived"))

## S4 method for signature 'ISA,assayTab,character'
processAssay(isaObject, aTabObject, type = c("raw", "derived"))

## S4 method for signature 'ISA,msAssayTab,character'
processAssay(isaObject, aTabObject, type = c("raw", "derived"))

## S4 method for signature 'ISA,microarrayAssayTab,character'
processAssay(isaObject, aTabObject, type = c("raw", "derived"))

Arguments

isaObject

An object of the ISA.

aTabObject

An object of the microarrayAssayTab.

type

A character string indicating which data files should be processed, either "raw" for raw data files, or "derived" for derived data files. The file names are taken from the corresponding column in the aTabObject.

Examples

### Atwell data.

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Get assay tabs for isaObject1.
aTabObjects <- getAssayTabs(isaObject1)

## Process assay data.
isaDat <- processAssay(isaObject = isaObject1,
                      aTabObject = aTabObjects$s_study1.txt$a_study1.txt,
                       type = "derived")

## Display first rows and columns.
head(isaDat[, 1:10])


### faahKO data. - This requires the xcms package to be installed.
## Read ISA-Tab files for faahKO.
if (requireNamespace("xcms")) {
  isaObject3 <- readISATab(path = file.path(system.file("extdata/faahKO",
                                            package = "isatabr")))

  ## Get assay tabs for isaObject3.
  aTabObjects3 <- getAssayTabs(isaObject3)

  ## Process assay data.
  isaDat3 <-
    processAssay(isaObject = isaObject3,
                 aTabObject = aTabObjects3$s_Proteomic_profiling_of_yeast.txt$a_metabolite.txt,
                 type = "raw")

  ## Display output.
  isaDat3
  }

Read an ISA-Tab dataset into an R object.

Description

Reads an ISA-Tab dataset, given as a zip file or as a set of files in a specific folder, and builds an object of the ISA class.

Usage

readISATab(path = getwd(), zipfile = NULL, verbose = FALSE)

Arguments

path

A character vector with the name of the directory in which the ISA-Tab files are located (if the parameter zipfile is not provided or if it is equal to NULL), or the name of the directory where the zip archive containing the ISA-Tab files is located (if the parameter zipfile is not NULL). The default value is the current working directory.

zipfile

A character vector with the name of the zip archive containing ISA-Tab files themselves (without a directory name in the zip archive). The default value is NULL (specifying that the ISA-Tab files have not been archived in one zipped file).

verbose

Should the messages for the different reading steps be shown?

Value

An object of the ISA class.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Read example zipped Atwell data set.
isazip <- "Atwell.zip"
isaObject2 <- readISATab(path = file.path(system.file("extdata",
                                                      package = "isatabr")),
                         zipfile = isazip,
                         verbose = TRUE)

Get and set sAssays.

Description

Get and set the list of sAssays data.frames in an object of ISA.

Usage

sAssays(x)

sAssays(x) <- value

## S4 method for signature 'ISA'
sAssays(x)

## S4 replacement method for signature 'ISA'
sAssays(x) <- value

Arguments

x

An object of class ISA.

value

A list of data.frames containing the study assays. In each data.frame at least the following columns are present: 'Study Assay Measurement Type', 'Study Assay Measurement Type Term Accession Number', 'Study Assay Measurement Type Term Source REF', 'Study Assay Technology Type', 'Study Assay Technology Type Term Accession Number', 'Study Assay Technology Type Term Source REF', 'Study Assay Technology Platform', 'Study Assay File Name'.

Value

A list of data.frames containing the study assays.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract list of sAssays data.frames.
sAssays(isaObject1)

Get and set sContacts.

Description

Get and set the list of sContacts data.frames in an object of ISA.

Usage

sContacts(x)

sContacts(x) <- value

## S4 method for signature 'ISA'
sContacts(x)

## S4 replacement method for signature 'ISA'
sContacts(x) <- value

Arguments

x

An object of class ISA.

value

A list of data.frames containing the study contacts. In each data.frame at least the following columns are present: 'Study Person Last Name', 'Study Person First Name', 'Study Person Mid Initials', 'Study Person Email', 'Study Person Phone', 'Study Person Fax', 'Study Person Address', 'Study Person Affiliation', 'Study Person Roles', 'Study Person Roles Term Accession Number', 'Study Person Roles Term Source REF'.

Value

A list of data.frames containing the study contacts.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract list of sContacts data.frames.
sContacts(isaObject1)

Get and set sDD.

Description

Get and set the list of sDD data.frames in an object of ISA.

Usage

sDD(x)

sDD(x) <- value

## S4 method for signature 'ISA'
sDD(x)

## S4 replacement method for signature 'ISA'
sDD(x) <- value

Arguments

x

An object of class ISA.

value

A list of data.frames containing the study design descriptors. In each data.frame at least the following columns are present: 'Study Design Type', 'Study Design Type Term Accession Number', 'Study Design Type Term Source REF'.

Value

A list of data.frames containing the study design descriptors.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract list of sDD data.frames.
sDD(isaObject1)

Get and set sFacts.

Description

Get and set the list of sFacts data.frames in an object of ISA.

Usage

sFacts(x)

sFacts(x) <- value

## S4 method for signature 'ISA'
sFacts(x)

## S4 replacement method for signature 'ISA'
sFacts(x) <- value

Arguments

x

An object of class ISA.

value

A list of data.frames containing the study factors. In each data.frame at least the following columns are present: 'Study Factor Name', 'Study Factor Type', 'Study Factor Type Term Accession Number', 'Study Factor Type Term Source REF'.

Value

A list of data.frames containing the study factors.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract list of sFacts data.frames.
sFacts(isaObject1)

Get and set sFiles.

Description

Get and set the list of sFiles data.frames in an object of ISA.

Usage

sFiles(x)

sFiles(x) <- value

## S4 method for signature 'ISA'
sFiles(x)

## S4 replacement method for signature 'ISA'
sFiles(x) <- value

Arguments

x

An object of class ISA.

value

A list of data.frames containing the study files. In each data.frame at least the following columns are present: 'Source Name', 'Term Source REF', 'Sample Name'.

Value

A list of data.frames containing the study files.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract list of sFiles data.frames.
sFiles(isaObject1)

Get and set sProts.

Description

Get and set the list of sProts data.frames in an object of ISA.

Usage

sProts(x)

sProts(x) <- value

## S4 method for signature 'ISA'
sProts(x)

## S4 replacement method for signature 'ISA'
sProts(x) <- value

Arguments

x

An object of class ISA.

value

A list of data.frames containing the study protocols. In each data.frame at least the following columns are present: 'Study Protocol Name', 'Study Protocol Type', 'Study Protocol Type Term Accession Number', 'Study Protocol Type Term Source REF', 'Study Protocol Description', 'Study Protocol URI', 'Study Protocol Version', 'Study Protocol Parameters Name', 'Study Protocol Parameters Name Term Accession Number', 'Study Protocol Parameters Name Term Source REF', 'Study Protocol Components Name', 'Study Protocol Components Type', 'Study Protocol Components Type Term Accession Number', 'Study Protocol Components Type Term Source REF'.

Value

A list of data.frames containing the study protocols.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract list of sProts data.frames.
sProts(isaObject1)

Get and set sPubs.

Description

Get and set the list of sPubs data.frames in an object of ISA.

Usage

sPubs(x)

sPubs(x) <- value

## S4 method for signature 'ISA'
sPubs(x)

## S4 replacement method for signature 'ISA'
sPubs(x) <- value

Arguments

x

An object of class ISA.

value

A list of data.frames containing the study publications. In each data.frame at least the following columns are present: 'Study PubMed ID', 'Study Publication DOI', 'Study Publication Author List', 'Study Publication Title', 'Study Publication Status', 'Study Publication Status Term Accession Number', 'Study Publication Status Term Source REF'.

Value

A list of data.frames containing the study publications.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract list of sPubs data.frames.
sPubs(isaObject1)

Get and set study.

Description

Get and set the list of study data.frame in an object of ISA.

Usage

study(x)

study(x) <- value

## S4 method for signature 'ISA'
study(x)

## S4 replacement method for signature 'ISA'
study(x) <- value

Arguments

x

An object of class ISA.

value

A list of data.frames containing the study information. In each data.frame at least the following columns are present: 'Study Identifier', 'Study Title', 'Study Description', 'Study Submission Date', 'Study Public Release Date', 'Study File Name'.

Value

A list of data.frames containing the study information.

The updated object of class ISA.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Extract list of study data.frames.
study(isaObject1)

Check the validity of an object of class ISA.

Description

The validISAObject function checks whether an object of class ISA is a valid object. An object of the ISA is considered valid when:

  • There is only one investigation file, which name starts with i_ and ends with .txt, present in the folder containing the ISA-Tab files.

  • All sections in the investigation file contain at least the columns specified for that specific section at https://isa-specs.readthedocs.io/en/latest/isatab.html

  • The study and assay files contain at least the columns specified at https://isa-specs.readthedocs.io/en/latest/isatab.html

Usage

validISAObject(object)

Arguments

object

An object of class ISA.

Value

TRUE or an error message.

See Also

ISA

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Check validity of the object.
validISAObject(isaObject1)

Write ISA-Tab object.

Description

Write ISA-Tab object to files. The investigation file, study files and assay files are written to the folder specified in path.

It is also possible to write only the investigation file, one or more study files, or one or more assay files using the respective functions.

Usage

writeISAtab(isaObject, path = getwd())

writeInvestigationFile(isaObject, path = getwd())

writeStudyFiles(
  isaObject,
  studyFilenames = getStudyFileNames(isaObject),
  path = getwd()
)

writeAssayFiles(
  isaObject,
  assayFilenames = unlist(getAssayFileNames(isaObject)),
  path = getwd()
)

Arguments

isaObject

An object of the ISA-class.

path

A character vector with the name of the directory to which the file(s) should be written. The default value is the current working directory.

studyFilenames

A character vector indicating the study files that should be written. Default all study files in isaObject are written.

assayFilenames

A character vector indicating the assay files that should be written. Default all assay files in isaObject are written.

Value

No return value, files are written to path.

Examples

## Read example Atwell data set.
isaObject1 <- readISATab(path = file.path(system.file("extdata/Atwell",
                                          package = "isatabr")))

## Write content of ISA object to a temporary directory.
writeISAtab(isaObject = isaObject1,
           path = tempdir())

## Write investigation file to a temporary directory.
writeInvestigationFile(isaObject = isaObject1,
                       path = tempdir())

## Write study file to a temporary directory.
writeStudyFiles(isaObject = isaObject1,
                studyFilenames = "s_study1.txt",
                path = tempdir())

## Write assay file to a temporary directory.
writeAssayFiles(isaObject = isaObject1,
                assayFilenames = "a_study1.txt",
                path = tempdir())