readSampleTsvs: Read sample tsv files from seqdata storage

View source: R/readSampleTsvs.R

readSampleTsvsR Documentation

Read sample tsv files from seqdata storage

Description

The function searches the provided seqdataDir for tsv files corresponding to the provided sampleIds and returns a data.frame containing the metadata for all these samples.

Usage

readSampleTsvs(
  seqdataDir = "/tungstenfs/groups/gbioinfo/seqdata",
  sampleIds,
  keepMulti = TRUE,
  ...
)

Arguments

seqdataDir

Character scalar, the path to the directory containing the tsv files.

sampleIds

Character vector with sample IDs, which will be matched against the file names in seqDataDir. The sample IDs should not contain the .tsv suffix.

keepMulti

Logical scalar, indicating whether to keep samples that match more than one tsv file. If TRUE, these samples are represented by multiple rows in the table. If FALSE, these samples are excluded. In any case, a warning will be generated, listing the samples with multiple matching files.

...

Additional arguments that will be passed to list.files, e.g. to make the search case-insensitive or search recursively.

Value

A data.frame with metadata for the provided sampleIds.

Author(s)

Charlotte Soneson

Examples

if (requireNamespace("dplyr") && requireNamespace("tidyr")) {
    print(readSampleTsvs(seqdataDir = system.file("extdata/readSampleTsvs", 
                                                  package = "swissknife"), 
                         sampleIds = c("readSampleTsvsEx1",
                                       "readSampleTsvsEx2",
                                       "readSampleTsvsEx3")))
}


fmicompbio/swissknife documentation built on June 11, 2025, 4:17 p.m.