Question: Using Hdf5 To Store Bio-Data
17
gravatar for Pierre Lindenbaum
10.4 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum129k wrote:

Hi all, has anobody ever used the HDF5 API to store some biological data (genotypes...). I know about this kind of reference (BioHDF...) but I'm looking for some source code I could browse to understand how I can access data faster.

Pierre

PS: hum, I'm a new user. I'm not allowed to add the following tags: storage database hdf5 source code

data • 8.3k views
ADD COMMENTlink modified 6.1 years ago by Biostar ♦♦ 20 • written 10.4 years ago by Pierre Lindenbaum129k
11
gravatar for Abhishek Tiwari
10.4 years ago by
Abhishek Tiwari110 wrote:

This might be useful for you. This code snippet read the Simulation data and manipulate in HDF5.

ADD COMMENTlink modified 22 months ago by RamRS27k • written 10.4 years ago by Abhishek Tiwari110

Thank you Abhishek !

ADD REPLYlink written 10.4 years ago by Pierre Lindenbaum129k

In the light of 3.7 years of more experience (hmm hmm) this should be marked as the correct answer instead of the one describing netCDF. As one can easily see the APIs are quite different.

ADD REPLYlink written 6.7 years ago by Michael Dondrup47k
6
gravatar for Istvan Albert
10.4 years ago by
Istvan Albert ♦♦ 84k
University Park, USA
Istvan Albert ♦♦ 84k wrote:

In the GeneTrack software we have used HDF to store values for each genomic base. Its main advantage over other storage systems was that it was able to return consecutive values with minimal overhead.

For example it is extremely fast (ms) in retrieving say 100,000 consecutive values starting with a certain index.We used the Python bindings to HDF. An added advantage of these bindings is that they will return the data back as numpy arrays (very fast numerical operations).

Here is the relevant code that deals with HDF only: hdf.py

The HDF schema is set up in a different module, but in the end it simply something like:

class MySchema( IsDescription ):
    """
    Stores a triplet of float values for each index.
    """
    ix = IntCol  ( pos=1 )  # index
    wx = FloatCol( pos=2 )  # values on the W (forward) strand
    cx = FloatCol( pos=3 )  # value on the C (reverse) strand
    ax = FloatCol( pos=4 )  # weighted value on the combined W + C strands
ADD COMMENTlink modified 22 months ago by RamRS27k • written 10.4 years ago by Istvan Albert ♦♦ 84k

Still not the kind of source code I'm looking for but it is very interesting ! Your project reminds me Jan Aerts' Locus Tree : http://saaientist.blogspot.com/2009/04/locustree-searching-genomic-loci.html

ADD REPLYlink modified 9 months ago by RamRS27k • written 10.4 years ago by Pierre Lindenbaum129k

Interesting link. You might want to also check out the PyTables documentation. That may have some use cases that you might be interested in. You can safely ignore the python related features: http://www.pytables.org/docs/manual/

ADD REPLYlink written 10.4 years ago by Istvan Albert ♦♦ 84k
5
gravatar for Fernando Muñiz
10.4 years ago by
Fernando Muñiz100 wrote:

What I do have is a netCDF-3 based Java application that I could show you. NetCDF-3 is basically the same idea as HDF, but quite more limited as it cannot do compound datatypes among other limitations.

But here's a small test code example to toy with:

Use the above in the following way:

ADD COMMENTlink modified 22 months ago by RamRS27k • written 10.4 years ago by Fernando Muñiz100

Very interesting. I'll flag this answer as "correct", but please, if anybody knows some source code that would highlight the power of HDF5. Please, feel free to post it here. Thanks

ADD REPLYlink written 10.4 years ago by Pierre Lindenbaum129k

Unfortunately, this answer is incorrect with respect to the question.

ADD REPLYlink written 6.7 years ago by Michael Dondrup47k

you're right, but 3,7 years later, I don't think HDF5 will help me :-)

ADD REPLYlink written 6.7 years ago by Pierre Lindenbaum129k
4
gravatar for Fernando Muñiz
10.4 years ago by
Fernando Muñiz100 wrote:

Hello Pierre!

I have been talking with the BioHDF guys and from what they tell me, their work will be centered around a number of command-line APIs, written in C, that will address some areas of usage which for now do not seem to overlap.

I have seen this example on their site: http://www.hdfgroup.org/projects/biohdf/biohdf_tools.html Don't know if that helps.

I have been talking with them to see if we can achieve an API for saving genotype data. Don't know yet where that will lead me.

