Skip to content

Commit

Permalink
force the merged data to match the input order
Browse files Browse the repository at this point in the history
  • Loading branch information
zktuong committed Dec 10, 2024
1 parent 537f69a commit 4a2e080
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions R/combineExpression.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ combineExpression <- function(input.data,

combined_col_names <- unique(c(colnames(colData(sc.data)), colnames(PreMeta)))
full_data <- merge(colData(sc.data), PreMeta[rownames, , drop = FALSE], by = "row.names", all.x = TRUE)
# at this point, the rows in full_data are shuffled. match back with the original colData
full_data <- full_data[match(rownames, full_data[,1]), ]
rownames(full_data) <- full_data[, 1]
full_data <- full_data[, -1]
colData(sc.data) <- DataFrame(full_data[, combined_col_names])
Expand Down

0 comments on commit 4a2e080

Please sign in to comment.