[docs]defprocess_matrix(args_json:str):args=json.loads(args_json)# Load gene setwithopen(args["gene_annotation_file"])asf:gene_set=json.load(f)# Create gene set mappinggene_map={gene:idxforidx,geneinenumerate(gene_set)}# Create TileDB arraycreate_tiledb_array(f"{args['output_dir']}/assays/{args['matrix_options']['matrix_name']}",matrix_dim_dtype=np.dtype(args["matrix_options"].get("dtype","float32")),)# Process each fileoffset=0forfileinargs["files"]:matrix=uad.remap_anndata(file,gene_map,layer_matrix_name=args["matrix_options"]["matrix_name"])write_csr_matrix_to_tiledb(f"{args['output_dir']}/assays/{args['matrix_options']['matrix_name']}",matrix[args["matrix_options"]["matrix_name"]],row_offset=offset,)offset+=matrix[args["matrix_options"]["matrix_name"]].shape[0]