Skip to content

Fix tidyr::separate_rows issue with plots - #75

Merged
toniecrumley merged 9 commits into
develfrom
fix-tidyr
Jun 30, 2026
Merged

Fix tidyr::separate_rows issue with plots#75
toniecrumley merged 9 commits into
develfrom
fix-tidyr

Conversation

@toniecrumley

@toniecrumley toniecrumley commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

The updated version of CoSIA introduced an issue for a deprecated tidyr function. The function was changed to the newer function that replaces it.

Author Checklist

  • This repository has a Lasseigne Lab ruleset configured.
    See instructions here.
  • A singularity container has been created with all dependancies and the
    cap_container command has been included in each script using a container.
  • All of the necessary scripts, dependencies, and inputs have been included
    in this pull request.
  • Only files relevant to this change are included; no temporary, generated,
    or unrelated files are part of this pull request. Use .gitignore to prevent
    irrelevant files from accidentally being included.
  • Results have been reproduced and verified with lasseignelab and
    default environments by running the job until two consecutive runs produce
    the same results. Code comments (per script) have been added for
    non-reproducible scripts. Include information about why the script is not
    reproducible.
  • All automated code checks have passed. The "All checks have passed"
    message should show in the GitHub pull request status box above the
    "Merge pull request" button.
  • No merge conflicts exist. Merge conflicts are indicated by the "This
    branch has conflicts that must be resolved" message in the GitHub pull
    request status box above the "Merge pull request" button.
  • Setup instructions have been provided.
  • Reproducing results instructions have been provided.
  • Verification instructions have been provided.
  • Setup, reproduce results, and verification instructions have been tested in a clean scratch environment.
  • Primary and secondary reviewers have been requested to review this
    pull request.

Self/Peer Review Checklist (Coding Guidelines)

  • Meaningful variable and function names
  • File header comments
  • Function comments
  • In-line comments summarize logical sections of code by concisely explaining
    why, not what the code is doing. Avoid excessive or redundant commenting.
  • Random seed is set
  • Reasonable processing time for each job or script is specified
  • All outputs have been saved
  • Session info included in the scripts
  • Cross-reference the working draft of the paper
  • Confirm the code performs the intended analysis
  • Confirm the code reproduces the reported results

Setup

cd $USER_SCRATCH
git clone git@github.com:lasseignelab/CoSIA.git
cd CoSIA
git checkout fix-tidyr

Test

Run the testthat unit test suite:

./tests/test.sh

Validate that the plot has been fixed:

./validation/gene_expression.sh

This image is the broken plot.
wrong-result

This image is the fixed plot.
correct-result

View the plot with the Research Computing Files interface and also run the following md5 command.

md5sum validation/output/gex_plot.png

The md5 output should be.

af0c76b79af4349930686c203e09e432  validation/output/gex_plot.png

Cleanup

cd $USER_SCRATCH
rm -rf CoSIA

toniecrumley and others added 2 commits June 4, 2026 11:43
Replace deprecated tidyr::separate_rows with tidyr::unnest for the VST
list column. separate_rows no longer handles list columns correctly in
current tidyr, causing all VST values to become NA and breaking violin
plot rendering.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace tidyr::separate_rows with tidyr::unnest for the VST list column
in both plot methods. separate_rows no longer handles list columns in
current tidyr, causing all VST values to become NA and breaking violin
rendering.

Add offline tests (test-plots.R) using mock CoSIAn objects with list-column
VST data. Tests fail with separate_rows and pass with unnest.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@toniecrumley
toniecrumley changed the base branch from main to devel June 4, 2026 17:53
@toniecrumley toniecrumley changed the title Fix tidyr Fix tidyr::separate_rows issue with plots Jun 4, 2026
@toniecrumley
toniecrumley marked this pull request as ready for review June 12, 2026 19:35

@tsoelter tsoelter left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the plot to verify both with the md5 as well as visually. 🎉

