in progress...
[jalview.git] / forester / ruby / scripts / bioruby_examples / msa_1.rb
1 require 'rubygems'
2 require 'bio'
3  
4 # creating a Bio::Sequence::NA object containing ambiguous alphabets
5 #as = Bio::Sequence::NA.new("atgcyrwskmbdhvn")
6
7 #print as.to_s
8
9 #print "\n"
10
11
12 #seq1 = Bio::Sequence::AA.new("gggggg")
13 #seq2 = Bio::Sequence::AA.new("ggggt")
14 #seq3 = Bio::Sequence::AA.new("ggt")
15
16
17
18 seqs = [ "KMLFGVVFFFGG",
19          "LMGGHHF",
20          "GKKKKGHHHGHRRRGR",
21          "KKKKGHHHGHRRRGR" ] 
22
23
24 # MAFFT
25 options = [ '--maxiterate', '1000', '--localpair' ]
26 mafft = Bio::MAFFT.new('/home/zma/SOFTWARE/mafft-6.847-without-extensions/scripts/mafft', options )
27 report = mafft.query_align( seqs)
28
29 # Accesses the actual alignment
30 align = report.alignment
31
32 # Prints each sequence to the console.
33 align.each { |s| puts s.to_s }
34
35
36 puts 'MAFFT OK'
37 puts
38
39 #clustalw
40 clustalw = Bio::ClustalW.new('/home/zma/SOFTWARE/clustalw-2.1/src/clustalw2' )
41 report = clustalw.query_align( seqs)
42 #puts report.alignment.output_fasta.to_s
43 report.alignment.each { |x| puts x.to_s }
44 puts 'OK'
45 puts
46
47 #muscle
48 options = [ '-quiet', '-maxiters', '64' ]
49 muscle = Bio::Muscle.new('/home/zma/SOFTWARE/muscle3.8.31/src/muscle', options )
50 report = muscle.query_align( seqs)
51 #puts report.alignment.output_fasta.to_s
52 report.alignment.each { |x| puts x.to_s }
53 puts 'OK'
54 puts