Skip to content

Commit a24603f

Browse files
update reading dart with more than 1 column info on sequences
1 parent 144bf80 commit a24603f

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

R/dart.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,12 +1135,21 @@ clean_dart_colnames <- function(x, dart.check, blacklist.id = NULL, strata = NUL
11351135
# turns out I think it's better to keep ALLELE_SEQUENCE...
11361136

11371137
# Define possible column names to check
1138-
possible.columns <- c("ALLELE_SEQUENCE", "TRIMMED_SEQUENCE", "CLUSTER_CONSENSUS_SEQUENCE")
1138+
# possible.columns <- c("ALLELE_SEQUENCE", "TRIMMED_SEQUENCE", "CLUSTER_CONSENSUS_SEQUENCE")
1139+
# Check for preferred column
1140+
preferred.col <- dplyr::case_when(
1141+
"ALLELE_SEQUENCE" %in% names(x) ~ "ALLELE_SEQUENCE",
1142+
"TRIMMED_SEQUENCE" %in% names(x) ~ "TRIMMED_SEQUENCE",
1143+
"CLUSTER_CONSENSUS_SEQUENCE" %in% names(x) ~ "CLUSTER_CONSENSUS_SEQUENCE",
1144+
TRUE ~ NA_character_
1145+
)
1146+
1147+
11391148

11401149
# Rename columns dynamically
11411150
x %<>% dplyr::rename_with(
11421151
.fn = ~ "SEQUENCE", # Rename to "SEQUENCE"
1143-
.cols = tidyselect::any_of(possible.columns) # Select columns from possible.columns
1152+
.cols = tidyselect::any_of(preferred.col) # Select columns from possible.columns
11441153
)
11451154

11461155
# For all except SILICO ------------------------------------------

0 commit comments

Comments
 (0)