Answers.Body: <p>The best would be Biopython using AlignIO, given they are all in a single file otherise SeqIO. The alignment approach,</p>
  <pre><code>from Bio import AlignIO
  align = AlignIO.read(&quot;/home/path/myseq.fa&quot;, &quot;fasta&quot;)
  print(align)
  with open(&quot;/home/path/example.nex&quot;, &quot;w&quot;) as handle:
      SeqIO.write(align, handle, &quot;nexus&quot;)
  </code></pre>
  <p>(not debugged)</p>
  <p><a href="https://www.megasoftware.net/" rel="nofollow noreferrer">MEGAX</a> or <a href="http://www.clustal.org/clustal2/" rel="nofollow noreferrer">ClustalX</a> which are nice GUI's that will also work. If you've not got Biopython installed then ClustalX is probably the easiest.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-27T02:20:25.463Z
Answers.Text: Thanks for your input - I'm a Python novice and don't have Biopython and looked at ClustalX - and then I found a solution using Clustalw which works quite nicely - see my answer - but I gave you a +1 for your contribution which led me to my answer.
Answers.UserDisplayName: Vérace
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-26T14:36:13.043Z
Answers.LastActivityDate: 2020-11-26T15:01:44.783Z
Answers.LastEditDate: 2020-11-26T15:01:44.783Z
Answers.UserDisplayName: M__
Answers.Body: <p>I think you can do this in Jalview.
  In your alignment window, open the <strong>Calculate</strong> menu and select <strong>Calculate Tree or PCA...</strong>.
  This will open a <strong>Choose Calculation</strong> window which you can use to select what kind of tree to build.
  When you click on the <strong>Calculate</strong> button you will get another window with the tree in it.
  In that window you can open the <strong>File</strong> menu and then select <strong>Save as...</strong> → <strong>Newick Format</strong>.  Hopefully this will do what you need.
  <a href="https://i.sstatic.net/AgaRT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/AgaRT.png" alt="Combined 2-stage screenshot. Calculate-&gt;Calculate Tree or PCA...-&gt;Calculate-&gt;Save as...-&gt;Newick Format" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-27T09:43:53.153Z
Answers.LastActivityDate: 2020-11-27T09:43:53.153Z
Answers.UserDisplayName: bzd
Answers.Body: <p>@M__'s <a href="https://bioinformatics.stackexchange.com/a/14944/9952">answer</a> led me to <a href="http://www.clustal.org/" rel="nofollow noreferrer">clustal.org</a> and some searching led me to this page (<a href="http://wiki.christophchamp.com/index.php?title=ClustalW" rel="nofollow noreferrer">Christoph's</a>).</p>
  <p>I tried compiling Clustalx (GUI - problem with qmake) which didn't work, but Clustalw (compiled to exe clustalw2) - the command line tool - worked a treat.</p>
  <p>So, I had my <code>clustalw2</code> executable and my 25 <em>Drosophila</em> alcohol dehydrogenase protein sequences and I ran the following commands (from Christoph's page):</p>
  <pre><code>./clustalw2 -align -type=protein -infile=droso.fasta
  </code></pre>
  <p>This produces a droso.aln file which looks like this (only a few lines shown):</p>
  <pre><code>D_paulistorum               ETRVAEKLLEHPTQTTLACAQNFVKAIELNKNGAIWKLDLGTLEPIEWTK
  D_insularis                 ETRVAEKLLEHPTQTTLACAQNFVKAIELNKNGAIWKLDLGTLEPIEWTK
  D_equinoxialis              ETRVAEKLLEHPTQTTLACAQNFVKAIELNKNGAIWKLDLGTLEPIEWTK
  D_willistoni                ETRVAEKLLEHPTQTTLACAQNFVKAIELNKNGAIWKLDLGTLEPIEWTK
                              *. *:**** ** *.:  *.:*********:*****:** .***.* *::
  </code></pre>
  <p>Then on Christoph's page, there is a section:</p>
  <ul>
  <li>Generate a Newick tree file</li>
  </ul>
  <p>So, I followed the instructions and ran:</p>
  <pre><code>./clustalw2 -tree -infile=droso.aln
  </code></pre>
  <p>and obtained a file droso.ph which looks like a Newick format file to me (some lines):</p>
  <pre><code>(
  (
  (
  D_madeirensis:0.00000,
  D_subobscura:0.00787)
  :0.00257,
  D_guanche:0.00530)
  :0.00336,
  (
  (
  D_pseudoobscura:0.00000,
  D_pseudoobscura_pseudo:0.00000)
  :0.00262,
  D_persimilis:0.00131)
  :0.01239)
  :0.01132,
  D_ambigua:0.01821)
  :0.00839,
  </code></pre>
  <p>So, it looks like I have a path to doing what I wanted in the first place - getting from .fasta to Newick format.</p>
  <p>Then, using the programs <a href="https://www.jalview.org/" rel="nofollow noreferrer">jalview</a> and <a href="http://tree.bio.ed.ac.uk/software/figtree/" rel="nofollow noreferrer">figtree</a>, I was able to draw trees and the like!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-27T03:23:05.337Z
