readAnnotationFile: Read in an annotation file in the tsv-format, with or without...

View source: R/readAnnotationFile.R

readAnnotationFileR Documentation

Read in an annotation file in the tsv-format, with or without row names

Description

Read in an annotation file in the tsv-format, with or without row names

Usage

readAnnotationFile(file, outputKeyName = "FeatureName", ...)

Arguments

file

A tab-delimited file without quotes, the first column must contain identifiers (key names). In case the first column has no column name and it contains row names, they will be used as feature names.

outputKeyName

The key name used in the output data.frame. It does not need to exist in the column names of the input data.frame. In this situation, the first column will be used as output keys. If it does exist in the column names of the input data.frame, the content of that column must be identical with the first column of the annotation file.

...

Other parameters passed to readMatrix, which are further passed to read.table.

Value

A data.frame containing the annotation, with the first column named as outputKeyName that contains feature identifiers as character strings. In case the input table contains the column with the same name, the content in that column must match the row names, otherwise an error is reported.

This function is called by readFeatureAnnotationFile and readSampleAnnotationFile. Normal users are unlikely to use it.

Examples

f1 <- system.file("extdata",
  "featureAnnotation/featureAnnotationFile-withRowNames.txt", 
  package="ribiosExpression")
f2 <- system.file("extdata",
  "featureAnnotation/featureAnnotationFile-withoutRowNames.txt", 
  package="ribiosExpression")
# 'FeatureName' does not exist in the column names of f1
f1Read <- readAnnotationFile(f1, outputKeyName="FeatureName") 
# 'GeneID' exists in the colum names of f2, and it is the first column.
f2Read <- readAnnotationFile(f2, outputKeyName="GeneID")
head(f1Read)
head(f2Read)

bedapub/ribiosExpression documentation built on Sept. 2, 2023, 4:37 a.m.