Phylip App'S Without Emboss Tool
3
1
Entering edit mode
13.9 years ago
Thaman ★ 3.3k

Can anybody make me clear how to use PHYLIP application's without using emboss tool as a wrapper class. I think it's possible just by commandine interface but doesn't seems to work for me.

Through command shell when i enter neighbor then its accessible but i can't do it through python. And what are the input file supported by the PHYLIP neighbor's application?

cline=neighborCommandline("neighbor", infile="save.aln", \
                           outfile="save.out", \
                           treefile="save.treefile")  
print cline

Thanks in advance

phylogenetics python biopython • 5.1k views
ADD COMMENT
1
Entering edit mode

OK. Methods you have referenced before, like ClustalwCommandline work because they are in BioPython modules that you have imported. You can't call a method that you haven't declared (either directly or through an import). There is no method named neighborCommandline in BioPython anyway. I repeat, the simplest way to do this would be to use os.popen(), or similar. I'm not sure why you'd need a command line wrapper anyway.

ADD REPLY
1
Entering edit mode

AFAIK, This code snippet won't enable the neighbor to execute. You need a steering file that provides various parameters to neighbor. Explained in detail in the answer.

ADD REPLY
0
Entering edit mode

In what way is this not working? Your code snippet is insufficient for me to replicate what you are trying to achieve. If Phylip is working at the command line, why not just use os.popen() to run the process?

ADD REPLY
0
Entering edit mode

I agree with Simon, listing a longer code snippet would make it easier to troubleshoot.

ADD REPLY
0
Entering edit mode

First i am trying to see the print cline, but got an error neighborCommandline is not define.

ADD REPLY
0
Entering edit mode

I haven't imported any modules right now, included phylip->neighbor.exe in the system environment. From command prompt when I enter neighbor it opens that means its accessible. So, i just checked above 2 lines in the python without importing any emboss module or subprocess right now.

ADD REPLY
0
Entering edit mode

Its prompt error as -> neighborCommandline is not define

ADD REPLY
0
Entering edit mode

That's what I am wondering about, I don't have EMBOSS wrapper to use phylip apps. I have output generated by the Clustalw and I want to do phylogeny using phylip->neighbor. Simplest way I figure out was to pass command line argument but doesn't seems to work. Ok I will try to generated phylogeny output like you said.

ADD REPLY
4
Entering edit mode
13.9 years ago

Thaman : I have tried to explain this in one of your earlier question here. Have you tried a test run using neighbor program. As suggested by Stefano, phylip take an infile and several parameters and generate an outfile. In order to pass on this parameters, you can create a steering_file (a text file that will provide several parameters to neighbor). If you are developing a web app, you may provide them as options from a drop down menu.

The following settings you can use for testing

  N       Neighbor-joining or UPGMA tree?  Neighbor-joining
  O                        Outgroup root?  No, use as outgroup species  1
  L         Lower-triangular data matrix?  No
  R         Upper-triangular data matrix?  No
  S                        Subreplicates?  No
  J     Randomize input order of species?  No. Use input order
  M           Analyze multiple data sets?  No
  0   Terminal type (IBM PC, ANSI, none)?  ANSI
  1    Print out the data at start of run  No
  2  Print indications of progress of run  Yes
  3                        Print out tree  Yes
  4       Write out trees onto tree file?  Yes

In your steering file you will add only the parameters(last column) as required and run using `` or system commands. So whenever you need to execute neighbor using command-line you run it as

neighbor < steering_file.txt

This will generate the outfile.

ADD COMMENT
4
Entering edit mode
13.9 years ago
David W 4.9k

Hi Thaman,

There's a few things here,

  1. I gather from your other questions and that little snippet that you're doing this with Biopython. Well, there isn't a NeighborCommandline class in Biopython (which is why you get the not defined error, even if it was there you'd have to import it before you could use it).

  2. Last time I checked phylip needs *.phy files, not clustal alignments. So you'll need to do this:

    AlignIO.convert("save.aln", "clustal", "save.phy", "phylip")
    
  3. Neighbor actually needs a distance matrix, not an alignment. So use (f)dnadist to make one of those before you estimate the trees.

  4. I really suggest you look into installing the EMBOSS versions, as Khader has shown each phylip program needs a "guide file" to work in batch mode. The EMBOSS versions have all their arguments and options passed on through the command line. I find it much easier to work that way (but your results may vary)

Good luck!

ADD COMMENT
0
Entering edit mode

The (official) PHYLIP tools are designed to be run "by hand" selecting actions via a text based menu system. The settings cannot be given by command line arguments (which is the normal way things are done). It is nevertheless theoretically possible to control the original PHYLIP tools from a Python script but you need to mess about with filenames, pipe instructions to stdin and so on.

We really do recommend using the EMBOSS versions instead.

ADD REPLY
1
Entering edit mode
13.9 years ago

It is a while I don't use PHYLIP. However I used to run it from the command line. Each program works on its own and expect a input file called infile and will produce an outfile called outfile

So you need to rename them if you want one program to work on the output of another program.

Hope this is what you need...

ADD COMMENT
0
Entering edit mode

Can you make me clear how to work on PHYLIP-> neighbor (NJ,UPGMA) through only commandline without emboss tool

ADD REPLY

Login before adding your answer.

Traffic: 1552 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6