This funciton collects the samples from a data.table-class object that
fulfill the requirements of an attribute attr specified with
the fun argument
fetchSamples(samples, attr = NULL, func = NULL, action = "include")
| samples | an object of |
|---|---|
| attr | a string specifying a column in the |
| func | an anonymous function, see Details for more information |
| action | a string (either |
The anonymous function provided in the func argument has to return an integer that indicate the rows that the action should be performed on.
Core expressions which are most useful to implement the anonymous function are:
projectConfig = system.file("extdata", "example_peps-master", "example_amendments1", "project_config.yaml", package="pepr") p = Project(projectConfig)#>#>s = sampleTable(p) fetchSamples(s,attr = "sample_name", func=function(x){ which(x=="pig_0h") },action="include")#> sample_name protocol organism time file_path #> 1: pig_0h RRBS pig 0 /data/lab/project/pig_0h.fastq#> Empty data.table (0 rows and 5 cols): sample_name,protocol,organism,time,file_path#> sample_name protocol organism time file_path #> 1: pig_0h RRBS pig 0 /data/lab/project/pig_0h.fastq #> 2: pig_1h RRBS pig 1 /data/lab/project/pig_1h.fastq