Skip to content

Commit

Permalink
fixed the index error
Browse files Browse the repository at this point in the history
  • Loading branch information
Matiss Ozols committed May 11, 2024
1 parent cf87ee4 commit 9a45fea
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bin/generate_combined_celltype_anotation_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ def main():
adata1 = scanpy.read_h5ad(ad1)
if adata1.n_obs > 0:
adatasets.append(adata1)
ad = adatasets[0].concatenate(*adatasets[1:])
if(len(adatasets)>1):
# in this case the concentration adds a -1 -2 -3 to index that has to be removed.
all_index = pd.DataFrame(ad.obs.index,columns=['col'])
all_indexes = all_index['col'].str.split('-')
all_together = all_indexes.str[0]+'-'+all_indexes.str[1]+'-'+all_indexes.str[2]
ad.obs.set_index(all_together, inplace=True)
ad = adatasets[0].concatenate(*adatasets[1:],index_unique=None)
# if(len(adatasets)>1):
# # in this case the concentration adds a -1 -2 -3 to index that has to be removed.
# all_index = pd.DataFrame(ad.obs.index,columns=['col'])
# all_indexes = all_index['col'].str.split('-')
# all_together = all_indexes.str[0]+'-'+all_indexes.str[1]+'-'+all_indexes.str[2]
# ad.obs.set_index(all_together, inplace=True)

# ad2 = adatasets2[0].concatenate(*adatasets2[1:])
# ad = scanpy.read(adata)
Expand Down

0 comments on commit 9a45fea

Please sign in to comment.