How to change the attribute values in h5ad file?

Viewed 23

There is an attribute in h5ad file which is var_names. I converted the values of var_names to lowercase. Now I want to save/rewrite the new values to the var_names attribute in the h5ad file. How can I do that?

#ipynb file

    import scanpy as sc
    import anndata as ad
    import pandas as pd
    import numpy as np
    
    file1 = sc.read_h5ad('/Users/nitish/Downloads/human_all.h5ad')
    
    file2 = sc.read_h5ad('/Users/nitish/Downloads/mouse_all.h5ad')
    
    file1.var_names.str.lower()
    file2.var_names.str.lower()
    file1.var_names = file1.var_names.str.lower()
    file2.var_names = file2.var_names.str.lower()

How to save new file1.var_name to the existing h5ad file?

0 Answers
Related