@@ -488,10 +488,18 @@ def leading_cols(self, value):
488
488
489
489
def _set_annotation_files (self ):
490
490
dir_name , _ = os .path .split (self ._file_name )
491
- genes_path = os .path .join (dir_name , "genes.tsv" )
492
- if os .path .isfile (genes_path ):
493
- self .col_annotation_file = RecentPath .create (genes_path , [])
494
- barcodes_path = os .path .join (dir_name , "barcodes.tsv" )
491
+ genes_paths = ['genes.tsv' , 'features.tsv' , 'genes.tsv.gz' , 'features.tsv.gz' ]
492
+ for genes_path in genes_paths :
493
+ genes_path = os .path .join (dir_name , genes_path )
494
+ if os .path .isfile (genes_path ):
495
+ self .col_annotation_file = RecentPath .create (genes_path , [])
496
+ break
497
+ barcodes_paths = ['barcodes.tsv' , 'barcodes.tsv.gz' ]
498
+ for barcodes_path in barcodes_paths :
499
+ barcodes_path = os .path .join (dir_name , barcodes_path )
500
+ if os .path .isfile (barcodes_path ):
501
+ self .row_annotation_file = RecentPath .create (barcodes_path , [])
502
+ break
495
503
if os .path .isfile (barcodes_path ):
496
504
self .row_annotation_file = RecentPath .create (barcodes_path , [])
497
505
@@ -756,13 +764,21 @@ def key(var):
756
764
metas = sorted (metas , key = key ))
757
765
concat_data_t = concat_data .transform (domain )
758
766
data_t = data .transform (domain )
759
- source_var .values + (source_name , )
767
+
768
+ new_values = source_var .values + (source_name ,)
769
+ new_source_var = DiscreteVariable (source_var .name , values = new_values )
770
+ new_metas = tuple (var if var .name != source_var .name else new_source_var for var in domain .metas )
771
+ new_domain = Domain (domain .attributes , metas = new_metas )
772
+ concat_data_t = concat_data_t .transform (new_domain )
773
+ data_t = data_t .transform (new_domain )
774
+ source_var_index = new_source_var .values .index (source_name )
760
775
# metas can be unlocked, source_var added to metas by append_source_name
761
776
with data_t .unlocked (data_t .metas ):
762
- data_t [:, source_var ] = np .full (
763
- (len (data ), 1 ), len ( source_var . values ) - 1 , dtype = object
777
+ data_t [:, new_source_var ] = np .full (
778
+ (len (data_t ), 1 ), source_var_index , dtype = object
764
779
)
765
780
concat_data = Table .concatenate ((concat_data_t , data_t ), axis = 0 )
781
+ source_var = new_source_var # Update source_var for the next iteration
766
782
return concat_data
767
783
768
784
@staticmethod
0 commit comments