Nanostring-Biostats / InSituType

An R package for performing cell typing in SMI and other single cell data
Other
22 stars 10 forks source link

refineClusters bug - got duplicate profiles columns #165

Closed patrickjdanaher closed 1 year ago

patrickjdanaher commented 2 years ago

The call:

res2 = refineClusters(logliks = res$logliks,
                      merges = c("macrophage" = "macrophage SPP1 pos",
                                 "k" = "macrophage DUSP5 pos",
                                 "e" = "plasmablast"), 
                      to_delete = "d", counts = counts, neg = annot$negmean)

The result: I got 2 plasmablast columns in the logliks and profiles

patrickjdanaher commented 1 year ago

Further context: I believe this wouldn't have happened if I'd also entered

     "plasmablast" = "plasmablast",
patrickjdanaher commented 1 year ago

But we could probably change to code to avert this possibility.

patrickjdanaher commented 1 year ago

pushed a fix:

# prevent merging into existing names:
  duplicatednames <- intersect(merges, colnames(logliks))
  merges[is.element(merges, duplicatednames)] <- paste0(merges[is.element(merges, duplicatednames)], ".new")