checkBiokitSampleAnnotation: Check sample annotation data.frame or tibble meets the...

View source: R/writeBiokitSampleAnnotation.R

checkBiokitSampleAnnotationR Documentation

Check sample annotation data.frame or tibble meets the requirement of the biokit pipeline

Description

Check sample annotation data.frame or tibble meets the requirement of the biokit pipeline

Usage

checkBiokitSampleAnnotation(df)

Arguments

df

Sample annotation, can be either a data.frame or tbl_df object

Value

Invisible NULL if the requirement is met, otherwise an error is printed and the function stops

The biokit pipeline requires that values in each column contain no empty spaces. This function ensures that.

See Also

writeBiokitSampleAnnotation, which calls this function to ensure that the sample annotation file is ok

Examples


test <- data.frame(Char=LETTERS[1:6],
                   Integer=1:6,
                   Number=pi*1:6,
                   Factor=gl(2,3, labels = c("level 1", "level 2")), stringsAsFactors=FALSE)
testthat::expect_error(checkBiokitSampleAnnotation(test),
                       regexp = "level 1.*level 2")
testFix <- data.frame(Char=LETTERS[1:6],
                      Integer=1:6,
                      Number=pi*1:6,
                      Factor=gl(2,3, labels = c("level1", "level2")), stringsAsFactors=FALSE)
testthat::expect_silent(checkBiokitSampleAnnotation(testFix))
if(require("tibble")) {
  testthat::expect_error(checkBiokitSampleAnnotation(tibble::as_tibble(test)),
                         regexp = "level 1.*level 2")
  testthat::expect_silent(checkBiokitSampleAnnotation(tibble::as_tibble(testFix)))
}


bedapub/ribiosNGS documentation built on Feb. 10, 2025, 12:34 a.m.