[Biopython] alignment in biopython using `clustalW

Alexey Morozov alexeymorozov1991 at gmail.com
Fri Aug 29 01:57:47 UTC 2014


Debian-based distros (ie Debian, Ubuntu or Mint) have clustalW 2.1 in their
repositories, but it is called just clustalw. So your code should be

cline = ClustalwCommandline("clustalw2", infile="test.fasta")

You said your code generates a file. What is that file?


2014-08-29 8:28 GMT+09:00 Peter Cock <p.j.a.cock at googlemail.com>:

> On Fri, Aug 29, 2014 at 8:06 AM, Jakub Stanislaw Nowak
> <jakub.nowak at ed.ac.uk> wrote:
> > Hello,
> >
> > I am trying to run alignment using ClustalW in python.
> >
> > I have used this code to compile
> >
> > cline = ClustalwCommandline("clustalw2", infile="test.fasta")
> > print(cline)
> > stdout, stderr = cline()
> > align = AlignIO.read("test.aln", "clustal")
> > print(align)
> >
> >
> > But it is generating file. I think I have some problem with setting a
> proper
> > pathway to  clustal.
> >
> >
> > This is the error:
> >
> > clustalw2 -infile=test.fasta
> > Traceback (most recent call last):
> >   File "/Users/user/Google Drive/Bioinformatics/smallRNAseq/Python U
> > densities/trial4old.py", line 95, in <module>
> >     stdout, stderr = cline()
> >   File
> >
> "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Bio/Application/__init__.py",
> > line 513, in __call__
> >     stdout_str, stderr_str)
> > Bio.Application.ApplicationError: Non-zero return code 127 from
> 'clustalw2
> > -infile=test.fasta', message '/bin/sh: clustalw2: command not found'
> >
> >
> >
> > Can you suggest some solution?
>
> What happens at the command line (outside Python)
> if you run these command?
>
> $ clustalw2 -infile=test.fasta
>
> $ which clustalw2
>
> If that fails, it means clustalw2 is not installed on your $PATH.
> How was clustalw2 installed?
>
> If you have clustalw2 somewhere like this:
> /Users/jakub/downloads/clustalw2.1/bin/clustalw2
>
> Then the command would become:
>
> /Users/jakub/downloads/clustalw2.1/bin/clustalw2 -infile=test.fasta
>
> The Python code would become:
>
> cline =
> ClustalwCommandline("/Users/jakub/downloads/clustalw2.1/bin/clustalw2",
> infile="test.fasta")
>
> Regards,
>
> Peter
> _______________________________________________
> Biopython mailing list  -  Biopython at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/biopython
>



-- 
Alexey Morozov,
LIN SB RAS, bioinformatics group.
Irkutsk, Russia.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20140829/c93ab642/attachment.html>


More information about the Biopython mailing list