If you are looking for something more versatile, you will probably have to delve in the official HDF5 C code ( http://www.hdfgroup.org/HDF5/Tutor/ ), which seems to be the only one that offers all the functionality and goodies of that impressive storage system.

ADD COMMENTlink written 10.4 years ago by Fernando Muñiz100

Many thanks Fernando. As I said , I'm especially looking for some source code: e.g. I'd like to see a short program that would store/retrieve data just to see/understand why I should use this HDF instead of a classic RDBM or another engine (berkeleydb, couchdb...)

ADD REPLYlink written 10.4 years ago by Pierre Lindenbaum129k

There are Perl-based bindings to both HDF5 and BioHDF here, along with some docs:

ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/BioHDF/Perl/

ADD REPLYlink written 10.4 years ago by Chris Fields2.1k

In case you did not look at it yet: http://www.hdfgroup.org/HDF5/doc/H5.intro.html http://www.hdfgroup.org/HDF5/doc/Intro/IntroExamples.html

ADD REPLYlink written 10.3 years ago by Darked894.2k
4
gravatar for Michael Dondrup
10.4 years ago by
Bergen, Norway
Michael Dondrup47k wrote:

There is also a Perl binding to HDF5: PDL::IO::HDF5

http://search.cpan.org/~cerney/PDL-IO-HDF5-0.5/ This requires the Perl Data Language (PDL) package. The way, data-structures can be handled, sub-ranges of data can be defined an data can be manipulated is actually very elegant in PDL such that computational code can profit from PDLs vectorized style of writing expressions.

The same is true for R and the hdf5 package: http://cran.r-project.org/web/packages/hdf5/index.html

Code examples are in the package documentations of both, the R-hdf5 package documentation is quite little though.

Both of these language bindings might be a very efficient way to read and write HDF5 files.

There are also APIs in Fortran, Java, Python, Matlab, C, or C++. So it might make sense to select the language and define the type of data you wish to store first.

ADD COMMENTlink written 10.4 years ago by Michael Dondrup47k
4
gravatar for Chris Fields
10.4 years ago by
Chris Fields2.1k
University of Illinois Urbana-Champaign
Chris Fields2.1k wrote:

I've been talking a bit with one of the devs behind BioHDF (being at UIUC, up the road from The HDF Group doesn't hurt). I believe a publication is on the way describing it along with some implementation details.

ADD COMMENTlink written 10.4 years ago by Chris Fields2.1k
4
gravatar for Darked89
10.4 years ago by
Darked894.2k
Barcelona, Spain
Darked894.2k wrote:

Not BioHDF5 but probably readable and maintained:

HDF5 for Python http://code.google.com/p/h5py/

ADD COMMENTlink written 10.4 years ago by Darked894.2k
1

also pytables: http://www.pytables.org/moin

ADD REPLYlink written 10.4 years ago by Istvan Albert ♦♦ 84k
3
gravatar for Giovanni M Dall'Olio
10.4 years ago by
London, UK
Giovanni M Dall'Olio27k wrote:

Unfortunately I don't have any example to shows you yet. I don't know how to program in C/C++ so I have been looking at two hdf5 wrappers in python, PyTables and H5PY.

PyTables has a database-like approach in which HDF5 is used as a sort of hierarchical database, in which a column can be a table itself, allowing to store nested data. For example, you have a table called 'SNPs' with two columns, 'id' and 'genotypes'; the column 'genotypes' contains a nested table, with the columns 'individual' and 'genotype'; and so on.

H5Py is basically a re-implementation of numpy's arrays, so you can store and access arrays/matrixes as you would do with numpy (it is similar to arrays and matrixes in matlab, R, and any other language with this data type) and they are stored in an HDF5 file so the access is faster.

ADD COMMENTlink written 10.4 years ago by Giovanni M Dall'Olio27k
1

one point to clarify is that with the nesting in pytables, you only get the equivalent of 1 row in the nest. so you'd have:

row['genotypes/genotype'] = 'XXX'

so while it is nested, you dont actually get a many-to-one relationship. still, i find pytables to be excellent for many things.

ADD REPLYlink written 9.7 years ago by brentp23k
3
gravatar for Michael Hoffman
10.4 years ago by
Toronto, ON
Michael Hoffman330 wrote:

Our Genomedata system stores multiple tracks of 1-bp resolution genomic data in a HDF5 array. Documentation and full source code is available on that page. It has a Python (PyTables) interface for reading the data. For originally loading it into HDF5, we wrote a C loader for added speed.

ADD COMMENTlink written 10.4 years ago by Michael Hoffman330

thanks, that's very useful too

ADD REPLYlink written 10.4 years ago by Pierre Lindenbaum129k
1
gravatar for Pierre Lindenbaum
9.7 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum129k wrote:

Another answer: I've been looking at the IGV ( Integrative Genomics Viewer ) sources, it use the JAVA bindings for HDF5 to store the data about the genomic tracks.

ADD COMMENTlink written 9.7 years ago by Pierre Lindenbaum129k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1970 users visited in the last hour