-
Notifications
You must be signed in to change notification settings - Fork 3
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
subset_fov Function Fails with UndefVarError for VisiumHD Data #11
Comments
Hi |
Hi, I encountered an issue when running the following code: This results in an UndefVarError stating "x_col not defined":
Attempting to dive deeper into the source with @edit cs.subset_fov(hd, [193,197,333,337], 20,20) yielded the following relevant part of the code:
As a newcomer to Julia, I am unsure if this is a simple syntax error or if there is another underlying issue. I have had no problems when running similar functions with Cartana and Visium data. Thank you very much for your support! Best regards |
I still do not see the function subset_fov(sp::get_object_group("Spatial"), fov::Vector{Int64}, n_fields_x::Int64, n_fields_y::Int64)
if isa(sp, VisiumObject)
df = deepcopy(sp.spmetaData)
rename!(df, [:barcode, :pxl_row_in_fullres, :pxl_col_in_fullres] .=> [:cell, :x, :y])
elseif isa(sp, VisiumHDObject)
if isa(sp.alterImgData, Nothing)
df = deepcopy(sp.spmetaData)
rename!(df, [:barcode, :pxl_row_in_fullres, :pxl_col_in_fullres] .=> [:cell, Symbol(x_col), Symbol(y_col)])
else
df = deepcopy(sp.alterImgData.posData.positions["high_pos"])
end
else
df = deepcopy(sp.spmetaData.cell)
end
pts, centroids = split_field(df, n_fields_x, n_fields_y)
pts_sub=pts[fov]
min_pt=minimum(minimum(pts_sub))
max_pt=maximum(maximum(pts_sub))
min_pt=convert(Vector{Float32}, min_pt)
max_pt=convert(Vector{Float32}, max_pt)
df_sub=filter([:x, :y] => (x, y) -> x > min_pt[1] && x < max_pt[1] && y > min_pt[2] && y < max_pt[2], df)
return df_sub
end You can reinstall the package and see if the issue goes away. |
Hi, thank you very much for your response. I have updated the version of CellScopes, and I found the sp_utils.jl file. This part indeed does not have an issue with .=>>. However, when running cs.subset_fov with VisiumHDObject, I still encounter an error:
I am running the original function, where sp is a VisiumHDObject. In this part:
|
I see the bug now. I have fixed it. Thanks for reporting. |
I greatly appreciate the time and effort you've dedicated to addressing my previous issues—your detailed responses have been incredibly helpful. Thank you for your patience and support. I apologize for the inconvenience, but I have a few more questions:
cs.plot_fov(xenium, 20, 10)
I appreciate any advice you can provide. Thank you in advance. |
Hi, 1. I encountered an error while testing the Xenium data. The cs.subset_fov function works well with Xenium objects, however, I receive an error when using cs.plot_fov: 2. Now that you have fixed the part for VisiumHD, do I need to reinstall CellScopes right now? 3. Regarding some Xenium data, the 10X official site generally provides OME-tiff files... Hope this helps and thanks for reporting bugs! |
Dear CellScopes Team,
I encountered an error while running the subset_fov function for VisiumHD data using the following code:
df = cs.subset_fov(hd, [89,109], 26, 20)
Here is the error message I received:
While reviewing the function definition, I noticed the following line:
rename!(df, [:barcode, :pxl_row_in_fullres, :pxl_col_in_fullres] .=>> [:cell, Symbol(x_col), Symbol(y_col)])
I was wondering if perhaps the .=>> should be replaced with .=>. I am not entirely sure if this change is appropriate. This function has worked excellently with other Visium data sets, and this issue seems to be specific to VisiumHD.
Any guidance or clarification you could provide would be greatly appreciated.
The text was updated successfully, but these errors were encountered: