Skip to content

mergeDifexp(): return the matrix with a signature metadata table - #283

Open
Cvicnaire wants to merge 1 commit into
devfrom
282-mergedifexp-should-return-signature-metadata-alongside-the-matrix
Open

Cvicnaire wants to merge 1 commit into
devfrom
282-mergedifexp-should-return-signature-metadata-alongside-the-matrix

Conversation

@Cvicnaire

Copy link
Copy Markdown
Collaborator

Closes #282

What changed

mergeDifexp() returns list(matrix, metadata) instead of a bare matrix. metadata is a data frame with one row per matrix column (same order, row names = column names) holding signature_name, the database signature_id (NA for supplied objects), every scalar metadata field of the signatures (vector fields such as keywords collapsed with "; ", nested lists such as others left out) and n_features. It plays the role of a SummarizedExperiment's colData without the Bioconductor dependency, so the pair stays usable outside R. Callers that used the result as a matrix need $matrix; nothing outside the function's own tests did yet.

To carry the database ids, fetchCompareSignatures() also returns ids and resolveCompareSignatureList() gains with_ids = TRUE. compareSignatures() is unchanged.

How it was verified

Rscript -e 'testthat::test_local(filter = "mergeDifexp|compareSignature", reporter = "summary", load_package = "source")'
# ══ DONE ══  (one skip: compareSignatures DB test, SIGREPO_TEST_DB_USER not set)

Rscript -e 'testthat::test_local(reporter = "summary", load_package = "source")'
# 0 failures; 20 skips, all database/live-service tests without credentials

tools::checkRd("man/mergeDifexp.Rd")   # clean

The roxygen example on the bundled signatures prints:

[1] 826   3
                 signature_name     organism  phenotype n_features
v1 Myc_reduce_mice_liver_24m_v1 Mus musculus Myc_reduce        826
v2 Myc_reduce_mice_liver_24m_v2 Mus musculus Myc_reduce        826
v3 Myc_reduce_mice_liver_24m_v3 Mus musculus Myc_reduce        826

New tests cover: list shape, one metadata row per column in column order with matching row names, scalar fields and types, vector collapse, nested-list drop, NA for a field missing from one signature, n_features under union and intersect, dropped signatures absent from the table, and signature_id filled for fetched vs NA for supplied signatures.

Checklist

  • Closes #NNN is filled in above
  • NEWS.md has a bullet for this change, or the PR is labelled no-changelog
  • Branch is short-lived and will be merged on GitHub, then deleted

🤖 Generated with Claude Code

mergeDifexp() now returns list(matrix, metadata) instead of a bare matrix.
`metadata` is a data frame with one row per matrix column, in column
order and with the column names as row names: signature_name, the
database signature_id (NA for supplied objects), every scalar field of
each signature's metadata (vector fields collapsed with "; ", nested
lists such as `others` left out) and n_features, the non-NA count of
that column. It plays the role of a SummarizedExperiment's colData while
staying plain base R so it survives export outside R.

To know which database id each fetched signature came from,
fetchCompareSignatures() now also returns `ids`, and
resolveCompareSignatureList() gains `with_ids = TRUE` to pass them on.
compareSignatures() is unchanged.

Closes #282

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant