Edited wiki page PhyloBioRuby through web user interface.
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Sun, 27 Feb 2011 04:26:02 +0000 (04:26 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Sun, 27 Feb 2011 04:26:02 +0000 (04:26 +0000)
wiki/PhyloBioRuby.wiki

index 80d1927..8d372e1 100644 (file)
@@ -25,21 +25,47 @@ require 'bio'
 # 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_
+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
 }}}
 
 
+Writing a multiple sequence alignment in clustalw format:
+
+{{{
+#!/usr/bin/env ruby
+require 'bio'
+
+# Creates a new file named "outfile.aln" and writes
+# multiple sequence alignment 'align' to it in clustal format.
+File.open('outfile.aln', 'w') do |f|
+  f.write(align.output(:clustal))
+end
+}}}
+
 
 == Calculating Multiple Sequence Alignments ==