SnapATAC2 icon indicating copy to clipboard operation
SnapATAC2 copied to clipboard

Unable to edit backed AnnData

Open jpmcga opened this issue 1 year ago • 2 comments

Hi,

Thanks again for writing a wonderful package. I'm currently trying to implement the backed AnnData objects into a pipeline I'm building. I have a couple items of feedback to share, but I'll start with this one.

After I create backed AnnData objects via pp.import_data I'm unable to add new columns to .obs (i.e., adata.obs["barcode"] = adata.obs_names). Attempting to do so, I get the error

called `Result::unwrap()` on an `Err` value: H5Ldelete(): unable to delete link: no write intent on file note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm able to resolve this error by closing the AnnData object (adata.close()), and then rereading with write permissions (adata = snap.read(f"{file_name}.h5ad", "r+")). While this works, it's awkward and I have to do it again after running snap.metrics.tsse. I wonder if there's a better way to specify permissions when create backed AnnData objects. If not, perhaps an option to specify in import_data would be helpful.

Thanks!

jpmcga avatar Dec 11 '24 18:12 jpmcga