find_substrate {opm} | R Documentation |
Identify the names of substrates as used in the stored plate annotations, or identify the positions of substrates, i.e. the plate(s) and well(s) in which they occur. Exact or error-tolerant matching can be used, as well as globbing and regular-expression matching.
## S4 method for signature 'MOPMX' find_positions(object, ...) ## S4 method for signature 'OPM' find_positions(object, type = NULL, ...) ## S4 method for signature 'OPMS' find_positions(object, ...) ## S4 method for signature 'character' find_positions(object, type = NULL, ...) ## S4 method for signature 'factor' find_positions(object, ...) ## S4 method for signature 'list' find_positions(object, ...) ## S4 method for signature 'substrate_match' find_positions(object, ...) ## S4 method for signature 'character' find_substrate(object, search = c("exact", "glob", "approx", "regex", "pmatch"), max.dev = 0.2) ## S4 method for signature 'factor' find_substrate(object, ...)
object |
Query character vector or factor, when
searching for positions alternatively a list, an S3
object of class ‘substrate_match’, an
|
type |
Ignored if empty or |
search |
Character scalar indicating the search mode.
All matching is case-insensitive except for the exact and pmatch search modes. |
max.dev |
Numeric scalar indicating the maximum
allowed deviation. If < 1, the proportion of characters
that might deviate, otherwise their absolute number. It
can also be a list; see the ‘max.distance’
argument of |
... |
Optional arguments passed between the methods. |
When searching for positions, the query names must be
written exactly as used in the stored plate annotations.
To determine their spelling, use find_substrate
.
This spelling is not guaranteed to be stable between
distinct opm releases.
find_substrate
returns an S3 object of class
‘substrate_match’; basically a list of character
vectors (empty if nothing was found), with duplicates
removed and the rest sorted. The names of the list
correspond to names
.
The find_positions
character method returns a list
of character matrices (empty if nothing was found), with
one row per position found, the plate name in the first
column and the well name in the second. The names of this
list correspond to names
. The OPM
and OPMS
methods do the same, using their
own substrates. The list and ‘substrate_match’
methods return lists of such lists.
base::grep base::agrep
Other naming-functions: gen_iii
,
listing
, opm_files
,
plate_type
, register_plate
,
select_colors
,
substrate_info
, wells
## find_substrate()
# Note that 'exact' search matches parts of the names, whereas globbing
# matches entire strings if there are no wildcards (which wouldn't make much
# sense)
(x <- find_substrate("D-Glucose", search = "exact"))
## D-Glucose:
## - 1-Thio-b-D-Glucose
## - '2-Deoxy-D-Glucose #1'
## - '2-Deoxy-D-Glucose #2'
## - '2-Deoxy-D-Glucose #3'
## - '2-Deoxy-D-Glucose #4'
## - 2-Deoxy-D-Glucose-6-Phosphate
## - 3-O-Methyl-D-Glucose
## - D-Glucose
## - 'D-Glucose #1'
## - 'D-Glucose #10'
## - 'D-Glucose #11'
## - 'D-Glucose #12'
## - 'D-Glucose #2'
## - 'D-Glucose #3'
## - 'D-Glucose #4'
## - 'D-Glucose #5'
## - 'D-Glucose #6'
## - 'D-Glucose #7'
## - 'D-Glucose #8'
## - 'D-Glucose #9'
## - D-Glucose-6-Phosphate
## - a-D-Glucose-1-Phosphate
## - 'a-D-Glucose-1-Phosphate #1'
## - 'a-D-Glucose-1-Phosphate #10'
## - 'a-D-Glucose-1-Phosphate #11'
## - 'a-D-Glucose-1-Phosphate #12'
## - 'a-D-Glucose-1-Phosphate #2'
## - 'a-D-Glucose-1-Phosphate #3'
## - 'a-D-Glucose-1-Phosphate #4'
## - 'a-D-Glucose-1-Phosphate #5'
## - 'a-D-Glucose-1-Phosphate #6'
## - 'a-D-Glucose-1-Phosphate #7'
## - 'a-D-Glucose-1-Phosphate #8'
## - 'a-D-Glucose-1-Phosphate #9'
(y <- find_substrate("D-Glucose", search = "glob"))
## D-Glucose: D-Glucose
stopifnot(length(x[[1]]) > length(y[[1]]))
# 'pmatch' matching matches partially at the beginning and returns at most
# one match (the first one)
(y <- find_substrate("D-Glucose", search = "pmatch"))
## D-Glucose: D-Glucose
stopifnot(length(x[[1]]) > length(y[[1]]))
# Now allowing mismatches
(z <- find_substrate("D-Glucose", search = "approx"))
## D-Glucose:
## - 1-Thio-b-D-Glucose
## - '2-Deoxy-D-Glucose #1'
## - '2-Deoxy-D-Glucose #2'
## - '2-Deoxy-D-Glucose #3'
## - '2-Deoxy-D-Glucose #4'
## - 2-Deoxy-D-Glucose-6-Phosphate
## - 2-Keto-D-Gluconic Acid
## - '2-Keto-D-Gluconic Acid #2'
## - 3-O-Methyl-D-Glucose
## - 5-Bromo-4-chloro-3-indolyl a-D-Glucoside
## - 5-Bromo-4-chloro-3-indolyl b-D-Glucosaminide
## - 5-Bromo-4-chloro-3-indolyl b-D-Glucoside
## - 5-Keto-D-Gluconic Acid
## - D-Fucose
## - D-Gluconic Acid
## - 'D-Gluconic Acid #1'
## - 'D-Gluconic Acid #2'
## - D-Glucosamine
## - 'D-Glucosamine #2'
## - D-Glucosamine-6-Phosphate
## - D-Glucosaminic Acid
## - 'D-Glucosaminic Acid #1'
## - 'D-Glucosaminic Acid #2'
## - 'D-Glucosaminic Acid #3'
## - D-Glucose
## - 'D-Glucose #1'
## - 'D-Glucose #10'
## - 'D-Glucose #11'
## - 'D-Glucose #12'
## - 'D-Glucose #2'
## - 'D-Glucose #3'
## - 'D-Glucose #4'
## - 'D-Glucose #5'
## - 'D-Glucose #6'
## - 'D-Glucose #7'
## - 'D-Glucose #8'
## - 'D-Glucose #9'
## - D-Glucose-6-Phosphate
## - L-Glucose
## - N-Acetyl-D-Glucosamine
## - 'N-Acetyl-D-Glucosamine #1'
## - 'N-Acetyl-D-Glucosamine #2'
## - 'N-Acetyl-D-Glucosamine #3'
## - N-Acetyl-D-Glucosaminitol
## - a-D-Glucose-1-Phosphate
## - 'a-D-Glucose-1-Phosphate #1'
## - 'a-D-Glucose-1-Phosphate #10'
## - 'a-D-Glucose-1-Phosphate #11'
## - 'a-D-Glucose-1-Phosphate #12'
## - 'a-D-Glucose-1-Phosphate #2'
## - 'a-D-Glucose-1-Phosphate #3'
## - 'a-D-Glucose-1-Phosphate #4'
## - 'a-D-Glucose-1-Phosphate #5'
## - 'a-D-Glucose-1-Phosphate #6'
## - 'a-D-Glucose-1-Phosphate #7'
## - 'a-D-Glucose-1-Phosphate #8'
## - 'a-D-Glucose-1-Phosphate #9'
## - a-Methyl-D-Glucoside
## - 'a-Methyl-D-Glucoside #2'
## - b-Methyl-D-Glucoside
## - 'b-Methyl-D-Glucoside #1'
## - 'b-Methyl-D-Glucoside #2'
## - 'b-Methyl-D-Glucoside #3'
stopifnot(length(z[[1]]) > length(x[[1]]))
# Factor method
(zz <- find_substrate(as.factor("D-Glucose"), search = "approx"))
## D-Glucose:
## - 1-Thio-b-D-Glucose
## - '2-Deoxy-D-Glucose #1'
## - '2-Deoxy-D-Glucose #2'
## - '2-Deoxy-D-Glucose #3'
## - '2-Deoxy-D-Glucose #4'
## - 2-Deoxy-D-Glucose-6-Phosphate
## - 2-Keto-D-Gluconic Acid
## - '2-Keto-D-Gluconic Acid #2'
## - 3-O-Methyl-D-Glucose
## - 5-Bromo-4-chloro-3-indolyl a-D-Glucoside
## - 5-Bromo-4-chloro-3-indolyl b-D-Glucosaminide
## - 5-Bromo-4-chloro-3-indolyl b-D-Glucoside
## - 5-Keto-D-Gluconic Acid
## - D-Fucose
## - D-Gluconic Acid
## - 'D-Gluconic Acid #1'
## - 'D-Gluconic Acid #2'
## - D-Glucosamine
## - 'D-Glucosamine #2'
## - D-Glucosamine-6-Phosphate
## - D-Glucosaminic Acid
## - 'D-Glucosaminic Acid #1'
## - 'D-Glucosaminic Acid #2'
## - 'D-Glucosaminic Acid #3'
## - D-Glucose
## - 'D-Glucose #1'
## - 'D-Glucose #10'
## - 'D-Glucose #11'
## - 'D-Glucose #12'
## - 'D-Glucose #2'
## - 'D-Glucose #3'
## - 'D-Glucose #4'
## - 'D-Glucose #5'
## - 'D-Glucose #6'
## - 'D-Glucose #7'
## - 'D-Glucose #8'
## - 'D-Glucose #9'
## - D-Glucose-6-Phosphate
## - L-Glucose
## - N-Acetyl-D-Glucosamine
## - 'N-Acetyl-D-Glucosamine #1'
## - 'N-Acetyl-D-Glucosamine #2'
## - 'N-Acetyl-D-Glucosamine #3'
## - N-Acetyl-D-Glucosaminitol
## - a-D-Glucose-1-Phosphate
## - 'a-D-Glucose-1-Phosphate #1'
## - 'a-D-Glucose-1-Phosphate #10'
## - 'a-D-Glucose-1-Phosphate #11'
## - 'a-D-Glucose-1-Phosphate #12'
## - 'a-D-Glucose-1-Phosphate #2'
## - 'a-D-Glucose-1-Phosphate #3'
## - 'a-D-Glucose-1-Phosphate #4'
## - 'a-D-Glucose-1-Phosphate #5'
## - 'a-D-Glucose-1-Phosphate #6'
## - 'a-D-Glucose-1-Phosphate #7'
## - 'a-D-Glucose-1-Phosphate #8'
## - 'a-D-Glucose-1-Phosphate #9'
## - a-Methyl-D-Glucoside
## - 'a-Methyl-D-Glucoside #2'
## - b-Methyl-D-Glucoside
## - 'b-Methyl-D-Glucoside #1'
## - 'b-Methyl-D-Glucoside #2'
## - 'b-Methyl-D-Glucoside #3'
stopifnot(identical(z, zz))
## find_positions()
# Character method; compare correct and misspelled substrate name
(x <- find_positions(c("D-Glucose", "D-Gloucose")))
## $`D-Glucose`
## Plate Well
## [1,] "AN2" "B10"
## [2,] "FF" "B12"
## [3,] "Gen III" "C01"
## [4,] "PM-M02" "H12"
## [5,] "PM-M03" "H12"
## [6,] "PM-M04" "H12"
## [7,] "PM01" "C09"
## [8,] "PM05" "F08"
## [9,] "SF-N2" "B06"
## [10,] "SF-P2" "B11"
##
## $`D-Gloucose`
## Plate Well
stopifnot(length(x[[1]]) > length(x[[2]]))
# Factor method
(y <- find_positions(as.factor(c("D-Glucose", "D-Gloucose"))))
## $`D-Glucose`
## Plate Well
## [1,] "AN2" "B10"
## [2,] "FF" "B12"
## [3,] "Gen III" "C01"
## [4,] "PM-M02" "H12"
## [5,] "PM-M03" "H12"
## [6,] "PM-M04" "H12"
## [7,] "PM01" "C09"
## [8,] "PM05" "F08"
## [9,] "SF-N2" "B06"
## [10,] "SF-P2" "B11"
##
## $`D-Gloucose`
## Plate Well
stopifnot(identical(y, x))
# Restrict to a certain plate
(x <- find_positions(c("D-Glucose", "D-Gloucose"), type = "Gen III"))
## D-Glucose D-Gloucose
## "C01" NA
stopifnot(is.character(x), anyNA(x), !all(is.na(x)))
# List method
x <- find_positions(find_substrate(c("D-Glucose", "D-Gloucose")))
x[[1]][1:3]
## $`1-Thio-b-D-Glucose`
## Plate Well
## [1,] "PM04" "H03"
##
## $`2-Deoxy-D-Glucose #1`
## Plate Well
## [1,] "PM23" "G09"
##
## $`2-Deoxy-D-Glucose #2`
## Plate Well
## [1,] "PM23" "G10"
x[[2]]
## named list()
stopifnot(length(x[[1]]) > length(x[[2]]))