= Introduction =
-Tutorial for multiple sequence alignments and phylogenetic methods in !BioRuby -- under development!
+Under development!
+Tutorial for multiple sequence alignments and phylogenetic methods in [http://bioruby.open-bio.org/ BioRuby].
+
+Eventually, this is expected to be placed on the official !BioRuby page.
+
+Author: [http://www.cmzmasek.net/ Christian M Zmasek], Sanford-Burnham Medical Research Institute
+
+
+Copyright (C) 2011 Christian M Zmasek
= Multiple Sequence Alignments =
=== Reading in a Multiple Sequence Alignment from a File ===
-Reading in a clustalw formatted multiple sequence alignment:
+The follow example shows how to read in a *ClustalW*-formatted multiple sequence alignment.
{{{
#!/usr/bin/env ruby
require 'bio'
-# Reads in a clustalw formatted multiple sequence alignment
+# Reads in a ClustalW-formatted multiple sequence alignment
# from a file named "infile_clustalw.aln" and stores it in 'report'.
report = Bio::ClustalW::Report.new(File.read('infile_clustalw.aln'))
+# Accesses the actual alignment.
+align = report.alignment
+
+# Goes through all sequences in 'align' and prints the
+# actual molecular sequence.
+align.each do |entry|
+ puts entry.seq
+end
}}}
=== Writing a Multiple Sequence Alignment to a File ===
-_... to be done_
+
+The follow example shows how to writing a multiple sequence alignment in *FASTA*-format:
{{{
#!/usr/bin/env ruby
require 'bio'
+# Creates a new file named "outfile.fasta" and writes
+# multiple sequence alignment 'align' to it in fasta format.
+File.open('outfile.fasta', 'w') do |f|
+ f.write(align.output(:fasta))
+end
+}}}
+
+The following constants determine the output format
+
+ * ClustalW: `:clustal`
+ * FASTA: `:fasta`
+ * PHYLIP interleaved (will truncate sequence names to no more than 10 characters): `:phylip`
+ * PHYLIP non-interleaved (will truncate sequence names to no more than 10 characters): `:phylipnon`
+ * MSF: `:msf`
+ * Molphy: `:molphy`
+
+
+For example, the following writes iPHYLIP's non-interleaved format:
+
+{{{
+f.write(align.output(:phylipnon))
}}}
=== MAFFT ===
+The following example uses the MAFFT program to align four sequences
+and then prints the result to the screen.
+Please note that if the path to the MAFFT executable is properly set `mafft=Bio::MAFFT.new(options)` can be used instead of explicitly indicating the path as in the example.
+
{{{
#!/usr/bin/env ruby
require 'bio'
_need to further test and then import GSoC 'SDI' work..._
-== Others? ==
\ No newline at end of file
+== Others? ==
+
+
+----
+
+= Putting It All Together =
+
+Example of a small "pipeline"-type program running a mininal phyogenetic analysis: starting with a set of sequences and ending with a phylogenetic tree.
+
\ No newline at end of file