Spectre icon indicating copy to clipboard operation
Spectre copied to clipboard

write.hdf5: Error in quantile.default(over.one, 0.05), missing values

Open mabar1 opened this issue 3 years ago • 3 comments

Hi all After the workshop organized by Désirée Kunkel I gave the multicut approach another try, but for reasons I do not understand, some of my ROIs have NAs in the channels I want to merge, leading to Error in quantile.default(over.one, 0.05) : missing values and NaN's not allowed if 'na.rm' is FALSE One can patch that by adding na.rm=T whenever write.hdf5 is calculating quantiles within the !is.null(merge.channels) bracket like so (I never tried if all 4 na.rm are needed, I just patched them all at once):

for (u in names(rw.tbl)) {
                over.one <- rw.tbl[[u]][rw.tbl[[u]] > 0]
                # take NAs out since this seems to crash the function:
                rw.tbl[[u]][rw.tbl[[u]] <= quantile(over.one, 
                                                    0.05, na.rm = TRUE)] <- 0 
            }
            rw.sms <- rowSums(rw.tbl)
            # same game here: add all na.rm=T patches the crash:
            rw.sms[rw.sms > quantile(rw.sms, 0.95, na.rm = TRUE)] <- quantile(rw.sms, 0.95, na.rm = TRUE)
            # same game here: add all na.rm=T patches the crash:
            rw.sms[rw.sms <= quantile(rw.sms, 0.05, na.rm = TRUE)] <- 0

The question I got however is, what is the likely cause for NAs in these tiffs? And: Going with na.rm into that function, am I likely to get some weird effects in the merged channel? I didnt check them in ilastik yet (I gotta find 1.3.3post2 first...)

Best, matthias

mabar1 avatar Dec 22 '21 15:12 mabar1

@mabar1 that is actually pretty unusual. Are you using IMC data?

tomashhurst avatar Mar 23 '22 08:03 tomashhurst

Hi, Just wanted to add to this that I had the same problem... I checked my channels and it seems that in one of them the staining did not work at all, I basically have an empty channel and that was causing the problem. Once I removed that one channel the merging worked perfectly.

camilafz avatar Apr 27 '22 08:04 camilafz

Hi, yes that could be the case. I got one channel that I keep in the data that was used in the first few batches but was left empty in later ones. That was mostly the reason for that problem. Thank you so much! @tomashhurst yes these are IMC data

mabar1 avatar Apr 27 '22 10:04 mabar1