I had a big headache when solving this problem 6 months back when I didn't knew anything. But anyway now I can write you in detail how to do it silently through script.
import subprocess
from Bio.Align.Applications import ClustalwCommandline
cline = ClustalwCommandline("clustalw2", infile="opuntia.fasta", seqnos="ON", gapopen=2, gapext=0.5)
child = subprocess.call(str(cline), shell=(sys.platform!="win32"))
- Importing clustalw command line wrapper
- Subprocess - The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes
Other parameters available
- Gap open penalty:
-gapopen
- Gap extension penalty:
-gapext
- no end gap(yes, no):
-endgaps
- gap distance:
-gapdist
- weight matrix(blosum, pam etc):
-matrix
["BLOSUM"
, "PAM"
, "GONNET"
, "ID"
]
- type (DNA,protein):
-type
It's easy to check the availabe parameters/options after wrapper have been created. Suppose from the above given example:
>>> cline = ClustalwCommandline(type='dna')
>>> dir(cline)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__',
'__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__', '__weakref__', '_check_value', '_clear_parameter',
'_get_parameter', '_validate', 'align', 'bootlabels', 'bootstrap', 'case', 'check',
'clustering', 'convert', 'dnamatrix', 'endgaps', 'fullhelp', 'gapdist', 'gapext',
'gapopen', 'helixendin', 'helixendout', 'helixgap', 'help', 'hgapresidues', 'infile',
'iteration', 'kimura', 'ktuple', 'loopgap', 'matrix', 'maxdiv', 'maxseqlen',
'negative', 'newtree', 'newtree1', 'newtree2', 'nohgap', 'nopgap', 'nosecstr1',
'nosecstr2', 'noweights', 'numiter',
'options', 'outfile', 'outorder', 'output', 'outputtree', 'pairgap', 'parameters',
'profile', 'profile1', 'profile2', 'program_name', 'pwdnamatrix', 'pwgapext',
'pwgapopen', 'pwmatrix', 'quicktree', 'quiet', 'range', 'score', 'secstrout', 'seed',
'seqno_range', 'seqnos', 'sequences', 'set_parameter', 'stats', 'strandendin',
'strandendout', 'strandgap',
'terminalgap', 'topdiags', 'tossgaps', 'transweight', 'tree', 'type', 'usetree',
'usetree1', 'usetree2', 'window']
>>> print cline
clustalw2 -infile=opuntia.fasta -seqnos=ON -gapopen=2 -gapext=0.5
Before writing script you can first try by importing clustalwcommandline
wrapper object play by passing parameters through shell/command line.
More information and Links
Note- If you are using under windows then its important to put the clustalw on the system variable path
Hope it helps :)
you have to search for "clustal batch mode" in a search engine. By the way, note that the current clustalw version is 2.1
don't worry, it took me an hour of google-ing to find it last time I needed it.