Skip to content

Plotting scripts may crash if no metadata (Ct values) available #108

@dfornika

Description

@dfornika

We have an automated system that pulls metadata (collection dates and Ct values) for all samples prior to running artic & ncov-tools. We've recently run into a situation where no samples had metadata available (all NA values for date and ct in the metadata file).

The error we've run into is occuring in the plot_qc_sequencing.R script, where the merged dataframe here::

merged = dplyr::inner_join(df, metadata, by = "sample")

...is empty, resulting in this error message:

Error: Faceting variables must have at least one value
Backtrace:
     █
  1. └─global::plot_depth_by_amplicon_and_ct(df, metadata, args$output)
  2.   └─ggplot2::ggsave(outname, width = 15, height = 10)
  3.     ├─grid::grid.draw(plot)
  4.     └─ggplot2:::grid.draw.ggplot(plot)
  5.       ├─base::print(x)
  6.       └─ggplot2:::print.ggplot(x)
  7.         ├─ggplot2::ggplot_build(x)
  8.         └─ggplot2:::ggplot_build.ggplot(x)
  9.           └─layout$setup(data, plot$data, plot$plot_env)
 10.             └─ggplot2:::f(..., self = self)
 11.               └─self$facet$compute_layout(data, self$facet_params)
 12.                 └─ggplot2:::f(...)
 13.                   ├─ggplot2:::unrowname(...)
 14.                   │ └─base::is.data.frame(x)
 15.                   └─ggplot2::combine_vars(data, params$plot_env, vars, drop = params$drop)
Execution halted

We haven't confirmed, but a similar error may arise in the other plotting functions in the script that use the metadata.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions