@@ -488,18 +488,10 @@ 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_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
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" )
503
495
if os .path .isfile (barcodes_path ):
504
496
self .row_annotation_file = RecentPath .create (barcodes_path , [])
505
497
@@ -764,21 +756,13 @@ def key(var):
764
756
metas = sorted (metas , key = key ))
765
757
concat_data_t = concat_data .transform (domain )
766
758
data_t = data .transform (domain )
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 )
759
+ source_var .values + (source_name , )
775
760
# metas can be unlocked, source_var added to metas by append_source_name
776
761
with data_t .unlocked (data_t .metas ):
777
- data_t [:, new_source_var ] = np .full (
778
- (len (data_t ), 1 ), source_var_index , dtype = object
762
+ data_t [:, source_var ] = np .full (
763
+ (len (data ), 1 ), len ( source_var . values ) - 1 , dtype = object
779
764
)
780
765
concat_data = Table .concatenate ((concat_data_t , data_t ), axis = 0 )
781
- source_var = new_source_var # Update source_var for the next iteration
782
766
return concat_data
783
767
784
768
@staticmethod
@@ -791,4 +775,4 @@ def append_source_name(data, name):
791
775
# since we added new column to metas
792
776
with data .unlocked (data .metas ):
793
777
data [:, source_var ] = np .full ((len (data ), 1 ), 0 , dtype = object )
794
- return data , source_var
778
+ return data , source_var
0 commit comments