Giter VIP home page Giter VIP logo

platetools's Introduction

platetools

Build Status cran-version conda-download Codecov branch Downloads

An R package for working with multi-well plates

Installation

CRAN:

install.packages("platetools")

conda:

conda install -c conda-forge r-platetools

GitHub (dev version):

remotes::install_github("swarchal/platetools")

Use

# example dataframe
df <- data.frame(vals = rnorm(384),
                 well = num_to_well(1:384, plate = 384))

raw_map(data = df$vals,
        well = df$well,
        plate = 384) +
    ggtitle("Example 384-well plate") +
    theme_dark() +
    scale_fill_viridis()

See the vignette for more examples.

Grammar
Prefix:
  • raw: raw values
  • hit: hit detection based on standard deviations
  • z: z-scored values
  • b: b-scored values
  • bhit: b-score values before hit detection
Suffix:
  • map: single plate map
  • grid: multple plate maps

e.g:
z_map: z-scored plate map
raw_grid: raw values, multiple plate maps
bhit_grid: b-scored values, coloured by hits, multiple plates

Maintainer

Scott Warchal - <scott.warchal (at) crick.ac.uk>

platetools's People

Contributors

aaronmck avatar charles-plessy avatar kkovary avatar swarchal avatar teunbrand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

platetools's Issues

Removed from CRAN

