Skip to content
Snippets Groups Projects
Commit b4917188 authored by Thomas  OBADIA's avatar Thomas OBADIA
Browse files

Sanitize a possible error in subsetting colums for L (that shouldn't have any...

Sanitize a possible error in subsetting colums for L (that shouldn't have any consequences anyway) and harmonize grammar for mutate(across()) statements
parent 055c8b3f
No related branches found
No related tags found
1 merge request!1Add support for Bioplex MFI outputs, including guessing the type of machine...
...@@ -103,7 +103,7 @@ runRelativeAntibodyUnits = function(fname1, fname2, MFI_CSV, MFI_N_ANTIGENS, TEM ...@@ -103,7 +103,7 @@ runRelativeAntibodyUnits = function(fname1, fname2, MFI_CSV, MFI_N_ANTIGENS, TEM
dim(L) dim(L)
# MFI values as numeric # MFI values as numeric
L[,-which(colnames(L) %in% c("Location","Sample","Total Events","TotalEvents"))] = lapply(L[,-which(colnames(L) %in% c("Location","Sample","Total Events"))], as.numeric) L[,-which(colnames(L) %in% c("Location","Sample","Total Events","TotalEvents"))] = lapply(L[,-which(colnames(L) %in% c("Location","Sample","Total Events","TotalEvents"))], as.numeric)
## Load the counts to check for run quality control ## Load the counts to check for run quality control
C = L_full[(count_row_number+1):(count_row_number+1+nrow(L)),1:(3+as.integer(MFI_N_ANTIGENS))] C = L_full[(count_row_number+1):(count_row_number+1+nrow(L)),1:(3+as.integer(MFI_N_ANTIGENS))]
...@@ -177,7 +177,7 @@ runRelativeAntibodyUnits = function(fname1, fname2, MFI_CSV, MFI_N_ANTIGENS, TEM ...@@ -177,7 +177,7 @@ runRelativeAntibodyUnits = function(fname1, fname2, MFI_CSV, MFI_N_ANTIGENS, TEM
L <- L %>% mutate_all(funs(gsub("NaN", 0, .))) L <- L %>% mutate_all(funs(gsub("NaN", 0, .)))
# MFI values as numeric # MFI values as numeric
L[,-which(colnames(L) %in% c("Location","Sample","Total Events","TotalEvents"))] = lapply(L[,-which(colnames(L) %in% c("Location","Sample","Total Events"))], as.numeric) L[,-which(colnames(L) %in% c("Location","Sample","Total Events","TotalEvents"))] = lapply(L[,-which(colnames(L) %in% c("Location","Sample","Total Events","TotalEvents"))], as.numeric)
C <- as.data.frame(read_excel(fname1, skip = count_row_number+1, col_types = "text")) C <- as.data.frame(read_excel(fname1, skip = count_row_number+1, col_types = "text"))
...@@ -247,7 +247,7 @@ runRelativeAntibodyUnits = function(fname1, fname2, MFI_CSV, MFI_N_ANTIGENS, TEM ...@@ -247,7 +247,7 @@ runRelativeAntibodyUnits = function(fname1, fname2, MFI_CSV, MFI_N_ANTIGENS, TEM
C <- L %>% C <- L %>%
dplyr::mutate(dplyr::across(!c(Location, Sample), gsub, pattern = "^(\\d+(?:\\.\\d+)?)(\\s*\\((\\d+(?:\\.\\d+)?)\\))?$", replacement = "\\3")) %>% dplyr::mutate(dplyr::across(!c(Location, Sample), gsub, pattern = "^(\\d+(?:\\.\\d+)?)(\\s*\\((\\d+(?:\\.\\d+)?)\\))?$", replacement = "\\3")) %>%
# Set to NA in case bead counts were not available # Set to NA in case bead counts were not available
dplyr::mutate(dplyr::across(!Location & !Sample, gsub, pattern = "^$", replacement = NA)) dplyr::mutate(dplyr::across(!c(Location, Sample), gsub, pattern = "^$", replacement = NA))
dim(C) dim(C)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment