WGCNA_readindata: Read in expression matrix and trait data (if possible).

Description Usage Arguments Value Examples

View source: R/WGCNA.R

Description

Read in expression matrix and trait data (if possible).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
WGCNA_readindata(
  exprMat,
  traitData = NULL,
  categoricalTrait = NULL,
  sep = "\t",
  row.names = 1,
  header = T,
  quote = "",
  comment = "",
  check.names = F,
  ...
)

Arguments

exprMat

Gene expression matrix in format as "Genes x Samples". The first column (gene names) must be unique among all rows and will be treated as rownames. The first row (sample names) must be unique among all columns and will be treated as colnames. Columns should be separted by "TAB".

The expression data can be log transformed FPKM/TPM/CPM, vst or rlog transformed value.

ID Samp1 Samp2 ... SampX
Gene1  1.5 2.0 ... 10
Gene2  1.2 4.0 ... 10
.
.
.
Gene3  2.5 2.0 ... 8
traitData

Sample attribte data with first column as sample names and other columns as sample attributes. Specifically for categorical attributes, each attribute one column, 0 represents not belong to while 1 represents belonging to. Or one can give categorical attributes separately to "categoricalTrait".

ID      WT      KO      OE Height Weight Diameter
samp1   1       0       0       1       2       3
samp2   1       0       0       2       4       6
samp3   0       1       0       10      20      50
samp4   0       1       0       15      30      80
samp5   0       0       1       NA      9       8
samp6   0       0       1       4       8       7

categoricalTrait

Categorical attributes file with format described below. The program will transferred it to 0-1 matrix like them in "traitData". One can give only traitData or categoricalTrait or both (the program will bind them together).

ID group family
samp1 WT A
samp2 WT B
samp3 KO A
samp4 KO B
samp5 OE A
samp6 OE B
sep

the field separator character. Values on each line of the file are separated by this character. If sep = "" (the default for read.table) the separator is ‘white space’, that is one or more spaces, tabs, newlines or carriage returns.

row.names

a vector of row names. This can be a vector giving the actual row names, or a single number giving the column of the table which contains the row names, or character string giving the name of the table column containing the row names.

If there is a header and the first row contains one fewer field than the number of columns, the first column in the input is used for the row names. Otherwise if row.names is missing, the rows are numbered.

Using row.names = NULL forces row numbering. Missing or NULL row.names generate row names that are considered to be ‘automatic’ (and not preserved by as.matrix).

header

a logical value indicating whether the file contains the names of the variables as its first line. If missing, the value is determined from the file format: header is set to TRUE if and only if the first row contains one fewer field than the number of columns.

quote

the set of quoting characters. To disable quoting altogether, use quote = "". See scan for the behaviour on quotes embedded in quotes. Quoting is only considered for columns read as character, which is all of them unless colClasses is specified.

check.names

logical. If TRUE then the names of the variables in the data frame are checked to ensure that they are syntactically valid variable names. If necessary they are adjusted (by make.names) so that they are, and also to ensure that there are no duplicates.

...

Other parameters given to read.table.

Value

A lsit with three elements: datExpr and traitData, traitColors.

Examples

1
2
3
4
5
exprMat <- "test.file"
wgcnaL <- WGCNA_readindata(exprMat)

traitData <- 'trait.file'
wgcnaL <- WGCNA_readindata(exprMat, traitData)

Tong-Chen/YSX documentation built on Jan. 25, 2021, 2:49 a.m.