Closed DrYzh2024 closed 5 months ago
It seems like the error derives from dataoader.py Line26: self.gexp = args.sig_mean_znorm. It fixes after changing to self.gexp = args.sig_mean_norm.
Hi thanks for reaching out!
The current pip global installation is outdated. Please try the github version and local installation for now (we're working on update very soon). Sorry for the inconvenience.
I run the same code as tutorials. When I run: model, loss = utils.run_starfysh(visium_args, n_repeats=n_repeats, epochs=epochs, device=device )
The error shows like:
AttributeError Traceback (most recent call last) Cell In[14], line 2 1 # Run models ----> 2 model, loss = utils.run_starfysh(visium_args, 3 n_repeats=n_repeats, 4 epochs=epochs, 5 device=device 6 )
File ~\AppData\Roaming\Python\Python311\site-packages\starfysh\utils.py:389, in run_starfysh(visium_args, n_repeats, lr, epochs, batch_size, alpha_mul, poe, device, seed, verbose) 386 dl_func = VisiumDataset 387 train_func = train --> 389 trainset = dl_func(adata=adata, args=visium_args) 390 trainloader = DataLoader(trainset, batch_size=batch_size, shuffle=True, drop_last=True) 392 # Running Starfysh with multiple starts
File ~\AppData\Roaming\Python\Python311\site-packages\starfysh\dataloader.py:26, in VisiumDataset.init(self, adata, args) 24 x = adata.X if isinstance(adata.X, np.ndarray) else adata.X.A 25 self.expr_mat = pd.DataFrame(x, index=spots, columns=genes) ---> 26 self.gexp = args.sig_mean_znorm 27 self.anchor_idx = args.pure_idx 28 self.library_n = args.win_loglib
AttributeError: 'VisiumArguments' object has no attribute 'sig_mean_znorm'
However, when I run
visium_args = utils.VisiumArguments(adata, adata_normed, gene_sig, img_metadata, n_anchors=60, window_size=3, sample_id=sample_id )
There are some warnings but no error:
[2024-03-29 15:15:08] Subsetting highly variable & signature genes ... [2024-03-29 15:15:45] Smoothing library size by taking averaging with neighbor spots... [2024-03-29 15:15:45] Retrieving & normalizing signature gene expressions... WARNING: genes are not in var_names and ignored: Index(['IGLV3.25', 'HLA.DRA', 'STRA13', 'IGKV1.5', 'HULC', 'RP1.60O19.1', 'HLA.DPB1'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['AP000769.1'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['CLEC3A', 'DSCAM.AS1', 'HLA.DRB1', 'MYEOV2', 'MLLT4'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['FYB', 'IL21'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['CD95L'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['MIR466I', 'MNDAL', 'TMEM55B', 'FAM196B'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['CCL3 CCL3L1'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['CCL3L3', 'SEPP1', 'GPX1'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['FAM26F', 'CCL3L3', 'GPX1'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['IGKV3-15', 'IGHV6-1', 'IGLV1-47', 'IGHV3-30', 'IGLV2-23', 'CH17-224D4.2', 'IGKV1-8', 'IGLV4-69', 'IGKV1-16', 'IGKV3D-11', 'IGHV3-15'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['ARG1'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['GPX1', 'FAM26F', 'RP11-1143G9.4', 'CCL3L3'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['CD11b', 'CD11C', 'CD16', 'CD123', 'CD141', 'EpCAM', 'HLA-DR', 'CD172A'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['CD123', 'IFNA', 'IFNB', 'TNFA'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['IGF2'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['PRKCDBP'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['LHFP'], dtype='object') WARNING: genes are not in var_names and ignored: Index(['SDPR', 'PTRF'], dtype='object') [2024-03-29 15:15:49] Identifying anchor spots (highly expression of specific cell-type signatures)...