[BioPython] biopython clustalw command line take 2

ashleigh smythe absmythe at ucdavis.edu
Thu Jul 31 00:26:02 EDT 2003


On Wed, 2003-07-30 at 10:10, Brad Chapman wrote:
> Hi Ashleigh;
> 
> > Hello biopython experts.  At the risk of seeming like a pest, I'm
> > reposting a question I asked a couple of days ago to see if I can get a
> > bite this time.
> 
> Sorry to be so slow in responding. I've been beyond swamped
> recently. Grad school is very evil.
> 
> > I'm trying to use clustalw through biopython for the first
> > time.  I'm following the tutorial but it doesn't show the syntax for
> > setting the multiple alignment parameters.  From the __init__ I figured
> > out that it is something like gap_open_pen=desired value so I tried
> > cline.gap_open_pen=20 but when I try to show that command line string I
> > get an error:
> [...]
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> >   File "/usr/lib/python2.2/site-packages/Bio/Clustalw/__init__.py", line
> > 420, in __str__
> >     cline = cline + " -GAPOPEN=" + self.gap_open_pen
> > TypeError: cannot concatenate 'str' and 'int' objects
> 
> As Michiel pointed out, this isn't an error in how you are using it,
> but rather an error in my ugly code. I've attached a patch which
> fixes all of these types of potential problems (the patch is also
> checked into CVS). This should be applied to
> Bio/Clustalw/__init__.py if you (or anyone else) wants to use it.
> 
> As Larry pointed out, you can work around my bug and save yourself
> from having to patch the Biopython code by passing in strings
> instead of integers. 
> 
> Sorry about the bug. Thanks much for reporting it!
> Brad

Thanks to Michiel and Larry for the suggestions, and Brad for coming up
with the patch so quickly.  Sorry to repost and pester like that, I just
thought I might have fallen through the cracks.  

I actually didn't know how to patch it so I just got your new
__init__.py from CVS and replaced my old one.  The setting of the
parameters works now, but now I can't specify an outfile:

>>> cline=MultipleAlignCL(os.path.join(os.curdir, 'aligntest2'))
>>> cline.set_output('aligntest2out.aln')
>>> cline.gap_open_pen=20
>>> cline.gap_ext_pen=10
>>> str(cline)
'clustalw ./aligntest2 -OUTFILE=aligntest2out.aln -GAPOPEN=20
-GAPEXT=10'
>>> from Bio import Clustalw
>>> alignment=Clustalw.do_alignment(cline)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/site-packages/Bio/Clustalw/__init__.py", line
118, in do_alignment
    raise IOError("Output .aln file %s not produced, commandline: %s"
IOError: Output .aln file aligntest2out.aln not produced, commandline:
clustalw ./aligntest2 -OUTFILE=aligntest2out.aln -
GAPOPEN=20 -GAPEXT=10

If I don't specify an outfile it works fine.  

I just a few moments ago figured out that there is an actual program
called patch that does the patching (newbie, can you tell?).  Should I
have patched instead of replacing, or does that have anything to do with
it?  Of course it won't let me do patch it now.  

Anyway, any suggestions from anyone would be appreciated.  I know Brad
is busy with the evils of grad school (me too :(  ) - anybody else have
any clues?

Thanks!

Ashleigh
________________________________________________________________________




More information about the BioPython mailing list