bhklab / CoreGx

Shared code for both PharmacoGx and RadioGx
https://bhklab.github.io/CoreGx/
GNU General Public License v3.0
2 stars 3 forks source link

`reindex` method corrupts referential integrity when a summary assay is present #147

Closed ChristopherEeles closed 2 years ago

ChristopherEeles commented 2 years ago

Minimal reprex:

data(merckLongTable)
merckLongTable$sens_summary <- merckLongTable[, 
    .(mean_drug1dose=mean(drug1dose), 
      mean_drug2dose=mean(drug2dose), 
      mean_viability=mean(viability1)
    ), 
    by=.(drug1id, drug2id, sampleid)
]
merckLongTable2 <- reindex(merckLongTable)
all.equal(merckLongTable$sens_summary, merckLongTable2$sens_summary)

This is happening because the reindex method assumes that there will be no duplicated assay index values, which is not true for summary assays.