atarashansky / SAMap

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

Error when using a custom data set #69

Closed PeiwenJi closed 2 years ago

PeiwenJi commented 2 years ago

Hello! I'm trying to run samap with my own dataset, but something is wrong. My maps are exported directly from Ensembl and have been renamed as samap‘s blast, but when run

sm = SAMAP( filenames, f_maps = 'mydata/maps/' save_processed=True )

as described in Loading in raw data I get the following error. I don't know what to do.


IndexError Traceback (most recent call last) /tmp/ipykernel_3478998/777754579.py in 1 sm = SAMAP( 2 filenames, ----> 3 f_maps = 'mydata/maps/' 4 #save_processed=True #if False, do not save the processed results to *_pr.h5ad 5 )

/samap_directory/samap/mapping.py in init(self, sams, f_maps, names, keys, resolutions, gnnm, save_processed) 161 if gnnm is None: 162 gnnm, gns, gns_dict = _calculate_blast_graph( --> 163 ids, f_maps=f_maps, reciprocate=True 164 )
165 if names is not None:

/samap_directory/samap/mapping.py in _calculate_blast_graph(ids, f_maps, eval_thr, reciprocate) 1118 1119 A = A[A.index.astype("str") != "nan"] -> 1120 A = A[A.iloc[:, 0].astype("str") != "nan"] 1121 B = B[B.index.astype("str") != "nan"] 1122 B = B[B.iloc[:, 0].astype("str") != "nan"]

~/miniconda3/envs/SAMap/lib/python3.7/site-packages/pandas/core/indexing.py in getitem(self, key) 923 with suppress(KeyError, IndexError): 924 return self.obj._get_value(*key, takeable=self._takeable) --> 925 return self._getitem_tuple(key) 926 else: 927 # we by definition only have the 0th axis

~/miniconda3/envs/SAMap/lib/python3.7/site-packages/pandas/core/indexing.py in _getitem_tuple(self, tup) 1504 def _getitem_tuple(self, tup: tuple): 1505 -> 1506 self._has_valid_tuple(tup) 1507 with suppress(IndexingError): 1508 return self._getitem_lowerdim(tup)

~/miniconda3/envs/SAMap/lib/python3.7/site-packages/pandas/core/indexing.py in _has_valid_tuple(self, key) 752 for i, k in enumerate(key): 753 try: --> 754 self._validate_key(k, i) 755 except ValueError as err: 756 raise ValueError(

~/miniconda3/envs/SAMap/lib/python3.7/site-packages/pandas/core/indexing.py in _validate_key(self, key, axis) 1407 return 1408 elif is_integer(key): -> 1409 self._validate_integer(key, axis) 1410 elif isinstance(key, tuple): 1411 # a tuple should already have been caught by this point

~/miniconda3/envs/SAMap/lib/python3.7/site-packages/pandas/core/indexing.py in _validate_integer(self, key, axis) 1498 len_axis = len(self.obj._get_axis(axis)) 1499 if key >= len_axis or key < -len_axis: -> 1500 raise IndexError("single positional indexer is out-of-bounds") 1501 1502 # -------------------------------------------------------------------

IndexError: single positional indexer is out-of-bounds

atarashansky commented 2 years ago

Your tables are likely improperly formatted. Can you upload them so I can take a look?

PeiwenJi commented 2 years ago

Thank you very much for your prompt reply.

I thought it might be, too. This is my table.


,source,target,info,weight 4,MT-ND1,mt-Nd1,ortholog_one2one,1.0 8,MT-ND2,mt-Nd2,ortholog_one2one,1.0 14,MT-CO1,mt-Co1,ortholog_one2one,1.0 17,MT-CO2,mt-Co2,ortholog_one2one,1.0

How should I change it?

atarashansky commented 2 years ago

Yes, your formatting is not correct. Please inspect the mapping tables in the example data folder on the github and try to create something similar - same number of columns, same column IDs, etc. For columns that you don't have information for, just fill it with a dummy value.

PeiwenJi commented 2 years ago

Thank you very much for your help, I'm now able to run it properly.

I set all the dummy values to 0, (except for the last column which is the weight),

image

but I don't know which columns are used in the samap running and what effect it will have on the model results if I set them this way.

I would be very grateful for your answers.