library interface?

12 views
Skip to first unread message

Joshua Pritikin

unread,
Feb 14, 2019, 5:09:28 PM2/14/19
to Mega2
Rather than using meta2 as a data format translator, would it be possible to reorganize the code such that the ability to read from diverse binary formats was made available as a C++ library?

I am a developer of the OpenMx structural equation modeling package. We hope to offer the ability to directly read from plink and bgen formats, but it seems a better design would be to delegate the decoding of binary formats to a library.

Your thoughts?

Dan Weeks

unread,
Feb 19, 2019, 11:23:31 AM2/19/19
to Mega2
Glad to hear of your interest in enabling OpenMx to be able to read directly from PLINK and BGEN formats.

Mega2 has a long and convoluted history, starting as a C program, but more recently we've reorganized it as a C++ program and improved our use of object-oriented programming, and have now decoupled it into two parts: (1) the reading/decoding of the input data and storage of that data in a Mega2 SQLite database, and (2) the reformatting of data stored in a Mega2 database into a desired target format.  So maybe you could merge the Part 1 reading/decoding code into OpenMx and instead of having it output into the SQLite database could have it reformat into what OpenMx needs?

This decoupling of decoding into a standard Mega2 SQLite database has proved useful in that our Mega2R R package now simply reads its input from a Mega2 database, and so for that package we didn't need to write any input code in R supporting lots of different input formats.  However, of course, we do have to initially run Mega2 to create the input Mega2 database.

Thanks,
Dan

Joshua Pritikin

unread,
Feb 20, 2019, 1:17:49 PM2/20/19
to Mega2
Yes, that's approximately what I had in mind. However, I'm trying to minimize future maintenance costs.

Suppose I helped package the reading/decoding of the input data as a C++ library. Would you accept these changes so both Mega2 and OpenMx could link against the same library?

Dan Weeks

unread,
Feb 20, 2019, 4:47:22 PM2/20/19
to Mega2
Mega2 is GPL-2 licensed, so you are of course free to take our code and reformat it into a C++ library for OpenMx.  

As our grant support for the Mega2 project is (unfortunately) ending later this year, I am not sure we'll have the bandwidth to restructure Mega2 on our end to use this new library.  The source code for Mega2 is managed in a Bitbucket repository, so if you forked that project, we could then later see how easy it is to merge what you've done back into Mega2.

Note that our Mega2R R package has functions for making the Mega2 SQLite database tables nicely accessible from within R as data frames.  Since OpenMx is an R package, presumably Mega2R's functionality might ease pulling genetic data into R for OpenMx to access.  
Reply all
Reply to author
Forward
0 new messages