list_samples.Rd
In openBIS, samples can be seen as a generalization of plates and wells (
see list_plates()
and list_wells()
). In fact, for the HTS focused
openBIS instance of InfectX, wells and plates represent the only types of
samples available. Samples can either be retrieved using search_openbis()
and setting the argument target_object
to sample
or listed by calling
list_samples()
. Furthermore, all available sample types can be listed
using list_sample_types()
.
list_samples(token, x, ...) # S3 method for ExperimentIdentifier list_samples(token, x, ...) # S3 method for Experiment list_samples(token, x, ...) # S3 method for Plate list_samples(token, x, ...) # S3 method for PlateIdentifier list_samples(token, x, ...) # S3 method for PlateMetadata list_samples(token, x, ...) # S3 method for WellIdentifier list_samples(token, x, ...) # S3 method for WellMetadata list_samples(token, x, ...) list_sample_types(token, ...)
token | Login token as created by |
---|---|
x | Object to limit the number of returned samples, e.g. a set of
|
... | Generic compatibility. Extra arguments will be passed to
|
Depending on the number of resulting objects, either a
json_class
(single object) or a json_vec
(multiple objects), is
returned. Sample objects as returned by list_samples()
additionally
inherit from the Sample
class and sample type objects returned by
list_sample_types()
inherit from SampleType
.
list_samples()
can be dispatched on objects identifying experiments
(Experiment
and ExperimentIdentifier
), in which case the associated
plate samples are returned, on objects representing plates (Plate
,
PlateIdentifier
and PlateMetadata
) or on objects representing wells
(WellIdentifier
and WellMetadata
). For plates, the corresponding plate
samples and for wells, the corresponding well samples are returned. It is
therefore not possible to list all well samples for a plate. This could
however be achieved by listing all wells of a plate using list_wells()
and calling list_samples()
on the returned set of WellIdentifier
objects. A separate API call is required for each json_class
object
contained in the json_vec
passed to list_samples()
as x
argument.
Other object listing functions: list_datasets
,
list_experiments
,
list_material
, list_plates
,
list_projects
# \donttest{ tok <- login_openbis() # search for an experiment, e.g. ADENO-AU-K1 exp <- search_openbis(tok, search_criteria( property_clause("pathogen", "Adenovirus"), property_clause("library", "Ambion"), property_clause("geneset", "Kinome"), property_clause("replicate", 1L) ), target_object = "experiment") # list all plate samples associated with this experiment plate_samp <- list_samples(tok, exp) length(plate_samp)#> [1] 7# the same plates are returned using list_plates(), not regarding order plates <- list_plates(tok, exp) plate_samp <- plate_samp[order(get_field(plate_samp, "code"))] identical(as_plate_id(plates), as_plate_id(plate_samp))#> [1] TRUE# plates can be converted to samples and back to plates again identical(as_plate_id(plates), as_plate_id(list_samples(tok, plates)))#> [1] TRUE# the same is not possible for wells: first well ids are listed for a # plate well_ids <- list_wells(tok, plates[[1L]]) # for efficiency only the first 5 wells are retained well_ids <- well_ids[1:5] print(well_ids, length = 10L)#> ┌─█─WellIdentifier #> │ ├─permId = 20121012090101856-1360590 #> │ ├─plateIdentifier = █─PlateIdentifier #> │ │ └─... #> │ └─wellPosition = █─WellPosition #> │ └─... #> ├─█─WellIdentifier #> │ ├─permId = 20121012090101890-1360591 #> │ ├─plateIdentifier = █─PlateIdentifier #> ...# the corresponding well samples are fetched well_samp <- list_samples(tok, well_ids) # from well sample objects it is not possible to directly create well id # objects as no plate id information is available print(well_samp, length = 20L)#> ┌─█─Sample #> │ ├─spaceCode = INFECTX_PUBLISHED #> │ ├─permId = 20121012090101856-1360590 #> │ ├─code = BB01-1I:A1 #> │ ├─identifier = /INFECTX_PUBLISHED/BB01-1I:A1 #> │ ├─experimentIdentifierOrNull = #> │ ├─sampleTypeCode = CONTROL_WELL #> │ ├─properties = [WELL_QUALITY_STATUS = UNKNOWN, CONTROL_LINK = ATP6V1A (CONT... #> │ ├─registrationDetails = █─EntityRegistrationDetails #> │ │ └─... #> │ ├─retrievedFetchOptions = [BASIC, PROPERTIES, METAPROJECTS] #> │ ├─parents = #> │ ├─children = #> │ ├─stub = FALSE #> │ ├─sampleTypeId = 8 #> │ ├─metaprojects = #> │ └─id = 1230748 #> ├─█─Sample #> │ ├─spaceCode = INFECTX_PUBLISHED #> ...# with a bit of manual work however it is possible to create well id # objects from well samples wells <- well_id(get_field(well_samp, "permId"), plates[[1L]], well_code = get_field(well_samp, "code")) identical(wells, well_ids)#> [1] TRUE