80810

Error message: h5py.h5py_warnings.H5pyDeprecationWarning: dataset.value has been deprecated. Use dat

<h3>Question</h3>

I'm tring to run mbin for methylation analysis. But get error message: h5py.h5py_warnings.H5pyDeprecationWarning: dataset.value has been deprecated. Use dataset[()] instead. for several attempts, while trying to extract control IPDs with buildcontrols.
Environment:

<ul><li>mbin version: 1.1.1</li> <li>Python version:2.7.12 </li> <li>Operating System: centOS</li> <li>running under virtualenv</li> </ul>

I thought it was, again, caused by version. What I've tried: I tried on a server with both python 3 and 2. And specified virtualenv to use python 2 as interpreter. mbin was successfully installed, but buidlcontrols didn't.

(virtualenv_for_mbin) [yx@localhost virtualenv_for_mbin]$ buildcontrols -i --procs=4 --control_pkl_name=control_means_190201.pkl /data1/yuxiao/userdata1/jobs/016/016504/data/aligned_reads.cmp.h5 2019-02-01 23:36:31 [INFO] Initiating dictionary of all possible motifs... 2019-02-01 23:36:31 [INFO] - Adding 256 4-mer motifs... 2019-02-01 23:36:31 [INFO] Done: 256 possible contiguous motifs 2019-02-01 23:36:31 [INFO] - Adding 1024 5-mer motifs... 2019-02-01 23:36:31 [INFO] Done: 1536 possible contiguous motifs 2019-02-01 23:36:31 [INFO] - Adding 4096 6-mer motifs... 2019-02-01 23:36:32 [INFO] Done: 7680 possible contiguous motifs 2019-02-01 23:36:32 [INFO] - Adding bipartite motifs to search space... 2019-02-01 23:36:33 [INFO] Done: 194560 possible bipartite motifs 2019-02-01 23:36:33 [INFO] 2019-02-01 23:36:33 [INFO] Preparing to create new control data in ctrl_tmp Traceback (most recent call last): File "/data2/Software/virtualenv_for_mbin/bin/buildcontrols", line 10, in <module> sys.exit(launch()) File "/data2/Software/virtualenv_for_mbin/lib/python2.7/site-packages/mbin/controls.py", line 20, in launch extract_controls(opts, control_aln_fn) File "/data2/Software/virtualenv_for_mbin/lib/python2.7/site-packages/mbin/controls.py", line 40, in extract_controls opts = controls.scan_WGA_aligns() File "/data2/Software/virtualenv_for_mbin/lib/python2.7/site-packages/mbin/controls.py", line 352, in scan_WGA_aligns reader = openIndexedAlignmentFile(self.control_aln_fn) File "/data2/Software/virtualenv_for_mbin/lib/python2.7/site-packages/pbcore/io/opener.py", line 52, in openIndexedAlignmentFile return CmpH5Reader(fname, sharedIndex=sharedIndex) File "/data2/Software/virtualenv_for_mbin/lib/python2.7/site-packages/pbcore/io/align/CmpH5IO.py", line 729, in __init__ self._loadAlignmentInfo(sharedIndex) File "/data2/Software/virtualenv_for_mbin/lib/python2.7/site-packages/pbcore/io/align/CmpH5IO.py", line 745, in _loadAlignmentInfo rawAlignmentIndex = self.file["/AlnInfo/AlnIndex"].value 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 "/data2/Software/virtualenv_for_mbin/lib/python2.7/site-packages/h5py/_hl/dataset.py", line 313, in value "Use dataset[()] instead.", H5pyDeprecationWarning) h5py.h5py_warnings.H5pyDeprecationWarning: dataset.value has been deprecated. Use dataset[()] instead.

I checked python version:

(virtualenv_for_mbin) [yx@localhost virtualenv_for_mbin]$ python -V Python 3.6.5 :: Anaconda, Inc.

So, I immediately tried to run a new virtualenv.

[yx@localhost Software]$ mkdir venv_tmp [yx@localhost Software]$ cd venv_tmp/ [yx@localhost venv_tmp]$ virtualenv --python=/usr/local/bin/python2.7 . Running virtualenv with interpreter /usr/local/bin/python2.7 New python executable in /data2/Software/venv_tmp/bin/python2.7 Also creating executable in /data2/Software/venv_tmp/bin/python Installing setuptools, pip, wheel... done. [yx@localhost venv_tmp]$ . bin/activate (venv_tmp) [yx@localhost venv_tmp]$ python -V Python 3.6.5 :: Anaconda, Inc.

Then, I turned to another server.....with only python 2.7 installed.

