neurogenomics / MAGMA_Celltyping

Find causal cell-types underlying complex trait genetics
https://neurogenomics.github.io/MAGMA_Celltyping
71 stars 31 forks source link

Avoid accidentally renaming columns #60

Closed bschilder closed 2 years ago

bschilder commented 2 years ago

When you turn an object into a data.frame, it by default edits the column/row names (e.g. replaces spaces with "."s). This makes it difficult to later query a particular cell-type of interest because the user doesn't know how the names were changed exactly.

I've gone through and added the following arguments whenever data.frame is called:

df <- data.frame(dat,
                            check.rows = FALSE, 
                            check.names = FALSE)
bschilder commented 2 years ago

This renaming also occurs when reading in file with functions such as:

utils::read.table()
bschilder commented 2 years ago

That said, not renaming the columns means that errors can occur due to spaces being in some colnames.

In EWCE >=1.3.2, I've added a function fix_celltype_names() to help remove problematic characters and replace them with "_". This function is called internally to help interpret when users specify controlling a particular celltype that has been automatically renamed by standardise_ctd internally.