Removed due to failing on esteemed Prof's computer, but cannot be replicated elsewhere...

 ERROR
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(platetools)
  > 
  > test_check("platetools")
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  platetools
   --- call from context --- 
  fill_plate(df_missing, df_missing$wells)
   --- call from argument --- 
  if (well %in% colnames(df) == FALSE) {
      stop(paste(well, "is not a column in", substitute(df)), call. = FALSE)
  }
   --- R stacktrace ---
  where 1: fill_plate(df_missing, df_missing$wells)
  where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  where 3: withCallingHandlers({
      code
      NULL
  }, error = function(cnd) {
      if (can_entrace(cnd)) {
          cnd <- cnd_entrace(cnd)
      }
      return_from(env, cnd)
  })
  where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)), 
      ...)
  where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
  where 6 at testthat/test-fill_plate.R#11: expect_error(fill_plate(df_missing, df_missing$wells))
  where 7: eval(code, test_env)
  where 8: eval(code, test_env)
  where 9: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 10: doTryCatch(return(expr), name, parentenv, handler)
  where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 13: doTryCatch(return(expr), name, parentenv, handler)
  where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 15: tryCatchList(expr, classes, parentenv, handlers)
  where 16: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 17: test_code(desc, code, env = parent.frame())
  where 18 at testthat/test-fill_plate.R#10: test_that("returns error when expected", {
      expect_error(fill_plate(df_missing, df_missing$wells))
      expect_error(fill_plate("not_a_df", "string"))
      expect_error(fill_plate(df_missing, "wells", plate = 1))
      expect_error(fill_plate(df_missing, "not_in"))
  })
  where 19: eval(code, test_env)
  where 20: eval(code, test_env)
  where 21: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 22: doTryCatch(return(expr), name, parentenv, handler)
  where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 25: doTryCatch(return(expr), name, parentenv, handler)
  where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 27: tryCatchList(expr, classes, parentenv, handlers)
  where 28: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 29: test_code(NULL, exprs, env)
  where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 31: force(code)
  where 32: doWithOneRestart(return(expr), restart)
  where 33: withOneRestart(expr, restarts[[1L]])
  where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 36: FUN(X[[i]], ...)
  where 37: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 38: force(code)
  where 39: doWithOneRestart(return(expr), restart)
  where 40: withOneRestart(expr, restarts[[1L]])
  where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 42: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 45: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 46: test_check("platetools")
  
   --- value of length: 86 type: logical ---
   [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
  [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
  [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
  [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
  [61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
  [76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
   --- function from context --- 
  function (df, well, plate = 96) 
  {
      if (!is.character(well)) {
          stop("'well' should be a string of the column name", 
              call. = FALSE)
      }
      if (!is.data.frame(df)) {
          stop("'df' needs to be a dataframe", call. = FALSE)
      }
      accepted_plates <- c(96L, 384L, 1536L)
      if (plate %in% accepted_plates == FALSE) {
          stop("'plate' needs to be either 96, 384 or 1536", call. = FALSE)
      }
      if (well %in% colnames(df) == FALSE) {
          stop(paste(well, "is not a column in", substitute(df)), 
              call. = FALSE)
      }
      well_col <- df[, well]
      complete_plate <- num_to_well(1:plate, plate = plate)
      missing_indices <- which(complete_plate %!in% well_col)
      missing_wells <- complete_plate[missing_indices]
      missing_df <- data.frame(missing_wells)
      names(missing_df) <- eval(substitute(well))
      filled_df <- rbind_fill(df, missing_df)
      return(filled_df)
  }
  <bytecode: 0x68102b0>
  <environment: namespace:platetools>
   --- function search by body ---
  Function fill_plate in namespace platetools has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1
* checking PDF version of manual ... OK
* checking for detritus in the temp directory ... OK
* DONE

Status: 1 ERROR
See
  ‘/data/blackswan/ripley/R/packages/tests/platetools.Rcheck/00check.log’
for details.

Command exited with non-zero status 1
Time 0:59.11, 50.97 + 5.11

Error: Column `fill` must be a 1d atomic vector or a list

Hi!
I recently installed platetools from CRAN and ran a few examples. The first code chunks give the expected result. However, I ran into problems using the raw_grid function to plot some screening data. Here is a test example from your vignette:

This is the input for chunk 4 in vignette.ipynb:

vals <- c(rnorm(96), rnorm(96, mean = 10))
wells <- rep(num_to_well(1:96), 2)
plate_id <- rep(c("plate_1", "plate_2"), each = 96)

z_grid(data = vals,
well = wells,
plate_id = plate_id) +
scale_fill_distiller(type = "div") +
ggtitle("Two very different plates")

I get this error:
Error: Column fill must be a 1d atomic vector or a list

Is this a dplyr problem?
I attached my session info.
sessioninfo.txt

R CMD check fails with dev testthat

Because you have

test_that("missing_wells errors when expected",{
     expect_error(missing_wells(full, well = "well", plate = 1))
	 expect_error(missing_wells(full, well = TRUE))
     expect_error(missing_wells(full, well = full$well))
	 expect_error(missing_wells(as.list(full), well = full$well),
	 expect_error(missing_wells(full, well = missing$wel)))
	 expect_error(missing_wells(as.matrix(full), well = full$well))
	 expect_error(missing_wells(fill, well = full$not_valid_col))
})

But I think you want:

test_that("missing_wells errors when expected",{
  expect_error(missing_wells(full, well = "well", plate = 1))
  expect_error(missing_wells(full, well = TRUE))
  expect_error(missing_wells(full, well = full$well))
  expect_error(missing_wells(as.list(full), well = full$well))
  expect_error(missing_wells(full, well = missing$wel))
  expect_error(missing_wells(as.matrix(full), well = full$well))
  expect_error(missing_wells(fill, well = full$not_valid_col))
})

Remove dplyr as a dependency

Causing too many problems, see if it's possible to remove it and just use base R.

Problem 1:

In true tidyverse fashion ggplot2 and dplyr clobber each other's namespaces, causing lots of warnings on load:

1: replacing previous import by ‘ggplot2::quo_name’ when loading ‘platetools’
2: replacing previous import by ‘ggplot2::enquos’ when loading ‘platetools’
3: replacing previous import by ‘ggplot2::vars’ when loading ‘platetools’
...

Could fix this by using importFrom rather than import on either or both dplyr/ggplot2.

Problem 2:

They keep making breaking changes.

well_to_num vertical order

Dear Scott,

thanks for the great package. I would have a small suggestion for improvement of the package, namely to provide another style to the well_to_num function that allows for vertical (and maybe also vertical snake) order of numbering. I think this could be useful to other people as well and shouldn't be too painful to implement.

Cheers

Changes to matrix() in r-devel 2021-05-31 r80430 causing test failure

\item \code{matrix(x, n, m)} now warns in more cases where
\code{length(x)} differs from than \code{n * m}; suggested by Abby
Spurdle and Wolfgang Huber in Feb 2021 on the R-devel mailing
list.

This warning can be turned into an error by setting environment
variable \env{R_CHECK_MATRIX_DATA} to \samp{TRUE}: \command{R
CMD check --as-cran} does so unless it is already set.

in current r-devel, where the Debian-based checks are now performed with
R_CHECK_MATRIX_DATA=TRUE.

 Version: 0.1.3
Check: tests
Result: ERROR
     Running 'testthat.R' [11s/12s]
    Running the tests in 'tests/testthat.R' failed.
    Complete output:
     > library(testthat)
     > library(platetools)
     >
     > test_check("platetools")
     == Skipped tests ===============================================================
     * empty test (4)
    
     == Failed tests ================================================================
     -- Error (test-basic_plots.R:44:9): return ggplot object -----------------------
     Error: data length differs from size of matrix: [1536 != 32 x 24]
     Backtrace:
     x
     1. +-testthat::expect_is(...) test-basic_plots.R:44:8
     2. | \-testthat::quasi_label(enquo(object), label, arg = "object")
     3. | \-rlang::eval_bare(expr, quo_get_env(quo))
     4. \-platetools::bhit_map(data = vals1536, well = wells1536, plate = 1536)
     5. \-base::matrix(data, nrow = 32, ncol = 24, byrow = TRUE)
     -- Error (test-basic_plots.R:104:5): returns error when incorrect plate is passed --
     Error: data length differs from size of matrix: [384 != 8 x 12]
     Backtrace:
     x
     1. +-testthat::expect_warning(...) test-basic_plots.R:104:4
     2. | \-testthat:::quasi_capture(enquo(object), label, capture_warnings)
     3. | +-testthat:::.capture(...)
     4. | | \-base::withCallingHandlers(...)
     5. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
     6. \-platetools::b_map(data = vals384, well = wells384, plate = 96)
     7. \-platetools::med_smooth(...)
     8. \-base::matrix(platemap$values, nrow = 8, ncol = 12, byrow = TRUE)
    
     [ FAIL 2 | WARN 0 | SKIP 4 | PASS 156 ]
     Error: Test failures
     Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 0.1.3
Check: tests
Result: ERROR
     Running ‘testthat.R’ [8s/13s]
    Running the tests in ‘tests/testthat.R’ failed.
    Complete output:
     > library(testthat)
     > library(platetools)
     >
     > test_check("platetools")
     ══ Skipped tests ═══════════════════════════════════════════════════════════════
     • empty test (4)
    
     ══ Failed tests ════════════════════════════════════════════════════════════════
     ── Error (test-basic_plots.R:44:9): return ggplot object ───────────────────────
     Error: data length differs from size of matrix: [1536 != 32 x 24]
     Backtrace:
     █
     1. ├─testthat::expect_is(...) test-basic_plots.R:44:8
     2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
     3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
     4. └─platetools::bhit_map(data = vals1536, well = wells1536, plate = 1536)
     5. └─base::matrix(data, nrow = 32, ncol = 24, byrow = TRUE)
     ── Error (test-basic_plots.R:104:5): returns error when incorrect plate is passed ──
     Error: data length differs from size of matrix: [384 != 8 x 12]
     Backtrace:
     █
     1. ├─testthat::expect_warning(...) test-basic_plots.R:104:4
     2. │ └─testthat:::quasi_capture(enquo(object), label, capture_warnings)
     3. │ ├─testthat:::.capture(...)
     4. │ │ └─base::withCallingHandlers(...)
     5. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
     6. └─platetools::b_map(data = vals384, well = wells384, plate = 96)
     7. └─platetools::med_smooth(...)
     8. └─base::matrix(platemap$values, nrow = 8, ncol = 12, byrow = TRUE)
    
     [ FAIL 2 | WARN 0 | SKIP 4 | PASS 156 ]
     Error: Test failures
     Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc

Version: 0.1.3
Check: tests
Result: ERROR
     Running ‘testthat.R’ [13s/41s]
    Running the tests in ‘tests/testthat.R’ failed.
    Complete output:
     > library(testthat)
     > library(platetools)
     >
     > test_check("platetools")
     ══ Skipped tests ═══════════════════════════════════════════════════════════════
     • empty test (4)
    
     ══ Failed tests ════════════════════════════════════════════════════════════════
     ── Error (test-basic_plots.R:44:9): return ggplot object ───────────────────────
     Error: data length differs from size of matrix: [1536 != 32 x 24]
     Backtrace:
     █
     1. ├─testthat::expect_is(...) test-basic_plots.R:44:8
     2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
     3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
     4. └─platetools::bhit_map(data = vals1536, well = wells1536, plate = 1536)
     5. └─base::matrix(data, nrow = 32, ncol = 24, byrow = TRUE)
     ── Error (test-basic_plots.R:104:5): returns error when incorrect plate is passed ──
     Error: data length differs from size of matrix: [384 != 8 x 12]
     Backtrace:
     █
     1. ├─testthat::expect_warning(...) test-basic_plots.R:104:4
     2. │ └─testthat:::quasi_capture(enquo(object), label, capture_warnings)
     3. │ ├─testthat:::.capture(...)
     4. │ │ └─base::withCallingHandlers(...)
     5. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
     6. └─platetools::b_map(data = vals384, well = wells384, plate = 96)
     7. └─platetools::med_smooth(...)
     8. └─base::matrix(platemap$values, nrow = 8, ncol = 12, byrow = TRUE)
    
     [ FAIL 2 | WARN 0 | SKIP 4 | PASS 156 ]
     Error: Test failures
     Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang

Version: 0.1.3
Check: tests
Result: ERROR
     Running ‘testthat.R’ [13s/15s]
    Running the tests in ‘tests/testthat.R’ failed.
    Complete output:
     > library(testthat)
     > library(platetools)
     >
     > test_check("platetools")
     ══ Skipped tests ═══════════════════════════════════════════════════════════════
     • empty test (4)
    
     ══ Failed tests ════════════════════════════════════════════════════════════════
     ── Error (test-basic_plots.R:44:9): return ggplot object ───────────────────────
     Error: data length differs from size of matrix: [1536 != 32 x 24]
     Backtrace:
     █
     1. ├─testthat::expect_is(...) test-basic_plots.R:44:8
     2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
     3. │ └─rlang::eval_bare(expr, quo_get_env(quo))
     4. └─platetools::bhit_map(data = vals1536, well = wells1536, plate = 1536)
     5. └─base::matrix(data, nrow = 32, ncol = 24, byrow = TRUE)
     ── Error (test-basic_plots.R:104:5): returns error when incorrect plate is passed ──
     Error: data length differs from size of matrix: [384 != 8 x 12]
     Backtrace:
     █
     1. ├─testthat::expect_warning(...) test-basic_plots.R:104:4
     2. │ └─testthat:::quasi_capture(enquo(object), label, capture_warnings)
     3. │ ├─testthat:::.capture(...)
     4. │ │ └─base::withCallingHandlers(...)
     5. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
     6. └─platetools::b_map(data = vals384, well = wells384, plate = 96)
     7. └─platetools::med_smooth(...)
     8. └─base::matrix(platemap$values, nrow = 8, ncol = 12, byrow = TRUE)
    
     [ FAIL 2 | WARN 0 | SKIP 4 | PASS 156 ]
     Error: Test failures
     Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc 

bhit_map fails when plates contain missing data

Error in if (platemap[row, "values"] > threshold) { : 
  missing value where TRUE/FALSE needed

platetools/R/bhit_map.R

Lines 102 to 111 in 2934bd8

# calculate whether values are beyond the threshold; defined as hit or null
for (row in 1:nrow(platemap)) {
if (platemap[row, 'values'] > threshold) {
platemap$hit[row] <- "hit"
} else if (platemap[row, 'values'] < (-1*threshold)) {
platemap$hit[row] <- "neg_hit"
} else {
platemap$hit[row] <- "null"
}
}

This can be fixed with an initial if statement, checking if the value is NaN, and if so, return an NaN.

Add option to control iterations in median polish

I would like to control my iterations while performing a two way median polish or b_score by using something similar like "maxiter' function of Median polish (Robust twoway decomposition) of a matrix.

Axis labels and title rendering is broken with recent ggplot2 version

The rendering seems to be broken with the recent version of ggplot2.

PS – Thank you for this package!

library(platetools)
library(ggplot2)
library(viridis)
#> Loading required package: viridisLite

df <- data.frame(vals = rnorm(384),
                 well = num_to_well(1:384, plate = 384))

raw_map(data = df$vals,
        well = df$well,
        plate = 384) +
  ggtitle("Example 384-well plate") +
  theme_dark() +
  scale_fill_viridis()

Created on 2020-05-01 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.3 (2020-02-29)
#>  os       macOS Mojave 10.14.6        
#>  system   x86_64, darwin15.6.0        
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       America/New_York            
#>  date     2020-05-01                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package      * version date       lib source        
#>  assertthat     0.2.1   2019-03-21 [1] CRAN (R 3.6.0)
#>  backports      1.1.6   2020-04-05 [1] CRAN (R 3.6.2)
#>  callr          3.4.3   2020-03-28 [1] CRAN (R 3.6.3)
#>  cli            2.0.2   2020-02-28 [1] CRAN (R 3.6.0)
#>  colorspace     1.4-1   2019-03-18 [1] CRAN (R 3.6.0)
#>  crayon         1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
#>  curl           4.3     2019-12-02 [1] CRAN (R 3.6.0)
#>  desc           1.2.0   2018-05-01 [1] CRAN (R 3.6.0)
#>  devtools       2.3.0   2020-04-10 [1] CRAN (R 3.6.2)
#>  digest         0.6.25  2020-02-23 [1] CRAN (R 3.6.0)
#>  dplyr          0.8.5   2020-03-07 [1] CRAN (R 3.6.0)
#>  ellipsis       0.3.0   2019-09-20 [1] CRAN (R 3.6.0)
#>  evaluate       0.14    2019-05-28 [1] CRAN (R 3.6.0)
#>  fansi          0.4.1   2020-01-08 [1] CRAN (R 3.6.0)
#>  farver         2.0.3   2020-01-16 [1] CRAN (R 3.6.0)
#>  fs             1.3.2   2020-03-05 [1] CRAN (R 3.6.0)
#>  ggplot2      * 3.3.0   2020-03-05 [1] CRAN (R 3.6.0)
#>  glue           1.4.0   2020-04-03 [1] CRAN (R 3.6.2)
#>  gridExtra      2.3     2017-09-09 [1] CRAN (R 3.6.0)
#>  gtable         0.3.0   2019-03-25 [1] CRAN (R 3.6.0)
#>  highr          0.8     2019-03-20 [1] CRAN (R 3.6.0)
#>  htmltools      0.4.0   2019-10-04 [1] CRAN (R 3.6.0)
#>  httr           1.4.1   2019-08-05 [1] CRAN (R 3.6.0)
#>  knitr          1.28    2020-02-06 [1] CRAN (R 3.6.0)
#>  labeling       0.3     2014-08-23 [1] CRAN (R 3.6.0)
#>  lifecycle      0.2.0   2020-03-06 [1] CRAN (R 3.6.0)
#>  magrittr       1.5     2014-11-22 [1] CRAN (R 3.6.0)
#>  memoise        1.1.0   2017-04-21 [1] CRAN (R 3.6.0)
#>  mime           0.9     2020-02-04 [1] CRAN (R 3.6.0)
#>  munsell        0.5.0   2018-06-12 [1] CRAN (R 3.6.0)
#>  pillar         1.4.3   2019-12-20 [1] CRAN (R 3.6.0)
#>  pkgbuild       1.0.7   2020-04-25 [1] CRAN (R 3.6.2)
#>  pkgconfig      2.0.3   2019-09-22 [1] CRAN (R 3.6.0)
#>  pkgload        1.0.2   2018-10-29 [1] CRAN (R 3.6.0)
#>  platetools   * 0.1.2   2019-04-24 [1] CRAN (R 3.6.0)
#>  prettyunits    1.1.1   2020-01-24 [1] CRAN (R 3.6.0)
#>  processx       3.4.2   2020-02-09 [1] CRAN (R 3.6.0)
#>  ps             1.3.2   2020-02-13 [1] CRAN (R 3.6.0)
#>  purrr          0.3.4   2020-04-17 [1] CRAN (R 3.6.2)
#>  R6             2.4.1   2019-11-12 [1] CRAN (R 3.6.0)
#>  RColorBrewer   1.1-2   2014-12-07 [1] CRAN (R 3.6.0)
#>  Rcpp           1.0.4   2020-03-17 [1] CRAN (R 3.6.0)
#>  remotes        2.1.1   2020-02-15 [1] CRAN (R 3.6.0)
#>  rlang          0.4.5   2020-03-01 [1] CRAN (R 3.6.0)
#>  rmarkdown      2.1     2020-01-20 [1] CRAN (R 3.6.0)
#>  rprojroot      1.3-2   2018-01-03 [1] CRAN (R 3.6.0)
#>  scales         1.1.0   2019-11-18 [1] CRAN (R 3.6.0)
#>  sessioninfo    1.1.1   2018-11-05 [1] CRAN (R 3.6.0)
#>  stringi        1.4.6   2020-02-17 [1] CRAN (R 3.6.0)
#>  stringr        1.4.0   2019-02-10 [1] CRAN (R 3.6.0)
#>  testthat       2.3.2   2020-03-02 [1] CRAN (R 3.6.0)
#>  tibble         3.0.1   2020-04-20 [1] CRAN (R 3.6.2)
#>  tidyselect     1.0.0   2020-01-27 [1] CRAN (R 3.6.0)
#>  usethis        1.6.1   2020-04-29 [1] CRAN (R 3.6.3)
#>  vctrs          0.2.4   2020-03-10 [1] CRAN (R 3.6.0)
#>  viridis      * 0.5.1   2018-03-29 [1] CRAN (R 3.6.0)
#>  viridisLite  * 0.3.0   2018-02-01 [1] CRAN (R 3.6.0)
#>  withr          2.2.0   2020-04-20 [1] CRAN (R 3.6.2)
#>  xfun           0.13    2020-04-13 [1] CRAN (R 3.6.2)
#>  xml2           1.3.2   2020-04-23 [1] CRAN (R 3.6.2)
#>  yaml           2.2.1   2020-02-01 [1] CRAN (R 3.6.0)
#> 
#> [1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library

Missing example dataframes in vignette.

Hi,
Thanks for the nice package. I am becoming acquainted with your package by working through the vignette.

It seems that example data for spatial effects df_edge and hit maps df_want are not created in the code.

Could you suggest a fix?

feature_request

Hi, I'm interested to use raw_map but with rainbow colors rather than blue gradient.
Is it possible to do this easily?
Thanks

Look into behaviour of pc_ functions with each argument as TRUE

There are some discrepancies between the hits found on a plate when using pchit_map and when using pchit_grid with the argument “each = TRUE”. And it seems much worse when you increase the number of data vectors from which to find the principal components

Function arguments for color and size of missing wells

Hello Scott,

First thank you for developing this very helpful package!

While using it, I discovered that missing wells are not very visible on clear background compared to dark background. After inspecting the code, I propose to introduce an argument like na.fill to the plt.() functions. This will allow the user to specify what fill color to use for missing wells. The border color can then specifically be adjusted using the adjustcolor() from the grDevices package (or a na.border argument could also be made).

On the same line, I found that the size of the missing wells too small. Introducing a na.size argument the same way would help. I would also suggest to make it proportionally relative to the the size of the non-missing well.

Here is how the function would look like:

plt96 <- function(platemap, size = 10, shape = 21, na.fill = "white", na.size = 0.6){
    shape <- parse_shape(shape)
    ylim <- c(8.5, 0.5)
    if (is_old_ggplot()) {
        ylim <- rev(ylim)
    }
    ggplot(data = platemap, aes_string(x = "Column", y = "Row")) +
        geom_point(data = expand.grid(seq(1, 12), seq(1, 8)),
                   aes_string(x = "Var1", y = "Var2"),
                   color = adjustcolor(na.fill, offset = -c(0.1,0.1,0.1,0)), fill = na.fill, shape = shape, size = size * na.size, alpha = 0.1) +
        geom_point(aes_string(fill = "values"), colour = "gray20", shape = shape, size = size) +
        coord_fixed(ratio = (13 / 12) / (9 / 8), xlim = c(0.5, 12.5), ylim = ylim) +
        scale_y_reverse(breaks = seq(1, 8), labels = LETTERS[1:8]) +
        scale_x_continuous(position = "top", breaks = seq(1, 12)) +
        xlab("") +
        ylab("")
}

This argument will need to be added to the raw_map() function I guess. If you need help on this, I can implement it.

Thank you,

Fred

add geom_plate to fit into ggplot workflows

Would be nice to create a custom geom to fit directly into ggplot2 code, although this will require working with the mess that is ggproto.

Example:

ggplot(df) + 
    geom_plate(aes(well = well, fill = values), plate = 384) + 
    facet_wrap(~plate_id)

Change symbol and sizes for 384 and 96-well plates?

Hi Scott - is there any way to pass parameters to change the size of the squares in 384-well maps, and swap the circles for squares in 96-well maps? Basically I am considering to reduce the whitespace between the squares in raw_map, and change the symbols in z_grid to also be squares.

I'm not new to R but also not at a particularly advanced level. Looking at the source code for plt384 it seems possible, but wondered if there was a simpler way than trying to adapt it.

Kind regards

mike

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.