isatab-class: Class for assay and study objects

Description Usage Arguments Details Value See Also

Description

Class for isatab assay and study objects

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## S3 method for class 'isatab'
dim(x)

## S3 method for class 'isatab'
print(x, ...)

## S3 method for class 'isatab'
as.data.frame(x, ...)

## S3 method for class 'isatab'
as_tibble(x, ...)

## S3 method for class 'isatab'
n_row(x)

## S3 method for class 'isatab'
summary(object, ...)

## S3 replacement method for class 'isatab'
x[node, property = NULL, new = FALSE, n = NA, after_id = NULL] <- value

## S3 method for class 'isatab'
x[node, property = NULL, n = NA]

## S3 replacement method for class 'isatab'
x[[col_id]] <- value

## S3 method for class 'isatab'
x[[col_id]]

Arguments

x

object of class isatab

...

any further arguments are ignored

object

object of class isatab

node

node column (e.g. 'Sample Name')

property

property column (e.g. 'Performer')

new

force creating a new node even if there is already a node with such an identifier

n

instance of the node identifier (if there are multiple identical node identifiers in the isatab, for example multiple 'Extract Name' nodes).

after_id

ID of an existing column. If a column (node or property) needs to be created, after_id can be used to specify after which node / column the new column will be inserted.

value

vector or data frame with values which will be inserted into the isatab at the specified column.

col_id

Column ID (e.g. 'ID34')

Details

Objects of this class are generated usually by reading a file with read_isa().

Internally, it is a list containing as elements a data frame (tibble) describing the structure of the isa tab (isa_stru) and a data frame (tibble) containing the actual data.

Terminology

ISA-tab nodes (such as 'Source Name', 'Sample Name', 'Protocol REF', 'Extract Name' or 'Library Name') can have properties. Both are represented as columns. In the ISA-tab specificiation, node designators such as 'Sample Name' are called identifiers, although they need not be unique. IDs are internal identifiers of the package isaeditor; they are unique to a column. Some functions in isaeditor can access ISA-tab columns using node / property combination; some other require the internal ID.

Accessing columns (nodes and properties) of an isa tab

Note: IDs are a thing internal to this R package. They are not imported from or exported to actual ISA-tab files. However, given that the node 'identifiers' (e.g. 'Sample Name') can be ambiguous, IDs are necessary to unambiguously identify a node.

There are two ways of accessing a column: by using the [ function to select a node identifier (e.g. 'Protocol REF') and, optionally, a property identifier (e.g. 'Performer'), or by using the [[ function to select column IDs. The former has the disadvantage that multiple identical node / property identifier combinations may exist, and it may be necessary to specify which node is meant:

1
2
3
4
5
6
isa_a <- read_isa('a_isatab.txt')
isa_a[ 'Sample Name' ]
isa_a[ 'Protocol REF', 'Performer' ]
## 3rd instance of the combination Protocol REF / Performer
isa_a[ 'Protocol REF', 'Performer', n=3 ]
isa_a[ 'Protocol REF', 'Performer', n=3 ] <- 'Rosalind Franklin'

Assigning a NULL value to a selected node is equivalent to removing this node and all its properties.

Assigning a NULL value to a property is equivalent with removing this property.

Using column IDs with the [[ function is not ambiguous, but column IDs are a trick used by the package isaeditor and are not exported or read from an actual ISA-tab. To view the column IDs, simply print the isatab object to the screen or inspect the isa_stru element of the object:

1
2
3
4
5
isa_s <- read_isa('s_isatab.txt')
isa_s
isa_s$isa_stru
isa_s[['ID21']]
isa_s[['ID21']] <- 'Rosalind Franklin'

Both [ and [[ return a vector if a single column is specified and a data frame if more than one column is selected.

Creating and removing nodes and properties

Nodes and properties can either be created with isa_node_add() and isa_property_add() or with assigning a value to a new node with [<-:

1
2
isa_a['Test Node'] <- c(1, 2, 3)
isa_a['Test Node', 'Test Property'] <- 5:7

In the above code, first the node Test Node was created and filled with values 1:3, and then the property Test Property was created and filled with 5:7. This can be shortened by assigning a data frame in one step:

1
isa_a['Test Node', 'Test Property'] <- data.frame(1:3, 5:7)

A column ID can be specified to insert the node at a position relative to another node, or the property at a position relative to another property:

1
isa_a[ 'Test Node', after_id='ID1' ] <- 1:3

Removing nodes and properties works by assigning NULL to either a node (in which case all node properties will be removed as well) or a property.

1
2
3
4
# remove only one property
isa_a['Test Node', 'Test Property'] <- NULL
# remove node and its properties
isa_a['Test Node'] <- NULL

Value

An object of isatab-class is a list containing three elements:

See Also

read_isa() isa_ID_find()


isaeditor documentation built on Sept. 29, 2021, 9:08 a.m.