satijalab / azimuth

A Shiny web app for mapping datasets using Seurat v4
https://satijalab.org/azimuth
GNU General Public License v3.0
106 stars 30 forks source link

Bug in `AzimuthReference` #219

Open zacharyrs opened 5 months ago

zacharyrs commented 5 months ago

Hey - I recently started using Azimuth and have had some trouble similar to #155 when building a reference:

Reference must contain an AzimuthData object in the tools slot.

It seems the fix (b1b6895) has a bug in the logic trying to generate the automatically assigned tool name.

The Tool<- method gets the function name that called Tool<-, per https://github.com/satijalab/seurat-object/blob/release/5.0.1/R/seurat.R#L2636. In this case, the Tool<- call uses the correct "AzimuthReference".

In contrast, the fix uses the outermost function name from sys.calls(), which corresponds with my wrapper function. It then tries to copy the non-existent value into "AzimuthReference", which deletes the desired entry.

I think this can be fixed by using the innermost (last) function name from sys.calls(), as this is the function that calls Tool<-.

For reference, I am running https://github.com/satijalab/azimuth/tree/release/0.5.0.

z5ouyang commented 5 months ago

That's why I can use "AzimuthReference" in the main function but NOT in a wrapper function. Maybe related to #155