Question: Phylip App'S Without Emboss Tool
1
Entering edit mode

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

ADD COMMENTlinkeditmoderate 9.7 years ago Thaman ♦ 3.2k • updated 16 months ago RamRS 21k
Entering edit mode
1

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 REPLYlinkeditmoderate 9.7 years ago
Simon Cockell
7.3k
• updated 16 months ago
RamRS
21k
Entering edit mode
1

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 REPLYlinkeditmoderate 9.7 years ago
Khader Shameer
18k
Entering edit mode
0

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 REPLYlinkeditmoderate 9.7 years ago
Simon Cockell
7.3k
• updated 16 months ago
RamRS
21k
Entering edit mode
0

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

ADD REPLYlinkeditmoderate 9.7 years ago
Istvan Albert
80k
Entering edit mode
0

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

ADD REPLYlinkeditmoderate 9.7 years ago
Thaman
♦ 3.2k
Entering edit mode
0

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 REPLYlinkeditmoderate 9.7 years ago
Thaman
♦ 3.2k
• updated 16 months ago
RamRS
21k
Entering edit mode
0

Its prompt error as -> neighborCommandline is not define

ADD REPLYlinkeditmoderate 9.7 years ago
Thaman
♦ 3.2k
• updated 16 months ago
RamRS
21k
Entering edit mode
0

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 REPLYlinkeditmoderate 9.7 years ago
Thaman
♦ 3.2k
• updated 16 months ago
RamRS
21k
4
Entering edit mode

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. Inorder 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 commandline you run it as

neighbor < steering_file.txt

This will generate the outfile.

ADD COMMENTlinkeditmoderate 9.7 years ago Khader Shameer 18k • updated 16 months ago RamRS 21k
4
Entering edit mode

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 COMMENTlinkeditmoderate 9.7 years ago David W 4.7k • updated 16 months ago RamRS 21k
Entering edit mode
0

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 REPLYlinkeditmoderate 9.7 years ago
Peter
5.8k
1
Entering edit mode

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 COMMENTlinkeditmoderate 9.7 years ago Stefano Berri 4.1k
Entering edit mode
0

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

ADD REPLYlinkeditmoderate 9.7 years ago
Thaman
♦ 3.2k

Login before adding your answer.

Powered by the version 2.0