Skip to content

cleanData() crashes when gene_struct has no variant columns #67

Description

@eboyer221

Found while manually testing a small dataset: `cleanData()` errors out if a run's `gene_struct` table ends up with only the `genome_id` column (no actual structural-variant columns) — which can happen with a very small/homogeneous genome set where Panaroo finds no structural variation.

Error:
```
Error in `tidyr::pivot_longer()`:
! `cols` must select at least one column.
```

It happens here, in `cleanData()`:
```r
DBI::dbReadTable(con, "gene_struct") |>
tidyr::pivot_longer(-genome_id, names_to = "struct", values_to = "value") |>
...
```

`pivot_longer(-genome_id, ...)` has nothing left to pivot when `gene_struct` only has the `genome_id` column, so it throws instead of just producing an empty table.

This is pre-existing on `main` (confirmed the code is unchanged there) — not something introduced by #52. Probably rare on real-sized datasets, but worth a small guard (e.g. skip/short-circuit when there's nothing to pivot) so a degenerate or very small run doesn't crash the whole `runDataProcessing()` call at the very last step.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions