Learn R Programming

HELP (version 1.30.0)

readSampleKey: Read sample key

Description

Function to extract sample key data from a file and link chip ID information with aliases if they exist.

Usage

readSampleKey(file = NULL, chips = NULL, comment.char = "#", sep = "\t")

Arguments

file
the name of the file containing sample key information. Each line of the file is interpreted as a single chip-to-sample map. If it does not contain an absolute path, the file name is relative to the current working directory, getwd(). Tilde-expansion is performed where supported. Alternatively, file can be a readable connection (which will be opened for reading if necessary, and if so closed at the end of the function call). file can also be a complete URL.
chips
a character vector specifying a specific chip ID lookup in the sample key, for which the function will return the appropriate sample aliases
comment.char
character: a character vector of length one containing a single character or an empty string. Use "" to turn off the interpretation of comments altogether.
sep
the field separator character. Values on each line of the file are separated by this character. If sep = "" the separator is "white space", that is one or more spaces, tabs, newlines or carriage returns.

Value

Returns a character vector of sample alias information corresponding to the chips present in the sample key or a subset thereof, specified by the chips input.

See Also

read.table

Examples

Run this code
#demo(pipeline,package="HELP")

cat("#COMMENT\nCHIP_ID\tSAMPLE\n",file="./sample.key.txt")
write.table(cbind(1:10,1001:1010),file="./sample.key.txt",append=TRUE,col.names=FALSE,row.names=FALSE,quote=FALSE,sep="\t")
readSampleKey(file="./sample.key.txt")
readSampleKey(file="./sample.key.txt",chips=c(7:10,"NA1","NA2"))

#file.remove("./sample.key.txt")

Run the code above in your browser using DataLab