Answers.LastActivityDate: 2023-01-07T15:15:49.063Z
Answers.LastEditDate: 2023-01-07T15:15:49.063Z
Answers.UserDisplayName: Vérace
Body: <p>My problem is (should be) pretty simple.</p>
  <p>I have a series of 10 sequences which I wish to convert into a Newick format file - what would be good software to do this? I've tried using Jalview and am getting nowhere.</p>
  <p>Any help appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-27T16:27:27.363Z
Comments.Text: I am not sure if I follow. Do you want to create a phylogenetic tree?
Comments.UserDisplayName: Kamil S Jaron
Tags: <phylogenetics><fasta><phylogeny><format-conversion>
Title: Convert a fasta file to Newick format
ThreadText: # Convert a fasta file to Newick format
  
  (Asked by: username_0 on 2020-11-26)
  
  My problem is (should be) pretty simple.
  
  I have a series of 10 sequences which I wish to convert into a Newick format file - what would be good software to do this? I've tried using Jalview and am getting nowhere.
  
  Any help appreciated.
  
  **Tags:** phylogenetics, fasta, phylogeny, format-conversion
  
  > **Comments:**
  > **username_1**: I am not sure if I follow. Do you want to create a phylogenetic tree?  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2020-11-26. Score: 3 | Accepted answer
  
  The best would be Biopython using AlignIO, given they are all in a single file otherise SeqIO. The alignment approach,
  
  ```
  from Bio import AlignIO
  align = AlignIO.read("/home/path/myseq.fa", "fasta")
  print(align)
  with open("/home/path/example.nex", "w") as handle:
      SeqIO.write(align, handle, "nexus")
  
  ```
  
  (not debugged)
  
  [MEGAX](https://www.megasoftware.net/) or [ClustalX](http://www.clustal.org/clustal2/) which are nice GUI's that will also work. If you've not got Biopython installed then ClustalX is probably the easiest.
  
  > **Comments:**
  > **username_0**: Thanks for your input - I'm a Python novice and don't have Biopython and looked at ClustalX - and then I found a solution using Clustalw which works quite nicely - see my answer - but I gave you a +1 for your contribution which led me to my answer.  
  
  ---
  
  ### Answer by username_3 on 2020-11-27. Score: 1
  
  I think you can do this in Jalview.
  In your alignment window, open the **Calculate** menu and select **Calculate Tree or PCA...**.
  This will open a **Choose Calculation** window which you can use to select what kind of tree to build.
  When you click on the **Calculate** button you will get another window with the tree in it.
  In that window you can open the **File** menu and then select **Save as...** → **Newick Format**. Hopefully this will do what you need.
  [![Combined 2-stage screenshot. Calculate->Calculate Tree or PCA...->Calculate->Save as...->Newick Format](https://i.sstatic.net/AgaRT.png)](https://i.sstatic.net/AgaRT.png)
  
  
  ---
  
  ### Answer by username_0 on 2020-11-27. Score: 1
  
  @M\_\_'s [answer](https://bioinformatics.stackexchange.com/a/14944/9952) led me to [clustal.org](http://www.clustal.org/) and some searching led me to this page ([Christoph's](http://wiki.christophchamp.com/index.php?title=ClustalW)).
  
  I tried compiling Clustalx (GUI - problem with qmake) which didn't work, but Clustalw (compiled to exe clustalw2) - the command line tool - worked a treat.
  
  So, I had my `clustalw2` executable and my 25 *Drosophila* alcohol dehydrogenase protein sequences and I ran the following commands (from Christoph's page):
  
  ```
  ./clustalw2 -align -type=protein -infile=droso.fasta
  
  ```
  
  This produces a droso.aln file which looks like this (only a few lines shown):
  
  ```
  D_paulistorum               ETRVAEKLLEHPTQTTLACAQNFVKAIELNKNGAIWKLDLGTLEPIEWTK
  D_insularis                 ETRVAEKLLEHPTQTTLACAQNFVKAIELNKNGAIWKLDLGTLEPIEWTK
  D_equinoxialis              ETRVAEKLLEHPTQTTLACAQNFVKAIELNKNGAIWKLDLGTLEPIEWTK
  D_willistoni                ETRVAEKLLEHPTQTTLACAQNFVKAIELNKNGAIWKLDLGTLEPIEWTK
                              *. *:**** ** *.:  *.:*********:*****:** .***.* *::
  
  ```
  
  Then on Christoph's page, there is a section:
  
  * Generate a Newick tree file
  
  So, I followed the instructions and ran:
  
  ```
  ./clustalw2 -tree -infile=droso.aln
  
  ```
  
  and obtained a file droso.ph which looks like a Newick format file to me (some lines):
  
  ```
  (
  (
  (
  D_madeirensis:0.00000,
  D_subobscura:0.00787)
  :0.00257,
  D_guanche:0.00530)
  :0.00336,
  (
  (
  D_pseudoobscura:0.00000,
  D_pseudoobscura_pseudo:0.00000)
  :0.00262,
  D_persimilis:0.00131)
  :0.01239)
  :0.01132,
  D_ambigua:0.01821)
  :0.00839,
  
  ```
  
  So, it looks like I have a path to doing what I wanted in the first place - getting from .fasta to Newick format.
  
  Then, using the programs [jalview](https://www.jalview.org/) and [figtree](http://tree.bio.ed.ac.uk/software/figtree/), I was able to draw trees and the like!
  
  
  ---
  
  