comparison scripts/config_assertions.R @ 2:e20001675838 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/crosscontamination_barcode_filter commit 82a0fd493f5866b3ef65019709ae5c865998f802
author iuc
date Wed, 12 Jun 2019 04:57:52 -0400
parents 78341ccbad0a
children
comparison
equal deleted inserted replaced
1:78341ccbad0a 2:e20001675838
49 checkBatchNamesAreValid <- function(headers){ 49 checkBatchNamesAreValid <- function(headers){
50 #' Checks that Plate and Batch names follow good conventions 50 #' Checks that Plate and Batch names follow good conventions
51 #' i.e. Batch names are NOT reused across plates 51 #' i.e. Batch names are NOT reused across plates
52 #' 52 #'
53 #' @param headers matrix headers in P1_B2_ACTG format 53 #' @param headers matrix headers in P1_B2_ACTG format
54 plate.and.batch <- unique(sort(sub("^(.*)_([ATCGN]+)$", "\\1", headers))) 54 plate.and.batch <- unique(sub("^(.*)_([ATCGN]+)$", "\\1", headers))
55 message("Discovered ", length(plate.and.batch), " batches: ", paste(plate.and.batch, collapse=" ")) 55 message("Discovered ", length(plate.and.batch), " batches: ", paste(plate.and.batch, collapse=" "))
56 56
57 batch.only <- sub("^.*_(B\\d)$", "\\1", plate.and.batch) 57 batch.only <- sub("^.*_(B\\d+)$", "\\1", plate.and.batch)
58 dupes.batches <- batch.only[duplicated(batch.only)] 58 dupes.batches <- batch.only[duplicated(batch.only)]
59 59
60 if (length(dupes.batches) > 0){ 60 if (length(dupes.batches) > 0){
61 stop("Batches ", paste(dupes.batches, collapse=" "), " have duplicate names in other plates!") 61 stop("Batches ", paste(dupes.batches, collapse=" "), " have duplicate names in other plates!")
62 } 62 }