From 12dbda4ad5dbc9a116c4a6a224823b6f9b00116e Mon Sep 17 00:00:00 2001
From: Thomas  OBADIA <tobadia@pasteur.fr>
Date: Wed, 9 Feb 2022 13:23:55 +0100
Subject: [PATCH] Fix incorrect reading of input in case MFI are supplied as an
 Excel sheet and plate was not full with less than 96 wells

---
 FUNCTIONS.R | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/FUNCTIONS.R b/FUNCTIONS.R
index 6e54907..95318d2 100644
--- a/FUNCTIONS.R
+++ b/FUNCTIONS.R
@@ -165,11 +165,7 @@ runRelativeAntibodyUnits = function(fname1, fname2, MFI_CSV, MFI_N_ANTIGENS, TEM
     # 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)
     
-    # Skip
-    ROW_C = 239
-    
-    ## Load the counts to check for run quality control  
-    C <- as.data.frame(read_excel(fname1, skip = ROW_C-1))
+    C <- as.data.frame(read_excel(fname1, skip = count_row_number+1))
     
     ## Find all blank rows (i.e. rows that are all NA).
     ## Then keep rows preceding the first blank row.
@@ -180,10 +176,6 @@ runRelativeAntibodyUnits = function(fname1, fname2, MFI_CSV, MFI_N_ANTIGENS, TEM
       C <- C[1:(blank.row.number-1),]
     }
     
-    # The first row will be the header
-    colnames(C) = C[1, ] 
-    # Removing the first row.
-    C = C[-1, ]     
     ## Exclude column that corresponds to "Total events"
     C <- C[, !(colnames(C) %in% c("Total Events","TotalEvents"))]
     
-- 
GitLab