readSampleKey: Read sample key

Description Usage Arguments Value Author(s) See Also Examples

View source: R/readSampleKey.R

Description

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

Usage

1
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.

Author(s)

Reid F. Thompson (rthompso@aecom.yu.edu)

See Also

read.table

Examples

1
2
3
4
5
6
7
8
#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")

HELP documentation built on Nov. 8, 2020, 11:08 p.m.