(venv_for_mbin) [yuxiao@localhost data_tmp]$ buildcontrols -i --procs=4 --control_pkl_name=control_means_190202.pkl aligned_reads.cmp.h5 2019-02-02 11:06:16 [INFO] Initiating dictionary of all possible motifs... 2019-02-02 11:06:16 [INFO] - Adding 256 4-mer motifs... 2019-02-02 11:06:16 [INFO] Done: 256 possible contiguous motifs 2019-02-02 11:06:16 [INFO] - Adding 1024 5-mer motifs... 2019-02-02 11:06:16 [INFO] Done: 1536 possible contiguous motifs 2019-02-02 11:06:16 [INFO] - Adding 4096 6-mer motifs... 2019-02-02 11:06:16 [INFO] Done: 7680 possible contiguous motifs 2019-02-02 11:06:16 [INFO] - Adding bipartite motifs to search space... 2019-02-02 11:06:18 [INFO] Done: 194560 possible bipartite motifs 2019-02-02 11:06:18 [INFO] 2019-02-02 11:06:18 [INFO] Preparing to create new control data in ctrl_tmp Traceback (most recent call last): File "/data1/yuxiao/venv_for_mbin/bin/buildcontrols", line 10, in <module> sys.exit(launch()) File "/data1/yuxiao/venv_for_mbin/lib/python2.7/site-packages/mbin/controls.py", line 20, in launch extract_controls(opts, control_aln_fn) File "/data1/yuxiao/venv_for_mbin/lib/python2.7/site-packages/mbin/controls.py", line 40, in extract_controls opts = controls.scan_WGA_aligns() File "/data1/yuxiao/venv_for_mbin/lib/python2.7/site-packages/mbin/controls.py", line 352, in scan_WGA_aligns reader = openIndexedAlignmentFile(self.control_aln_fn) File "/data1/yuxiao/venv_for_mbin/lib/python2.7/site-packages/pbcore/io/opener.py", line 52, in openIndexedAlignmentFile return CmpH5Reader(fname, sharedIndex=sharedIndex) File "/data1/yuxiao/venv_for_mbin/lib/python2.7/site-packages/pbcore/io/align/CmpH5IO.py", line 729, in __init__ self._loadAlignmentInfo(sharedIndex) File "/data1/yuxiao/venv_for_mbin/lib/python2.7/site-packages/pbcore/io/align/CmpH5IO.py", line 745, in _loadAlignmentInfo rawAlignmentIndex = self.file["/AlnInfo/AlnIndex"].value 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 "/data1/yuxiao/venv_for_mbin/lib/python2.7/site-packages/h5py/_hl/dataset.py", line 313, in value "Use dataset[()] instead.", H5pyDeprecationWarning) h5py.h5py_warnings.H5pyDeprecationWarning: dataset.value has been deprecated. Use dataset[()] instead. (venv_for_mbin) [yuxiao@localhost data_tmp]$ python -V Python 2.7.12

Still got the same error message. And I'm here hoping someone can help me. Thx a lot.


<h3>Answer1:</h3>

As you said, you need to use the new way of getting scalar values out. The .value syntax still works, but who wants to see pink warnings in Jupyter?

The message is not very intuitive, as isn't the syntax. So I will spell this out here - you have a d5py.File called f:

>>> f = h5py.File('temp.h5') >>> f['path/to/scalar'] = 5 >>> f['path/to/scalar'].value (...)\site-packages\h5py\_hl\dataset.py:313: H5pyDeprecationWarning: dataset.value has been deprecated. Use dataset[()] instead. "Use dataset[()] instead.", H5pyDeprecationWarning) 5

"Use dataset[()] instead" means literally "use the indexing (__getitem__) operator, and pass to it an empty tuple (()). So the last line should read:

>>> f['path/to/scalar'][()] 5

If you feel this is a bit of a strange, exotic notation, I can only empathize.

But it makes some sense - the numpy.shape of scalar values is in fact ().

来源:https://stackoverflow.com/questions/54489830/error-message-h5py-h5py-warnings-h5pydeprecationwarning-dataset-value-has-been

Recommend

  • C# UnhandledException from another thread keeps looping
  • Pthread_create fails after creating several threads
  • Clang++ -fmodules errors using types after #include
  • Sending email with VBA under the same Outlook conversation
  • How to generate the password in PHP as it did by Devise Gem in Ruby on Rails
  • Is there an alternative for sys.exit() in python?
  • How to implement singleton pattern in android
  • Create a JSON document from NSObject with SwiftyJSON
  • Bluetooth on Raspberry Pi Zero W, using buildroot
  • python assign value to pandas df if falls between range of dates in another df
  • finding contiguous Subset with Largest Sum
  • Parallel exact matrix diagonalization with Python
  • while installing xuggler in ubuntu 11.10 getting error message
  • Google Apps Script - Send email based on data in cell
  • phonegap: is it possible to detect double touch swipe from Javascript?
  • IntelliJ Tomcat Server plugin fails to auto-populate my empty external Tomcat `base` folder
  • kafka-topics.sh ---delete --topic ''testTopic'' is not working for kafka V 0.10.
  • Why does IntStream.range(0, 100000).parallel.foreach take longer then normal for loop
  • ImportError with importing keras
  • Error: packet sequence number wrong after upgrading RDS instance
  • How to send binary with spring boot websocket?
  • In Moment.js, how do you get the date of the next occurrence of a specific month (ex: 'next Jan
  • Using one probability set to generate another [duplicate]
  • Application backgrounding in Xamarin.Mac
  • Using PHP & Tornado
  • Why clearfsimport command adds file to source control with a size zero?
  • Threads and Concurrent Modification Exception working with a list
  • In metro, get all inherited classes of an (abstract) class?
  • ASP.NET GridView throws: The version of SQL Server in use does not support datatype 'date'
  • How does the dispatcher work when mixing sync/async with serial/concurrent queue?
  • Django REST framework - HyperlinkedRelatedField with additional parameter
  • How to use Typescript with libraries like Ampersand.js that parse configs to build prototypes
  • openpyxl - adding new rows in excel file with merged cell existing
  • Is there a better way for handling SpatialPolygons that cross the antimeridian (date line)?
  • How to call jQuery function in HTML returned by AJAX
  • How do I add a mouse over tooltip to an Image using .DrawImage()
  • How to warp text around image in iOS?
  • Bad automatic Triangulation with Mayavi for coloring a surface known only by its corner