niaid / dsb

Normalize CITEseq Data
Other
63 stars 13 forks source link

return.stats use-case error #32

Closed diegoalexespi closed 2 years ago

diegoalexespi commented 2 years ago

Hi dsb team!

Thank you for the excellent tool and vignettes. I ran into an error when setting the following parameters in DSBNormalizeProtein:

DSBNormalizeProtein(
        cell_protein_matrix = raw_matrix, 
        empty_drop_matrix = background_matrix,
        denoise.counts = TRUE, 
        use.isotype.control = FALSE,
        return.stats = TRUE)

When return.stats = TRUE and use.isotype.control = FALSE, the object noise_matrix will not be instantiated, but the function will attempt to access it, leading to the error: Error in t(noise_matrix) : object 'noise_matrix' not found because of the following lines of code:

https://github.com/niaid/dsb/blob/3531cdc94558ffec09894d3e5ba9d0625f109170/R/dsb.r#L254-L257

I quickly fixed this by adding an if-else statement in a fork, and I can open a pull request to merge if you agree with the fix!

MattPM commented 2 years ago

Hi Diego, thank you for finding this and for this contribution! I've merged your change with the master branch. If no isotypes are specified the technical stats returned is just the technical component.

MattPM commented 2 years ago

@diegoalexespi Hi Diego, thanks again; this is now fixed in dsb version 1.0.2 on CRAN.

-Matt