I get an error when running the test suite, though. See screenshot below:
Image

@tchowton

Copy link
Copy Markdown

I had the same error as Tabea above and this one when running ./validation/gene_expression.sh

CoSIA version : 1.11.2
CoSIA path : /scratch/tchowton/CoSIA

--- DS_Gene multi-species ---
Joining with by = join_by(h_sapiens_ensembl_id)
Joining with by = join_by(h_sapiens_ensembl_id)
'select()' returned 1:1 mapping between keys and columns
'select()' returned 1:1 mapping between keys and columns
Joining with by = join_by(h_sapiens_ensembl_id)
Joining with by = join_by(h_sapiens_ensembl_id)

see ?CoSIAdata and browseVignettes('CoSIAdata') for documentation
downloading 1 resources
retrieving 1 resource
Error loading resource.
attempting to re-download
downloading 1 resources
retrieving 1 resource
ERROR: failed to load resource
name: EH7858
title: VST normalized RNA-Sequencing data with annotations for 362,533,125 Homo sapiens samples from Bgee
reason: 1 resources failed to download
Warning messages:
1: download failed
web resource path: ‘https://experimenthub.bioconductor.org/fetch/7908’
local file path: ‘/data/user/tchowton/bioconductor/bioc-cache/experimenthub/d1bc70aaf_7908’
reason: HTTP 403 Forbidden.
2: bfcadd() failed; resource removed
rid: BFC3
fpath: ‘https://experimenthub.bioconductor.org/fetch/7908’
reason: download failed
3: download failed
hub path: ‘https://experimenthub.bioconductor.org/fetch/7908’
cache resource: ‘EH7858 : 7908’
reason: bfcadd() failed; see warnings()
4: download failed
web resource path: ‘https://experimenthub.bioconductor.org/fetch/7908’
local file path: ‘/data/user/tchowton/bioconductor/bioc-cache/experimenthub/d5fa8643d_7908’
reason: HTTP 403 Forbidden.
5: bfcadd() failed; resource removed
rid: BFC4
fpath: ‘https://experimenthub.bioconductor.org/fetch/7908’
reason: download failed
6: download failed
hub path: ‘https://experimenthub.bioconductor.org/fetch/7908’
cache resource: ‘EH7858 : 7908’
reason: bfcadd() failed; see warnings()
Error: unable to find an inherited method for function ‘plotSpeciesGEx’ for signature ‘object = "NULL"’
Execution halted

@toniecrumley

Copy link
Copy Markdown
Collaborator Author

@tsoelter @tchowton A fix for the test suite failing has been pushed. It should work for Tabea since she probably has the ExperimentHub data cached. The download issue TC is getting seems to be a problem with Bioconductor and ExperimentHub, even though ExperimentHub shows as operational on the Bioconductor status website. After removing my cache, I get the same error on Cheaha and locally trying to access CoSIA data and other data in RStudio.

Our data:

library(ExperimentHub)

eh <- ExperimentHub()
eh["EH7858"]
eh[["EH7858"]]

Other data:

library(ExperimentHub)

eh <- ExperimentHub()
eh["EH5419"]
eh[["EH5419"]]

Screenshot 2026-06-16 at 3 46 25 PM

@toniecrumley
toniecrumley requested a review from tsoelter June 16, 2026 20:55

@tsoelter tsoelter left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You were right, @toniecrumley, I still had the cache, so everything worked, including the test suite!

@toniecrumley

Copy link
Copy Markdown
Collaborator Author

@tchowton ExperimentHub is working this morning, so I was able to run the tests and validation. Please give it another try. Thanks!!

@tchowton tchowton left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests validate now and the image reproduces.

@toniecrumley
toniecrumley merged commit 86d4a39 into devel Jun 30, 2026
1 check passed
@toniecrumley
toniecrumley deleted the fix-tidyr branch June 30, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants