[Bioperl-l] Bioperl-run Wrappers
Ben Bimber
bbimber at gmail.com
Fri Feb 4 16:33:57 EST 2011
Hi Chris,
I actually was referring to the software version of the executable
itself, not the perl code. for example, I added something like this
to a mosaik wrapper I made:
sub version {
my $self = shift;
my ($out, $err);
IPC::Run::run([$self->executable, '-h'], '>', \$out, '2>', \$err);
my @out = split("\n", $out);
my $version = join(';', grep( /^Mosaik/i, @out));
$version =~ m/^.*0m ([\d\.]*)\b/i;
return "Mosaik Version: $1\n";
}
It runs the executable, parses the output (which is specific to mosaik
in this case) and returns it. I had an issue with a tool version
recently, so I decided it was probably a good idea to start recording
them with pipelines. In hindsight version() is probably the wrong
name since it's confusing with perl's VERSION, but maybe exe_version()
or something makes sense. I would personally find it useful if there
were a standard, but optional method across BioPerl wrappers to do
this sort of thing. implementing it would be optional per wrapper.
all it would really need to do it return a string.
-Ben
On Fri, Feb 4, 2011 at 3:19 PM, Chris Fields <cjfields at illinois.edu> wrote:
> On Jan 28, 2011, at 12:18 PM, Ben Bimber wrote:
>
>> Hello,
>>
>> I'm using CommandExts to wrap a number of tools. In a pipeline I was
>> looking to make the tools log their current version. I realized that
>> instead of using run() in a unique way for each tool, perhaps there
>> should be a consistent method that gets called and returns a version
>> string. because obtaining this version string is specific to the
>> tool, perhaps each wrapper could provide a version() method that runs
>> the appropriate command on the executable, parses, then returns some
>> string. has something like this been discussed? have others already
>> solved this?
>>
>> Thanks,
>> Ben
>
> (apologies for the late response, maybe you worked it out?)
>
> If you mean a version string for the wrapped tool, there is a Bio::Tools::Run::WrapperBase method called version() I believe (not implemented for obvious reasons, but implemented by each wrapper as needed). If you want a specific version of the module (say, an API version) you may want to assign $VERSION or create a new global ($API_VERSION, perhaps) in case it conflicts with the BioPerl core version.
>
> chris
>
>
>
More information about the Bioperl-l
mailing list