[Bioperl-l] Bio::Tools::Run::Cap3 - Parameters
Jonathan Crabtree
jonathancrabtree at gmail.com
Wed May 6 15:34:07 EDT 2009
Chris-
It looks like Brian already added the 'y' option and fixed one of the typos
in the SYNOPSIS, so here's a suggested diff based on the SVN head as of a
few minutes ago. It includes the following changes:
1. Removed reference to BLAST in the
comments.
2. Modified SYNOPSIS to make intended new() usage
clearer.
3. Added the following @PARAMS: h i j k r t w z (to match those in the
12/21/07 version of cap3)
4. Calling $factory->program_dir('/some/path') now changes the default
PROGRAMDIR (/usr/local/bin)
5. Bug fix, at least for post-2005 cap3 versions: changed run() method to
pass CAP3 options _after_ the filename.
6. Throw an (informative) exception if the executable couldn't be found by
WrapperBase::executable.
7. Changed comments to use "CAP3", not "Cap3" or "cap3" as the name of the
software package. The Perl module is still "Cap3".
4. is probably the only change that might be controversial. It seems that
most of the Bio::Tools::Run wrappers determine the directory in which the
program executable resides by checking an environment variable. Cap3.pm
stands out by hard-coding it. program_dir() is a class method but I've
changed it to allow it to be called _either_ as a class method (in which
case it returns the default $PROGRAMDIR) _or_ as an object method (in which
case it returns or sets an internal copy of the program directory, as
illustrated in the new SYNOPSIS.) If you want to change the class default
you have to modify $PROGRAMDIR directly. I also noticed that if cap3
_isn't_ in the default $PROGRAMDIR the error message is completely
unhelpful, so I've added a new throw() statement for this case.
Finally, it doesn't seem that there's a test file for Cap3. If I have some
free time later I'll look into adding one.
Jonathan
On Wed, May 6, 2009 at 12:07 PM, Chris Fields <cjfields at illinois.edu> wrote:
> Jonathan,
>
> Have a diff file? We can fix that on main trunk for the next release.
>
> chris
>
>
> On May 6, 2009, at 10:45 AM, Jonathan Crabtree wrote:
>
> The "new" argument to Cap3 expects an array, not a string. So I think you
>> need to do this:
>>
>> my $cap3Factory = Bio::Tools::Run::Cap3->new('y', '150');
>>
>> rather than this:
>>
>> my $cap3Factory = Bio::Tools::Run::Cap3->new('y 150');
>>
>> Otherwise it will silently ignore the parameter. There are also several
>> problems with the Cap3 module itself, at least the version shown here:
>>
>>
>> http://cpansearch.perl.org/src/CJFIELDS/BioPerl-run-1.6.1/Bio/Tools/Run/Cap3.pm
>>
>> Those problems are:
>>
>> 1. "y" is not in the PARAMS array, as Brian and Kevin have noted
>> 2. $PROGRAMDIR appears to be hard-coded to /usr/local/bin (OK if that's
>> where your cap3 is installed)
>> 3. The run() method does this:
>>
>> my $commandstring = $exe . $param_string . " $infilename1";
>>
>> but at least for the version of cap3 I'm using, you need to put the
>> $param_string _after_ the $infilename1 for it to work. Once all these
>> things are corrected it worked for me and correctly passed the -y 150 to
>> cap3 when new() was called as shown above.
>>
>> Jonathan
>>
>>
>> On Wed, May 6, 2009 at 11:23 AM, Kevin Brown <Kevin.M.Brown at asu.edu>
>> wrote:
>>
>> BEGIN {
>>>
>>> @PARAMS = qw(a b c d e f g m n o p s u v x);
>>> $PROGRAMDIR = '/usr/local/bin';
>>>
>>> # Authorize attribute fields
>>> foreach my $attr (@PARAMS) { $OK_FIELD{$attr}++;
>>>
>>> }
>>>
>>> That is the list of params that Cap3 will accept in the BioPerl module.
>>> I'm guessing if you add the y to that list that it might work.
>>>
>>> -----Original Message-----
>>>> From: bioperl-l-bounces at lists.open-bio.org
>>>> [mailto:bioperl-l-bounces at lists.open-bio.org] On Behalf Of
>>>> Michael Stubbington
>>>> Sent: Wednesday, May 06, 2009 7:39 AM
>>>> To: bioperl-l at lists.open-bio.org
>>>> Subject: [Bioperl-l] Bio::Tools::Run::Cap3 - Parameters
>>>>
>>>> Dear all,
>>>>
>>>>
>>>>
>>>> I am using the Bio::Tools::Run::Cap3 wrapper to the Cap3 assembly
>>>> program. I have some reads that will only assemble if cap3 is
>>>> used with
>>>> the '-y 150' option. This is fine from the command line but I
>>>> can't work
>>>> out how to pass this option to the Cap3 factory object in my script.
>>>>
>>>>
>>>>
>>>> If I do the following
>>>>
>>>>
>>>>
>>>> my $params = "y 150" ;
>>>>
>>>> my $cap3Factory = Bio::Tools::Run::Cap3->new($params);
>>>>
>>>> my $assembly = $cap3Factory->run($file);
>>>>
>>>>
>>>>
>>>> Then I get an exception as follows:
>>>>
>>>>
>>>>
>>>> ------------- EXCEPTION: Bio::Root::Exception -------------
>>>>
>>>> MSG: Unallowed parameter: y !
>>>>
>>>> STACK: Error::throw
>>>>
>>>> STACK: Bio::Root::Root::throw
>>>> /Users/mike/lib/perl5/site_perl/5.8.9/Bio/Root/Root.pm:357
>>>>
>>>> STACK: Bio::Tools::Run::Cap3::AUTOLOAD
>>>> /Users/mike/lib/perl5/site_perl/5.8.9/Bio/Tools/Run/Cap3.pm:116
>>>>
>>>> STACK: Bio::Tools::Run::Cap3::new
>>>> /Users/mike/lib/perl5/site_perl/5.8.9/Bio/Tools/Run/Cap3.pm:101
>>>>
>>>> STACK: /Users/mike/perlScripts/QGenotype.pl:150
>>>>
>>>>
>>>>
>>>> If I don't try to pass any parameters to Cap3 it runs fine but just
>>>> fails to assemble the reads that need the -y 150 flag.
>>>>
>>>>
>>>>
>>>> I'd very much appreciate any help with this. I'm pretty new
>>>> to bioperl,
>>>> hope I haven't missed anything obvious!
>>>>
>>>>
>>>>
>>>> Thanks in advance,
>>>>
>>>>
>>>>
>>>> Mike
>>>>
>>>>
>>>>
>>>> --------------------------------------------------------------
>>>> ----------
>>>> ----
>>>>
>>>> Mike Stubbington
>>>>
>>>> Novel and Dangerous Pathogens
>>>>
>>>> Health Protection Agency
>>>>
>>>> Centre for Emergency Preparedness and Response
>>>>
>>>> Porton Down
>>>>
>>>> Salisbury
>>>>
>>>> SP4 0JG
>>>>
>>>>
>>>>
>>>> Tel: +44 1980 619812
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> -----------------------------------------
>>>> **************************************************************
>>>> ************
>>>> The information contained in the EMail and any attachments is
>>>> confidential and intended solely and for the attention and use of
>>>> the named addressee(s). It may not be disclosed to any other person
>>>> without the express authority of the HPA, or the intended
>>>> recipient, or both. If you are not the intended recipient, you must
>>>> not disclose, copy, distribute or retain this message or any part
>>>> of it. This footnote also confirms that this EMail has been swept
>>>> for computer viruses, but please re-sweep any attachments before
>>>> opening or saving. HTTP://www.HPA.org.uk
>>>> **************************************************************
>>>> ************
>>>> _______________________________________________
>>>> Bioperl-l mailing list
>>>> Bioperl-l at lists.open-bio.org
>>>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>>>
>>>>
>>> _______________________________________________
>>> Bioperl-l mailing list
>>> Bioperl-l at lists.open-bio.org
>>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>>
>>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Cap3.pm.diff
Type: text/x-diff
Size: 1724 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/bioperl-l/attachments/20090506/90473079/attachment-0002.bin>
More information about the Bioperl-l
mailing list