Translate sample names to sample types
Source:R/classes-plate_builder.R
translate_sample_names_to_sample_types.RdFunction translates sample names to sample types based on the sample name from Luminex file and the sample name from the layout file, which may not be provided. The function uses regular expressions to match the sample names to the sample types.
Arguments
- sample_names
(
character())
Vector of sample names from Luminex file- sample_names_from_layout
(
character())
Vector of sample names from Layout file values in this vector may be different thansample_namesand may contain additional information about the sample type like dilution. This vector when set has to have at least the length ofsample_names.
Details
Function assigns SampleType to each of the samples from one of c(ALL, BLANK, TEST, NEGATIVE CONTROL, STANDARD CURVE, POSITIVE CONTROL).
It parses the names as follows:
If sample_names or sample_names_from_layout equals to BLANK, BACKGROUND or B,
then SampleType equals to BLANK
If sample_names or sample_names_from_layout equals to STANDARD CURVE,
SC, S, contains substring 1/\d+ and has prefix , S_, S ,
S or CP3, then SampleType equals to STANDARD CURVE. For instance, sample with a name
S_1/2 or S 1/2 will be classified as STANDARD CURVE.
If sample_names or sample_names_from_layout equals to NEGATIVE CONTROL, N,
or contains substring NEG, then SampleType equals to NEGATIVE CONTROL
If sample_names or sample_names_from_layout starts with P followed by
whitespace, POS followed by whitespace, some sample name followed by
substring 1/\d+ SampleType equals to POSITIVE CONTROL
Otherwise, the returned SampleType is TEST
It also removes any additional suffixes created by make.unique() method, such as, .1, .4.