Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mabar1 opened this issue Dec 22, 2021 · 3 comments
Open
Assignees
Labels
troubleshooting Troubleshooting an issue, that doesn't appear to be a fundamental error in the code.

Comments

@mabar1
Copy link

mabar1 commented Dec 22, 2021

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

@tomashhurst
Copy link
Member

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

@tomashhurst tomashhurst self-assigned this Mar 23, 2022
@tomashhurst tomashhurst added the troubleshooting Troubleshooting an issue, that doesn't appear to be a fundamental error in the code. label Mar 23, 2022
@camilafz
Copy link

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.

@mabar1
Copy link
Author

mabar1 commented Apr 27, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
troubleshooting Troubleshooting an issue, that doesn't appear to be a fundamental error in the code.
Projects
None yet
Development

No branches or pull requests

3 participants