Skip to content

add metadata/copy_modality_slots component#1166

Open
jakubmajercik wants to merge 5 commits into
mainfrom
add-insert-partial-items-component
Open

add metadata/copy_modality_slots component#1166
jakubmajercik wants to merge 5 commits into
mainfrom
add-insert-partial-items-component

Conversation

@jakubmajercik

@jakubmajercik jakubmajercik commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

Changelog

Adds a new metadata/copy_modality_slots component, consolidating PR #1166 (originally dataflow/insert_partial_items) and PR #1163 (dataflow/move_anndata_slots) into a single component covering both use cases.

What it does

Copies items (.obs, .var, .layers, .obsm, .varm, .obsp, .varp, .uns) from a modality in a source MuData file into a modality in a target MuData file. Cross-modality transfers are supported via --source_modality / --target_modality.

Behavior

  • Strict mode (default): source and target .obs/.var index sets must match. Source is reindexed to target order if needed.
  • --allow_partial: source's indices may be a strict subset of target's. Missing rows/cols are NaN-filled (with the appropriate sentinel for nullable DataFrame columns).
  • --allow_overwrite: opt-in; by default the component errors if a key already exists in the target.
  • __auto__ token: per slot, automatically include items present in source but missing from target.
  • --var_match_column: rewrite source .var index from a named column before matching — useful when an upstream step has sanitised gene names.

PR #1163 will be closed.

Checklist before requesting a review

  • I have performed a self-review of my code

  • Conforms to the Contributor's guide

  • Check the correct box. Does this PR contain:

    • Breaking changes
    • New functionality
    • Major changes
    • Minor changes
    • Documentation
    • Bug fixes
  • Proposed changes are described in the CHANGELOG.md

  • CI tests succeed!

@jakubmajercik jakubmajercik marked this pull request as ready for review April 17, 2026 14:34

@DriesSchaumont DriesSchaumont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR and #1163 look very similar. Are separete components required?

@jakubmajercik jakubmajercik changed the title add dataflow/insert_partial_items component add metadata/copy_modality_slots component May 18, 2026
… add-insert-partial-items-component

# Conflicts:
#	CHANGELOG.md
#	src/authors/luke_zappia.yaml

@lazappi lazappi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How would this be used to replicate the move_layer component which moves or copies a single layer/X in one MuData? I guess you could input the same file twice and set the arguments correctly? I don't think this has any way of handling X though which is the main use of move_layer.

@jakubmajercik

Copy link
Copy Markdown
Collaborator Author

How would this be used to replicate the move_layer component which moves or copies a single layer/X in one MuData? I guess you could input the same file twice and set the arguments correctly? I don't think this has any way of handling X though which is the main use of move_layer.

The aim here wasn't to replace move_layer — just #1166 insert_partial_items and #1163 move_anndata_slots

@lazappi lazappi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good to me but Dries should check to see it matches OP

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