Learn R Programming

MatrixEQTL (version 1.5.0)

SlicedData-class: Class SlicedData for storing large matrices

Description

This class is created for fast and memory efficient manipulations with large datasets presented in matrix form. It is used to load, store, and manipulate large datasets, e.g. genotype and gene expression matrices. When a dataset is loaded, it is sliced in blocks of 10,000 rows (default size). This allows to impute, standardize, and perform other operations with the data with minimal memory overhead.

Arguments

Extends

SlicedData is a reference classes (envRefClass). Its methods can change the values of the fields of the class.

References

For more information visit: http://www.bios.unc.edu/research/genomic_software/Matrix_eQTL/

See Also

This class is used to load data for eQTL analysis by Matrix_eQTL_engine.

Examples

Run this code
# Create a SlicedData variable
sd = SlicedData$new();

# Show the details of the empty object
show(sd);

# Create a matrix of values and assign to sd
mat = matrix(1:12, 3, 4);
rownames(mat) = c('row1','row2','row3');
colnames(mat) = c('col1','col2','col3','col4');
sd$CreateFromMatrix( mat );

# Show the detail of the object (one slice)
show(sd);

# Slice it in pieces of 2 rows
sd$ResliceCombined(sliceSize = 2L);

# Show the number of slices (equivalent function calls)
sd$nSlices()
length(sd)

# Is it all in one slice? (No)
sd$IsCombined()

# Show the column names (equivalent function calls)
sd$columnNames
colnames(sd)

# Show row name slices
sd$rowNameSlices

# Show all row names (equivalent function calls)
sd$GetAllRowNames()
rownames(sd)

# Print the second slice
print( sd[[2]] )

# Reorder and subset columns
sd$ColumnSubsample( c(1,3,4) );

# Reorder and subset rows
sd$RowReorder( c(3,1) );

# Show the detail of the object (one slice again)
show(sd);

# Is it all in one slice? (Yes)
sd$IsCombined()

# Find the row with name 'row1' (it is second in the first slice)
sd$FindRow('row1');

Run the code above in your browser using DataLab