Skip to content

Error with gene_covariation_analysis function #3

Description

@reinertanalytics

Hello! I am trying to use the gene_covariation_analysis for ligand receptor analysis and am running into an error. Here is the function as I have it written:

cov_out=scov.gene_covariation_analysis(iNMFmode=True,
Radius=inputRadius,
no_of_factors=3,
refpath=ref_datapath,
quepath=query_datapath,
spatial_integration_modality='double',
output_niche_prediction_dir=output_nico_dir,
ref_cluster_tag=ref_cluster_tag,
LRdbFilename='/Users/PATHNiCoLRdb.txt'
)

and here is the error I am getting:


AttributeError Traceback (most recent call last)
Cell In[38], line 9

----> 9 cov_out=scov.gene_covariation_analysis(iNMFmode=True,
10 Radius=inputRadius,
11 no_of_factors=3,
12 refpath=ref_datapath,
13 quepath=query_datapath,
14 spatial_integration_modality='double',
15 output_niche_prediction_dir=output_nico_dir,
16 ref_cluster_tag=ref_cluster_tag,
17 LRdbFilename='/Users/PATH/NiCoLRdb.txt'
18 )

File /opt/homebrew/Caskroom/miniconda/base/envs/nico_env/lib/python3.11/site-packages/nico/Covariations.py:274, in gene_covariation_analysis(Radius, output_niche_prediction_dir, refpath, quepath, ref_cluster_tag, ref_original_counts, LRdbFilename, iNMFmode, no_of_factors, shap_analysis, shap_cluster_cutoff, cutoff_to_count_exp_cell_population, seed, spatial_integration_modality, anndata_object_name, lambda_c, coeff_cutoff_for_rid_reg, logistic_coef_cutoff)
265 gene_set_names=[]
267 #print('sc1 annotation_singlecell_cluster_id',len(annotation_singlecell_cluster_id))
268 #print('sc2 annotation_singlecell_barcode_id',len(annotation_singlecell_barcode_id))
269 #print('sc3 annotation_singlecell_celltypename',len(annotation_singlecell_celltypename))
(...)
272
273 # load spatial dat
--> 274 sp_genename=sct_ad_sp.var_names.to_numpy()
275 sc_genename=sct_ad_sc.var_names.to_numpy()
276 index_sp,index_sc=find_index(sp_genename,sc_genename)

AttributeError: 'NoneType' object has no attribute 'var_names'

I have checked and my spatial data does have var names:
Gene names (.var_names): Index(['ACSM2B', 'ACTA2', 'ACTG2', 'ADAMTS1', 'ADAMTS6', 'ADGRE2', 'ADGRL3',
'AGTR1', 'ALDH1A2', 'ANO3'],
dtype='object').

I have checked that my gene names are strings. My spatial data is called "sct_spatial.h5ad" and the ref is "sct_singleCell.h5ad" and both are located in the proper folder. Is there something I'm doing wrong here? Thanks again!

Activity

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