Skip to content

The CreatePairedObject function contains a logic error that leads to mismatched counts matrices between ATAC and RNA modalities. #32

@nh-codem

Description

@nh-codem

When generating paired RNA and ATAC counts datasets based on the df.pair information, the Initial code did not correctly reorder the data according to the cell IDs provided by df.pair, which led to mismatches and disordered pairing.

Initial Code

rna.counts <- LayerData(obj.rna, assay = rna.assay, layer = "counts", cells = df.pair$RNA)
atac.counts <- LayerData(obj.atac, assay = atac.assay, layer = "counts", cells = df.pair$ATAC)

Proposed Fix

To ensure the output matrices are strictly ordered by the pairing information in df.pair, we should reindex the columns after extraction:

rna.counts <- LayerData(obj.rna, assay = rna.assay, layer = "counts", cells = df.pair$RNA)[ , df.pair$RNA]
atac.counts <- LayerData(obj.atac, assay = atac.assay, layer = "counts", cells = df.pair$ATAC)[ , df.pair$ATAC]

@lzj1769

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