tags:

views:

20

answers:

1

Hi all, I maintain a set of C++ tools (bedtools) that are used in the genomics/bioinformatics field. Several users have asked that I create APIs to the libraries such that "hooks" are available for Perl and Python, for example (many requests for Python). Therefore, I am interested in using SWIG, as it has support for C++ and in theory, can be used to create APIs to several languages.

However, the aforementioned tools were written so that they could be "piped" together in an UNIX stream, and as such, all of the libraries write to stdout. I am struggling to figure out how to use SWIG to make the output from the existing methods (printfs and couts) available as an API. My ideal vision would be that the output of the tools would be a iterator that could be looped over in Python/

Does anyone have experience with this? I would be very grateful for concrete examples with sample code. Hopefully, I am missing something very obvious.

Gratefully, Aaron

A: 

@jobu - The point of SWIG is to wrap the C++ code-API's so that they can be accessed via the other language, python, perl, etc and as such pipe-based access would not be appropriate. This in no way would prevent you from piping outputs or inputs as needed either, your users would only need to call the appropriate print functions in their own language.

But again, the whole point is to provide function based access.

Petriborg