lib/bio/appl/clustalw/report.rb in bio-1.4.0 vs lib/bio/appl/clustalw/report.rb in bio-1.4.1
- old
+ new
@@ -1,9 +1,11 @@
#
# = bio/appl/clustalw/report.rb - CLUSTAL W format data (*.aln) class
#
# Copyright:: Copyright (C) 2003 GOTO Naohisa <ngoto@gen-info.osaka-u.ac.jp>
+# Copyright (C) 2010 Pjotr Prins <pjotr.prins@thebird.nl>
+#
# License:: The Ruby License
#
# $Id: report.rb,v 1.13 2007/07/18 08:47:39 ngoto Exp $
#
# Bio::ClustalW::Report is a CLUSTAL W report (*.aln file) parser.
@@ -68,9 +70,25 @@
# Shows first line of the result data, for example,
# 'CLUSTAL W (1.82) multiple sequence alignment'.
# Returns a string.
def header
@header or (do_parse or @header)
+ end
+
+ # Returns the Bio::Sequence in the matrix at row 'row' as
+ # Bio::Sequence object. When _row_ is out of range a nil is returned.
+ # ---
+ # *Arguments*:
+ # * (required) _row_: Integer
+ # *Returns*:: Bio::Sequence
+ def get_sequence(row)
+ a = alignment
+ return nil if row < 0 or row >= a.keys.size
+ id = a.keys[row]
+ seq = a.to_hash[id]
+ s = Bio::Sequence.new(seq.seq)
+ s.definition = id
+ s
end
# Shows "match line" of CLUSTAL's alignment result, for example,
# ':* :* .* * .*::*. ** :* . * . '.
# Returns a string.