6 # Reads in a clustalw formatted multiple sequence alignment
7 # from a file named "infile_clustalw.aln" and stores it in 'report'.
8 report = Bio::ClustalW::Report.new(File.read('infile_clustalw.aln'))
10 # Accesses the actual alignment.
11 align = report.alignment
13 # Goes through all sequences in 'align' and prints the
14 # actual molecular sequence.
20 # Creates a new file named "outfile.fasta" and writes
21 # multiple sequence alignment 'align' to it in fasta format.
22 File.open('outfile.fasta', 'w') do |f|
23 f.write(align.output(:fasta))
26 # Creates a new file named "outfile.aln" and writes
27 # multiple sequence alignment 'align' to it in clustal format.
28 File.open('outfile.aln', 'w') do |f|
29 f.write(align.output(:clustal))
34 seq1 = Bio::Sequence.auto("gggggg")
37 puts seq1.output(:fasta)
38 #seq2 = Bio::Sequence::AA.new("ggggt")
39 #seq3 = Bio::Sequence::AA.new("ggt")
43 seqs = [ "MFQIPEFEPSEQEDSSSAER",
44 "MGTPKQPSLAPAHALGLRKS",
50 options = [ '--maxiterate', '1000', '--localpair' ]
51 mafft = Bio::MAFFT.new('/home/zma/SOFTWARE/mafft-6.847-without-extensions/scripts/mafft', options )
52 report = mafft.query_align( seqs)
54 # Accesses the actual alignment
55 align = report.alignment
57 # Prints each sequence to the console.
58 align.each { |s| puts s.to_s }
65 clustalw = Bio::ClustalW.new('/home/zma/SOFTWARE/clustalw-2.1/src/clustalw2' )
66 report = clustalw.query_align( seqs)
67 #puts report.alignment.output_fasta.to_s
68 report.alignment.each { |x| puts x.to_s }
73 options = [ '-quiet', '-maxiters', '64' ]
74 muscle = Bio::Muscle.new('/home/zma/SOFTWARE/muscle3.8.31/src/muscle', options )
75 report = muscle.query_align( seqs)
76 #puts report.alignment.output_fasta.to_s
77 report.alignment.each { |x| puts x.to_s }
81 file = Bio::FastaFormat.open('bcl2.fasta')
83 puts entry.entry_id # Gets the identifier, e.g. 'sp|O35147|BAD_RAT'.
84 puts entry.definition # Gets the complete fasta description line.
85 puts entry.seq # Gets the actual sequence.
86 puts entry.aaseq.composition # Gets the amino acid composition.
91 Bio::FlatFile.auto('bcl2.fasta') do |ff|
93 puts entry.entry_id # Gets the identifier, e.g. 'sp|O35147|BAD_RAT'.
94 puts entry.definition # Gets the complete fasta description line.
95 puts entry.seq # Gets the actual sequence.
96 puts entry.aaseq.composition # Gets the amino acid composition.