waldronlab / MultiAssayExperiment

Bioconductor package for management of multi-assay data
https://waldronlab.io/MultiAssayExperiment/
69 stars 32 forks source link

`subsetByRow()` does not re-order rows #198

Closed lwaldron closed 7 years ago

lwaldron commented 7 years ago

When using a character vector to subset by rows, no ordering of rows occurs. I would expect the rows of ExperimentList elements to be returned in the same order as the character vector.

> example("matrix")
> mae <- MultiAssayExperiment(list(A=mdat, B=mdat[2:1, ]))
> rownames(mae)
CharacterList of length 2
[["A"]] row1 row2
[["B"]] row2 row1
> rownames(mae[c("row1", "row2"), , ])
CharacterList of length 2
[["A"]] row1 row2
[["B"]] row2 row1
> rownames(subsetByRow(mae, c("row1", "row2")))
CharacterList of length 2
[["A"]] row1 row2
[["B"]] row2 row1
>

I would expect:

> rownames(mae[c("row1", "row2"), , ])
CharacterList of length 2
[["A"]] row1 row2
[["B"]] row1 row2

and:

> rownames(mae[c("row1", "row99", "row2"), , ])
CharacterList of length 2
[["A"]] row1 row2
[["B"]] row1 row2

Or is the no-reordering intentional?

lwaldron commented 7 years ago

Just checking, is this ok:

i <- match(rownames(element), i)

when not all rownames (element) are in i, so match() returns some NAs? On Apr 21, 2017 18:24, "Marcel Ramos" notifications@github.com wrote:

Closed #198 https://github.com/waldronlab/MultiAssayExperiment/issues/198 via 3881bc2 https://github.com/waldronlab/MultiAssayExperiment/commit/3881bc2e12bdb03190607a31c2106e09b7787cca .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/waldronlab/MultiAssayExperiment/issues/198#event-1053180757, or mute the thread https://github.com/notifications/unsubscribe-auth/AAnDxr6z2LBunIbgDL4MNybfS-rakMSFks5rySyugaJpZM4NCTB0 .

LiNk-NY commented 7 years ago

Yes, this was fixed in 75bc11de03d52f2ce9bde151bb3418088d4eebf9