atarashansky / SAMap

SAMap: Mapping single-cell RNA sequencing datasets from evolutionarily distant organisms.
MIT License
63 stars 19 forks source link

"ValueError: could not convert string to float" in convert_eggnog_to_homologs() #125

Open Zaffe24 opened 9 months ago

Zaffe24 commented 9 months ago

Dear @atarashansky,

I encountered an error when running the convert_eggnog_to_homologs() function. I would be very glad if you could help me solve this issue. Best regards, Pietro

`EGGs={'mm':mm_ort, 'hg': hg_ort} ortholog_pairs = convert_eggnog_to_homologs(sm,EGGs,og_key='eggNOG_OGs',taxon=4067) paralog_pairs = convert_eggnog_to_homologs(sm,EGGs,og_key='eggNOG_OGs',taxon=9989)

ValueError Traceback (most recent call last) /tmp/ipykernel_22788/151535015.py in 1 EGGs={'mm':mm_ort, 'hg': hg_ort} ----> 2 ortholog_pairs = convert_eggnog_to_homologs(sm,EGGs,og_key='eggNOG_OGs',taxon=4067) 3 paralog_pairs = convert_eggnog_to_homologs(sm,EGGs,og_key='eggNOG_OGs',taxon=9989)

~/.conda/envs/SAMap/lib/python3.7/site-packages/samap/analysis.py in convert_eggnog_to_homologs(sm, EGGs, og_key, taxon) 1107 1108 og = q(A[og_key].reindex(gn)) -> 1109 og[og == "nan"] = "" 1110 1111 X = []

ValueError: could not convert string to float: `

I am using numpy 1.21.6 on Python3.7, I believe it entered in conflict with line 1109.

Here is a snapshot of one of the EGGNOG tables I am using:

Schermata del 2023-09-29 14-52-29

coulterr24 commented 6 months ago

Hey there @Zaffe24,

I was just playing around with eggNOG outputs and the 'convert_eggnog_to_homologs' function, and I ran into the same issue. It turns out that I had duplicate values in my 'query' column from the eggNOG table.

I'd first make sure that the data in the 'query' column are identical to the genes in your SAMap object (prior to the species annotation , e.g. 'mm_'), and then I would check for duplicates in that column!

I hope that helps, and good luck!