cell_lines_filter: Filter cell-lines based on criteria

Description Usage Arguments Details Value Examples

View source: R/cell_line_filter.R

Description

An XML nodeset of cell-line elements can be filtered to produce a subset containing only those elements that match the filter criteria.

Usage

1
2
cell_lines_filter(cell_lines, filter_by, filter_term,
  filter_type = c("equals", "contains", "starts-with"))

Arguments

cell_lines

An XML nodeset containing cell-line elements. Typically either all the cell-lines in the Cellosaurus dataset, obtained using cell_lines_all, or an existing subset returned by a previous filtering.

filter_by

A string specifying which characteristic the filter should be applied to. Valid options are listed in Details.

filter_term

A string or character vector specifying the term(s) to filter on. If multiple values are provided, the filter will be applied as an "OR", i.e., retaining cell-lines that match any of the items in filter_term. The terms are case-sensitive.

filter_type

Options are c("equals", "contains","starts-with").

Details

The following options are available as filter_by terms:

For full details of the meanings of these values, see the Cellosaurus documentation.

Because filter_terms are applied to retain cell-line elements that match any of the terms (effectively a logical OR), filtering to find cell lines that match two (or more) criteria is achieved using two (or more) calls to this function.

Value

An XML nodeset containing the subset of the cell-lines that match the filter criteria. If no cell-lines match, an empty nodeset will be returned. If one cell-line matches, a nodeset with a single node will be returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Set up the data
cellosaurus <- read_cellosaurus_xml(system.file("extdata",
                                                "cellosaurus.xml",
                                                package = "rcellosaurus"))
cell_lines <- cell_lines_all(cellosaurus)

# Filter for a particular accession number:
cell_lines_filter(cell_lines,
                  filter_by = "accession",
                  filter_term = "CVCL_E525",
                  filter_type = "equals")

# Filter for all cell-lines matching any of three sex categories:
cell_lines_filter(cell_lines,
                  filter_by = "sex",
                  filter_term = c("Mixed sex",
                                  "Sex ambiguous",
                                  "Sex undetermined"),
                  filter_type = "equals")

# Sequential filtering to match "disease contains dysplasia" AND
# "category contains stem cell":
dysplasia_lines <- cell_lines_filter(cell_lines,
                                     filter_by = "disease",
                                     filter_term = "dysplasia",
                                     filter_type = "contains")
dysplasia_stem_lines <- cell_lines_filter(dysplasia_lines,
                                          filter_by = "category",
                                          filter_term = "stem cell",
                                          filter_type = "contains")

jimvine/rcellosaurus documentation built on May 14, 2019, 8:04 a.m.