xryanglab / RiboCode

release version
MIT License
48 stars 15 forks source link

psites HDF5 file fails to be created #32

Closed Roleren closed 2 years ago

Roleren commented 2 years ago

My run failed for my dataset, that has all genes set to equal length. What happens is this (I here display the partial hdf5 file):

  group           name       otype dclass        dim
0     /        p_sites H5I_DATASET   VLEN 551 x 1000
1     / transcript_ids H5I_DATASET STRING       1000

You see the "psites_number" table is not made, because it fails at inserting the "p_sites" table properly. I think the newest h5py with anaconda (3.6.0) version does not work now as the code is implemented, or am I wrong here?

ERROR is:

Traceback (most recent call last):
  File "/home/roler/anaconda3/envs/ribocode_env/bin/RiboCode", line 10, in <module>
    sys.exit(main())
  File "/home/roler/anaconda3/envs/ribocode_env/lib/python3.9/site-packages/RiboCode/RiboCode.py", line 40, in main
    tpsites_sum, total_psites_number = process_bam.psites_count(configIn.configList,transcript_dict,thread_num=1)
  File "/home/roler/anaconda3/envs/ribocode_env/lib/python3.9/site-packages/RiboCode/process_bam.py", line 111, in psites_count
    tpsites_sum,total_psites_number = read_bam(configList[0])
  File "/home/roler/anaconda3/envs/ribocode_env/lib/python3.9/site-packages/RiboCode/process_bam.py", line 84, in read_bam
    write_psites(tpsites,psites_number, name + "_psites.hd5")
  File "/home/roler/anaconda3/envs/ribocode_env/lib/python3.9/site-packages/RiboCode/process_bam.py", line 26, in write_psites
    fout.create_dataset("p_sites",data=list(tpsites.values()),dtype=dt, compression="gzip")
  File "/home/roler/anaconda3/envs/ribocode_env/lib/python3.9/site-packages/h5py/_hl/group.py", line 149, in create_dataset
    dsid = dataset.make_new_dset(group, shape, dtype, data, name, **kwds)
  File "/home/roler/anaconda3/envs/ribocode_env/lib/python3.9/site-packages/h5py/_hl/dataset.py", line 145, in make_new_dset
    dset_id.write(h5s.ALL, h5s.ALL, data)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5d.pyx", line 232, in h5py.h5d.DatasetID.write
  File "h5py/_proxy.pyx", line 145, in h5py._proxy.dset_rw
  File "h5py/_conv.pyx", line 784, in h5py._conv.ndarray2vlen
AttributeError: 'int' object has no attribute 'dtype'

I tried to make the h5 file from scratch, but it still fails with this error:

Traceback (most recent call last):
  File "/home/roler/anaconda3/envs/ribocode_env/bin/RiboCode", line 10, in <module>
    sys.exit(main())
  File "/home/roler/anaconda3/envs/ribocode_env/lib/python3.9/site-packages/RiboCode/RiboCode.py", line 40, in main
    tpsites_sum, total_psites_number = process_bam.psites_count(configIn.configList,transcript_dict,thread_num=1)
  File "/home/roler/anaconda3/envs/ribocode_env/lib/python3.9/site-packages/RiboCode/process_bam.py", line 111, in psites_count
    tpsites_sum,total_psites_number = read_bam(configList[0])
  File "/home/roler/anaconda3/envs/ribocode_env/lib/python3.9/site-packages/RiboCode/process_bam.py", line 49, in read_bam
    tpsites,psites_number = load_psites(name + "_psites.hd5" )
  File "/home/roler/anaconda3/envs/ribocode_env/lib/python3.9/site-packages/RiboCode/process_bam.py", line 35, in load_psites
    psites_number = fin["psites_number"].value
AttributeError: 'Dataset' object has no attribute 'value'

It now says there is no ".value" getter, which might be because ".value" is deprecated? Relevant link: https://stackoverflow.com/questions/67409919/attributeerror-dataset-object-has-no-attribute-value

zhengtaoxiao commented 2 years ago

This error has been solved in RiboCode v1.2.14