diff --git a/DESCRIPTION b/DESCRIPTION index 77a22084..b57ca114 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: PvSTATEM Type: Package -Title: Reading, quality control and preprocessing of MBA assay data -Description: The package speeds up the process of loading raw data from MBA +Title: Reading, Quality Control and Preprocessing of MBA Assay Data +Description: Speeds up the process of loading raw data from MBA assays, performs quality control checks, and automatically normalizes the data, preparing it for more advanced downstream tasks. The main objective of the package is to create a simple environment for a user, who does not @@ -9,7 +9,7 @@ Description: The package speeds up the process of loading raw data from MBA within the project of the same name - `PvSTATEM` - an international project aiming for malaria elimination. BugReports: https://github.com/mini-pw/PvSTATEM/issues -Version: 0.0.3 +Version: 0.0.4 License: BSD_3_clause + file LICENSE Encoding: UTF-8 Authors@R: c( @@ -39,5 +39,4 @@ Suggests: Config/testfhat/edition: 3 Roxygen: list(markdown = TRUE, r6 = TRUE) VignetteBuilder: knitr -biocViews: DataImport, QualityControl, Preprocessing -URL: https://github.com/mini-pw/PvSTATEM +URL: diff --git a/R/plots-mfi.R b/R/plots-mfi.R index abd476bc..f4ab813c 100644 --- a/R/plots-mfi.R +++ b/R/plots-mfi.R @@ -32,23 +32,24 @@ plot_mfi_for_analyte <- function(plate, analyte_name, df <- plate$data[["Median"]] %>% dplyr::select(analyte_name) %>% - dplyr::rename("MFI" = analyte_name) %>% - dplyr::mutate( - SampleId = paste0("SampleId: ", seq_len(nrow(.))), + dplyr::rename("MFI" = analyte_name) + + df <- dplyr::mutate(df, + SampleId = paste0("SampleId: ", seq_len(nrow(df))), SampleType = plate$sample_types, ) - blanks_df <- df %>% dplyr::filter(SampleType == "BLANK") + blanks_df <- df %>% dplyr::filter(.data$SampleType == "BLANK") blank_mean <- mean(blanks_df$MFI) - sc_df <- df %>% dplyr::filter(SampleType == "STANDARD CURVE") + sc_df <- df %>% dplyr::filter(.data$SampleType == "STANDARD CURVE") test_df <- df %>% - dplyr::filter(SampleType == "TEST") %>% + dplyr::filter(.data$SampleType == "TEST") %>% dplyr::mutate( - outlier = ifelse(is_outlier(MFI), SampleId, as.character(NA)) + outlier = ifelse(is_outlier(.data$MFI), .data$SampleId, as.character(NA)) ) p <- test_df %>% - ggplot2::ggplot(aes(x = SampleType, y = MFI)) + + ggplot2::ggplot(aes(x = .data$SampleType, y = .data$MFI)) + main_geom(color = "blue") + ggplot2::geom_hline( aes(yintercept = blank_mean, linetype = "BLANK MEAN"), @@ -74,7 +75,7 @@ plot_mfi_for_analyte <- function(plate, analyte_name, is_out <- !is.na(test_df$outlier) hjust[is_out] <- ifelse(seq_len(sum(is_out)) %% 2 == 0, -0.18, 1.18) - p <- p + ggrepel::geom_text_repel(aes(label = outlier), na.rm = TRUE, hjust = hjust, color = "grey", min.segment.length = 0.3) + p <- p + ggrepel::geom_text_repel(aes(label = .data$outlier), na.rm = TRUE, hjust = hjust, color = "grey", min.segment.length = 0.3) } p diff --git a/R/plots-plate.R b/R/plots-plate.R index 35668a6e..cc53e7c2 100644 --- a/R/plots-plate.R +++ b/R/plots-plate.R @@ -68,7 +68,7 @@ plot_plate <- function(colors, plot_numbers = FALSE, numbers = NULL, plot_title well_positions$category <- factor(well_positions$color, levels = legend_mapping, labels = categories) # Plot the plate with colored wells - p <- ggplot(well_positions, aes(x = x, y = y, fill = category)) + + p <- ggplot(well_positions, aes(x = .data$x, y = .data$y, fill = .data$category)) + geom_tile(key_glyph = "point") + annotation_custom( rasterGrob(plate_img, width = unit(1, "npc"), height = unit(1, "npc")), diff --git a/R/plots-standard_curve.R b/R/plots-standard_curve.R index 6685003d..b029fe82 100644 --- a/R/plots-standard_curve.R +++ b/R/plots-standard_curve.R @@ -23,7 +23,7 @@ plot_standard_curve_analyte <- function(plate, analyte_name, data_type = "Median", decreasing_dilution_order = TRUE, - log_scale = c("dilutions"), + log_scale = c("all"), plot_line = TRUE, plot_blank_mean = TRUE, plot_dilution_bounds = TRUE, @@ -79,7 +79,7 @@ plot_standard_curve_analyte <- function(plate, } options(scipen = 30) - p <- ggplot2::ggplot(plot_data, aes(x = dilution_values, y = MFI)) + + p <- ggplot2::ggplot(plot_data, aes(x = .data$dilution_values, y = .data$MFI)) + ggplot2::geom_point(aes(color = "Standard curve samples"), size = 3) if (plot_line) { p <- p + ggplot2::geom_line(aes(color = "Standard curve samples"), linewidth = 1.2) @@ -92,10 +92,10 @@ plot_standard_curve_analyte <- function(plate, } if (plot_dilution_bounds) { p <- p + ggplot2::geom_vline( - ggplot2::aes(color = "Min-max dilution bounds", xintercept = min(dilution_values)), + ggplot2::aes(color = "Min-max dilution bounds", xintercept = min(.data$dilution_values)), linetype = "dashed" ) + ggplot2::geom_vline( - ggplot2::aes(color = "Min-max dilution bounds", xintercept = max(dilution_values)), + ggplot2::aes(color = "Min-max dilution bounds", xintercept = max(.data$dilution_values)), linetype = "dashed" ) } @@ -179,12 +179,12 @@ plot_standard_curve_analyte_with_model <- function(plate, test_sample_estimates <- predict(model, test_samples_mfi) p <- p + ggplot2::geom_line( - ggplot2::aes(x = dilution, y = MFI, color = "Fitted model predictions"), + ggplot2::aes(x = .data$dilution, y = .data$MFI, color = "Fitted model predictions"), data = model$get_plot_data(), linewidth = 1 ) if (plot_test_predictions) { p <- p + ggplot2::geom_point( - ggplot2::aes(x = dilution, y = MFI, color = "Test sample predictions"), + ggplot2::aes(x = .data$dilution, y = .data$MFI, color = "Test sample predictions"), data = test_sample_estimates, shape = 4, size = 3 ) diff --git a/man/plot_standard_curve_analyte.Rd b/man/plot_standard_curve_analyte.Rd index e997d804..349dc159 100644 --- a/man/plot_standard_curve_analyte.Rd +++ b/man/plot_standard_curve_analyte.Rd @@ -9,7 +9,7 @@ plot_standard_curve_analyte( analyte_name, data_type = "Median", decreasing_dilution_order = TRUE, - log_scale = c("dilutions"), + log_scale = c("all"), plot_line = TRUE, plot_blank_mean = TRUE, plot_dilution_bounds = TRUE, diff --git a/vignettes/our_datasets.Rmd b/vignettes/our_datasets.Rmd index 8f52d4ee..9f9c64a9 100644 --- a/vignettes/our_datasets.Rmd +++ b/vignettes/our_datasets.Rmd @@ -80,8 +80,8 @@ To check the package functionalities on the data from different sources, we gath - `Chul_TotalIgG_2.csv` - GitHub repo RTSS_Kisumu_Schisto [source](https://github.com/IDEELResearch/RTSS_Kisumu_Schisto/tree/main/data/raw/luminex) -- `pone.0187901.s001.csv` - data shipped with drLumi package [source](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5685631/) +- `pone.0187901.s001.csv` - data shipped with drLumi package [source](https://doi.org/10.1371/journal.pone.0187901) -- `New_Batch_6_20160309_174224.csv` - dataset posted on ReaserchGate [source](https://www.researchgate.net/publication/309410897_Raw_data_generated_by_Luminex) +- `New_Batch_6_20160309_174224.csv` - dataset included in the paper *A single-nucleotide-polymorphism-based genotyping assay for simultaneous detection of different carbendazim-resistant genotypes in the Fusarium graminearum species complex*, H. Zhang et. al. -- `New_Batch_14_20140513_082522.csv` - dataset posted on ReaserchGate [source](https://www.researchgate.net/publication/309411021_The_second_run_of_raw_data_exported_from_Luminex_200_applied_forcarbendazim_resistance_species_and_chemotype_detection_of_156_Fusarium_isolates) +- `New_Batch_14_20140513_082522.csv` - dataset included in the paper *A single-nucleotide-polymorphism-based genotyping assay for simultaneous detection of different carbendazim-resistant genotypes in the Fusarium graminearum species complex*, H. Zhang et. al.