Skip to content

exprFormat seems to be modified incorrectly #45

Description

@LIN-Yu-Ting
transfExprFormat <- function(exprMatrix = normCount, colData = colData) {
  df <- as.data.frame(exprMatrix)
  colData$mainCode <- colnames(df)[-which(colnames(df) == "GeneSymbol")]
  print(colnames(df))
  long_df <- tidyr::pivot_longer(df, cols = -GeneSymbol, names_to = "sample", values_to = "expression")
  long_df$group <- colData$subCode[match(long_df$sample, colData$mainCode)]
  
  return(long_df)
}

If colData looks like this:

> +-------+--------+-------+  │
│    |    _c0|mainCode|subCode|  │
│    +-------+--------+-------+  │
│    |DDBM322| DDBM322|   case|  │
│    |DDBM319| DDBM319|control|  │
│    |DDBM316| DDBM316|control|  │
│    |DDBM317| DDBM317|control|  │
│    |DDBM321| DDBM321|   case|  │
│    |DDBM325| DDBM325|   case|  │
│    +-------+--------+-------+  │

Then sequence information will lose after applying colData$mainCode <- colnames(df)[-which(colnames(df) == "GeneSymbol")]

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions