From 6032c6baba1231304ca1460feb1812bf4f2826e0 Mon Sep 17 00:00:00 2001 From: Pariksheet Nanda Date: Tue, 7 Feb 2017 18:23:46 -0500 Subject: [PATCH] BUG: Remove duplicate control rows --- analysis-only_overlap.R | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/analysis-only_overlap.R b/analysis-only_overlap.R index fafebac..47ff2f2 100644 --- a/analysis-only_overlap.R +++ b/analysis-only_overlap.R @@ -1,5 +1,6 @@ suppressPackageStartupMessages({ library(tidyverse) + library(magrittr) library(readxl) library(stringr) library(methods) # For Rscript per http://stackoverflow.com/a/41797025 @@ -27,26 +28,21 @@ wells_control_plate504 <- tibble::tribble( well = c("C03", "C22", "D12", "D13", "E05", "E20", "F11", "F14", "G07", "G18", "H09", "H16", "I09", "I16", "J07", "J18", "K11", "K14", "L05", "L20", "M12", - "M13", "N03", "N22"))) + "M13", "N03", "N22"))) %>% + rename(symbol_504 = symbol) %>% # Prepare for join. + mutate(plate = 504) %>% + arrange(well) ## FIXME: Need to confirm what type of control Thread is. wells_layout <- read_excel(files_plate, sheet = 3) %>% setNames(tolower(names(.))) %>% select(plate, well, `symbol(s)`, `fbgn(s)`, amplicon) %>% rename(symbol = `symbol(s)`, - fbgn = `fbgn(s)`) - -wells_control_comparison <- merge( - wells_layout %>% filter(well %in% wells_control_plate504$well, - plate %in% c(501:504, 507)) %>% - select(-fbgn, -amplicon) %>% spread(plate, symbol), - wells_control_plate504 %>% rename(`504_new` = symbol)) %>% - .[, order(colnames(.))] %>% select(well, everything()) -write_csv(wells_control_comparison, "plate504-different-controls.csv") - + fbgn = `fbgn(s)`) %>% arrange(plate, well) wells_layout %<>% - bind_rows(mutate(wells_control_plate504, plate = 504)) %>% - arrange(plate, well) %>% + left_join(wells_control_plate504) %>% + mutate(symbol = ifelse(is.na(symbol_504), symbol, symbol_504)) %>% + select(-symbol_504) %>% mutate(control = ifelse( symbol %in% c("CAL1", "FACT", "Rho1"), ## Rho1 gives binucleates "positive", NA)) %>%