Gufran GUNGOR
Gufran GUNGOR

Reputation: 11

ClustalW on Ubuntu

In the biopython cookbook I couldn't find how to actually run clustalw. I have done what is on the cookbook but it is not running clustalw just printing

clustalw2 -infile=opuntia.fasta

Can anyone help me how to actually run clustalw?

Upvotes: 1

Views: 264

Answers (1)

Maximilian Peters
Maximilian Peters

Reputation: 31679

The section is copied from the BioPython documentation.

>>> from Bio.Align.Applications import ClustalwCommandline
>>> cline = ClustalwCommandline("clustalw2", infile="opuntia.fasta")
>>> print(cline)

clustalw2 -infile=opuntia.fasta

If you run

from Bio.Align.Applications import ClustalwCommandline
cline = ClustalwCommandline("clustalw2", infile="opuntia.fasta")
print(cline) 

it will do 3 things

  1. Import ClustalwCommandline module from BioPython
  2. Create a ClustalwCommandline object
  3. Print the object's string representation

If you want to execute the program, you would need to call the created object

stdout, stderr = cline()

which will then run the whole program with your provided parameters. The "normal" output will be found in stdout and all errors in stderr.

If get an error that the executable cannot be found, you either need to add the directory of clustalw2 to your path or specify the full path (e.g. cline = ClustalwCommandline("c:/users/gufran/programs/clustalw.exe", infile="opuntia.fasta").

Upvotes: 1

Related Questions