kaizhang / SnapATAC2

Single-cell epigenomics analysis tools
https://kzhang.org/SnapATAC2/
223 stars 24 forks source link

snap.pp.import_data results in RuntimeError: H5Fcreate(): unable to create file: unable to truncate a file which is already open #317

Closed wgao688 closed 2 months ago

wgao688 commented 2 months ago

Hi Kai, thanks for the great package! It is much more scalable than other packages out there. When I am running the import_data command, I get this error. I was not getting this error before and I feel like it may have to do with h5py corruption, but I have deleted the .h5ad files for my fragment files and am still getting this error. I have 20 samples and it appears that if I run a subset of these samples (e.g., files[1:8] or files[8:10]), the error goes away, but I have not been able to isolate any specific fragment files that cause the issue.

snap.pp.import_data(fragment_file = files, file = output_h5ad, chrom_sizes=snap.genome.hg38, sorted_by_barcode=False, tempdir = temp_dir)

adatas = [internal.AnnData(filename=f, backend=backend) for f in file] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: H5Fcreate(): unable to create file: unable to truncate a file which is already open

wgao688 commented 2 months ago

I figured out the issue. There were some fragment files that were repeated in the files, which resulted in h5F trying to create a file when it was already open.