File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -766,6 +766,7 @@ def get_pmatrix(adata,
766
766
"""
767
767
adata_pmatrix_chunks = []
768
768
all_phylostrata_chunks = []
769
+ all_var_names_df_chunks = []
769
770
all_id_age_df_keep_subset_chunks = []
770
771
for i in range (0 , adata .shape [0 ], chunk_size ):
771
772
adata_subset = adata [i :i + chunk_size ]
@@ -799,6 +800,7 @@ def get_pmatrix(adata,
799
800
adata_pmatrix_chunks .append (adata_pmatrix_chunk )
800
801
all_phylostrata_chunks .append (phylostrata_chunk )
801
802
all_id_age_df_keep_subset_chunks .append (id_age_df_keep_subset_chunk )
803
+ all_var_names_df_chunks .append (var_names_df_chunk )
802
804
adata_pmatrix = ad .concat (adata_pmatrix_chunks )
803
805
if add_obs :
804
806
for ko in adata .obs .keys ():
@@ -809,6 +811,11 @@ def get_pmatrix(adata,
809
811
right = adata .var [kv ][adata .var_names .isin (all_id_age_df_keep_subset_chunks [0 ]['GeneID' ])],
810
812
left_index = True ,
811
813
right_index = True )[kv ]
814
+ adata_pmatrix .var ['Phylostrata' ] = list (pd .merge (left = pd .DataFrame (adata_pmatrix .var_names .values ,
815
+ columns = ['GeneID' ]),
816
+ right = all_var_names_df_chunks [0 ],
817
+ how = 'left' ,
818
+ on = 'GeneID' )['Phylostrata' ])
812
819
return adata_pmatrix
813
820
814
821
You can’t perform that action at this time.
0 commit comments