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.
readSampleTsvs(
seqdataDir = "/tungstenfs/groups/gbioinfo/seqdata",
sampleIds,
keepMulti = TRUE,
...
)
Character scalar, the path to the directory containing the tsv files.
Character vector with sample IDs, which will be matched
against the file names in seqDataDir
. The sample IDs should not
contain the .tsv
suffix.
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.
A data.frame
with metadata for the provided sampleIds
.
if (requireNamespace("dplyr") && requireNamespace("tidyr")) {
print(readSampleTsvs(seqdataDir = system.file("extdata/readSampleTsvs",
package = "swissknife"),
sampleIds = c("readSampleTsvsEx1",
"readSampleTsvsEx2",
"readSampleTsvsEx3")))
}
#> Loading required namespace: tidyr
#> SAMPLE_ID FIELD1 FIELD2 TSV_FILE
#> 1 readSampleTsvsEx1 value1 value2 readSampleTsvsEx1.tsv
#> 2 readSampleTsvsEx2 value3 value4 readSampleTsvsEx2.tsv
#> 3 readSampleTsvsEx3 value5 value6 readSampleTsvsEx3.tsv