[Bioperl-l] writing a pairwise alignment module: XS and Inline C?

Stephen Gordon Lenk slenk at emich.edu
Fri May 19 10:42:41 EDT 2006

There is nothing wrong with a reasonable way that works - better not 
to put yourself down.

Inline is good if you can get it to work for you - I have had issues 
with linking Inline to dynamic libraries. I believe Inline makes a 
file that has linkage characteristics specified. Try it and see, then 
tell people how you did it. My two cents.

Another way to use exterior executables is popen3, then reading and 
writing to the pipes. I use it (primer3 and local lab automation 
code) - snippet follows:

my $pid     = 0;
my $cancmd  = 'cancmd.exe';
my $write   = 0;
my $read    = 0;

sub new {

    my $c = {};

    $pid   = open3(\*WTRFH, \*RDRFH, \*RDRFH, $cancmd);

    $write = *WTRFH;
    $read  = *RDRFH;


    bless $c;
    return $c;

Just write your request, then read it back - I make sure that each 
pair is a newline terminated text line - be sure you harvest the child 
pid when you are done.

----- Original Message -----
From: Adam Kraut <adamnkraut at gmail.com>
Date: Thursday, May 18, 2006 5:07 pm
Subject: [Bioperl-l] writing a pairwise alignment module: XS and 
Inline C?

> I am currently using a pairwise alignment algorithm written in C 
> (not by
> me).  The program consists of a library of routines, structures, and
> definitions which I do not want to spend a lot of time 
> abstracting.  I
> already have a hack method of writing the parameters and inputs I 
> want from
> perl, calling the c program with system( ), and then parsing the 
> output in
> Perl.  Any good programmer would probably smack me but I'm just an 
> undergradand I needed to show my boss that this works in order to 
> spend more time on
> it.
> So on to my question, what is the preferred method of extending 
> Bioperl to
> use this algorithm?  I have just read the XS tutorial and a bit 
> about Inline
> C.  Can I put the main function in my script using Inline, and 
> then just
> point Inline at the rest of the C library?  The program has several
> C-structures that are semantically equivalent to Bioperl objects, 
> so just
> need somewhere to start.  I will spend some more time so that I 
> have a more
> specific question, I just wanted a little feedback, this is my 
> first post to
> the bioperl list.
> Thanks,
> Adam
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

More information about the Bioperl-l mailing list