Skip to content

Error when extracting SICs #5

Closed

Description

@akilgall

Hello,
I have hit an unexpected issue when trying to use SICs to model sparsely labeled cell-types:

cts <- unique(adata$obs$Immune_func)
cts
[1] tumorcells othercells granulocytecells cd4tcells fibroblastcells cd4tcells_ICOS
[7] endothilialcells myofibroblastcells cd4tregcells immunenoscells myeloidnoscells macrophagecells
[13] bcells plasmacells cd8tcells cd4tcells_PD1 cd8tcells_Granzymeb cd4tregcells_ICOS
[19] cd4tcells_PDL1 cd8tcells_PD1 cd4tregcells_PD1 cd4tregcells_PD1_ICOS cd4tcells_PD1_ICOS macrophagecells_PDL1
[25] cd4tcells_PD1_PDL1 cd8tcells_PD1_PDL1 immunenoscells_IDO1_IDO1 macrophagecells_IDO1_IDO1 cd8tcells_PD1_Granzymeb fibroblastcells_IDO1
[31] fibroblastcells_IDO1_IDO1 cd4tcells_IDO1 macrophagecells_IDO1 cd4tcells_IDO1_IDO1 macrophagecells_PDL1_IDO1 immunenoscells_IDO1
36 Levels: bcells cd4tcells cd4tcells_ICOS cd4tcells_IDO1 cd4tcells_IDO1_IDO1 cd4tcells_PD1 cd4tcells_PD1_ICOS cd4tcells_PD1_PDL1 cd4tcells_PDL1 ... tumorcells

prep <- prepare_spatial_model_data(
x = adata$obs$x,
y = adata$obs$y,
cell_type = adata$obs$Immune_func,
image_id = adata$obs$patientid,
patient_metadata = patient_metadata,
n_dummy = 500,
type_idx = 1,
#n_basis_functions = 4,
max_dist = 150
)

fit <- run_SHADE_model(
prep$stan_data,
method = "variational",
seed = 123,
)

sics_group <- extract_group_sics(
fit = fit,
prep = prep,
bands = "simultaneous",
alpha = 0.1,
)
Error in mul.tensor(x_tensor, 3, y_tensor, 2, by = 1) :
mul.tensor: i incompatible to j
In addition: Warning message:
In .extract_group_sics(draws, x_des, distance_seq, source_types, :
Expected 3 coefficients for cd4tcells -> bcells, found 24

This seems to work when I use a coarser cell-type definition that only has 12 classes (adata$obs$celltypes).

Thank you!

Activity

  1. added a commit that references this issue on Feb 3, 2026
    690d7bf
  2. jeliason commented on Feb 3, 2026

    @jeliason
    Owner

    Thanks for trying out SHADE! Looks like it was likely a regex issue - I've opened a PR (#6 ) with a fix. Can you try installing from that branch and running again?

  3. akilgall commented on Feb 4, 2026

    @akilgall
    Author

    Can confirm that this rectifies the issue.
    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions