This function randomises the order of samples in an MS queue. QC and Blank samples are left in
place. It is also possible to randomise only parts of the queue. Before running this make sure
to set a specific seed with the set.seed()
function. This ensures that the randomisation
of the result is consistent if the function is run again.
randomise_queue(data = NULL, rows = NULL, export = FALSE)
optional, a data frame that contains a queue. If not provided a queue file can be chosen interactively.
optional, a numeric vector that specifies a range of rows in for which samples should be randomized.
a logical value that determines if a "randomised_queue.csv"
file will be
saved in the working directory. If FALSE a data frame will be returned.
If export = TRUE
a "randomised_queue.csv"
file will be saved in the
working directory. If export = FALSE
a data frame that contains the randomised queue
is returned.
queue <- create_queue(
date = c("200722"),
instrument = c("EX1"),
user = c("jquast"),
measurement_type = c("DIA"),
experiment_name = c("JPQ031"),
digestion = c("LiP", "tryptic control"),
treatment_type_1 = c("EDTA", "H2O"),
treatment_type_2 = c("Zeba", "unfiltered"),
treatment_dose_1 = c(10, 30, 60),
treatment_unit_1 = c("min"),
n_replicates = 4,
number_runs = FALSE,
organism = c("E. coli"),
exclude_combinations = list(list(
treatment_type_1 = c("H2O"),
treatment_type_2 = c("Zeba", "unfiltered"),
treatment_dose_1 = c(10, 30)
)),
inj_vol = c(2),
data_path = "D:\\2007_Data",
method_path = "C:\\Xcalibur\\methods\\DIA_120min",
position_row = c("A", "B", "C", "D", "E", "F"),
position_column = 8,
blank_every_n = 4,
blank_position = "1-V1",
blank_method_path = "C:\\Xcalibur\\methods\\blank"
)
head(queue, n = 20)
#> # A tibble: 20 × 21
#> `Sample Type` `File Name` `Sample ID` Path `Instrument Method`
#> <chr> <chr> <dbl> <chr> <chr>
#> 1 QC 200722_EX1_jquast_blank_1 1 "D:\… "C:\\Xcalibur\\met…
#> 2 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 3 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 4 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 5 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 6 QC 200722_EX1_jquast_blank_2 1 "D:\… "C:\\Xcalibur\\met…
#> 7 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 8 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 9 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 10 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 11 QC 200722_EX1_jquast_blank_3 1 "D:\… "C:\\Xcalibur\\met…
#> 12 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 13 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 14 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 15 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 16 QC 200722_EX1_jquast_blank_4 1 "D:\… "C:\\Xcalibur\\met…
#> 17 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 18 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 19 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 20 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> # ℹ 16 more variables: `Process Method` <lgl>, `Calibration File` <lgl>,
#> # Position <chr>, `Inj Vol` <dbl>, Level <lgl>, `Sample Wt` <dbl>,
#> # `Sample Vol` <dbl>, `ISTD Amt` <dbl>, `Dil Factor` <dbl>, `L1 Study` <lgl>,
#> # `L2 Client` <lgl>, `L3 Laboratory` <lgl>, `L4 Company` <lgl>,
#> # `L5 Phone` <lgl>, Comment <lgl>, `Sample Name` <chr>
randomised_queue <- randomise_queue(
data = queue,
export = FALSE
)
head(randomised_queue, n = 20)
#> # A tibble: 20 × 21
#> `Sample Type` `File Name` `Sample ID` Path `Instrument Method`
#> <chr> <chr> <dbl> <chr> <chr>
#> 1 QC 200722_EX1_jquast_blank_1 1 "D:\… "C:\\Xcalibur\\met…
#> 2 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 3 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 4 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 5 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 6 QC 200722_EX1_jquast_blank_2 1 "D:\… "C:\\Xcalibur\\met…
#> 7 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 8 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 9 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 10 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 11 QC 200722_EX1_jquast_blank_3 1 "D:\… "C:\\Xcalibur\\met…
#> 12 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 13 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 14 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 15 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 16 QC 200722_EX1_jquast_blank_4 1 "D:\… "C:\\Xcalibur\\met…
#> 17 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 18 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 19 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> 20 Unknown 200722_EX1_jquast_DIA_JP… 1 "D:\… "C:\\Xcalibur\\met…
#> # ℹ 16 more variables: `Process Method` <lgl>, `Calibration File` <lgl>,
#> # Position <chr>, `Inj Vol` <dbl>, Level <lgl>, `Sample Wt` <dbl>,
#> # `Sample Vol` <dbl>, `ISTD Amt` <dbl>, `Dil Factor` <dbl>, `L1 Study` <lgl>,
#> # `L2 Client` <lgl>, `L3 Laboratory` <lgl>, `L4 Company` <lgl>,
#> # `L5 Phone` <lgl>, Comment <lgl>, `Sample Name` <chr>