[BioRuby-cvs] bioruby/lib/bio/appl/clustalw report.rb,1.4,1.5

Katayama Toshiaki k at pub.open-bio.org
Wed Sep 7 21:22:11 EDT 2005


Update of /home/repository/bioruby/bioruby/lib/bio/appl/clustalw
In directory pub.open-bio.org:/tmp/cvs-serv9021/lib/bio/appl/clustalw

Modified Files:
	report.rb 
Log Message:
* expanded tab at the line head


Index: report.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/clustalw/report.rb,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** report.rb	4 Mar 2005 04:48:41 -0000	1.4
--- report.rb	8 Sep 2005 01:22:09 -0000	1.5
***************
*** 32,51 ****
  
        def initialize(str, seqclass = nil)
! 	@raw = str
! 	@align = nil
! 	@match_line = nil
! 	@header = nil
! 	case seqclass
! 	when /PROTEIN/i
! 	  @seqclass = Bio::Sequence::AA
! 	when /[DR]NA/i
! 	  @seqclass = Bio::Sequence::NA
! 	else
! 	  if seqclass.is_a?(Module) then
! 	    @seqclass = seqclass
! 	  else
! 	    @seqclass = Bio::Sequence
! 	  end
! 	end
        end
        attr_reader :raw
--- 32,51 ----
  
        def initialize(str, seqclass = nil)
!         @raw = str
!         @align = nil
!         @match_line = nil
!         @header = nil
!         case seqclass
!         when /PROTEIN/i
!           @seqclass = Bio::Sequence::AA
!         when /[DR]NA/i
!           @seqclass = Bio::Sequence::NA
!         else
!           if seqclass.is_a?(Module) then
!             @seqclass = seqclass
!           else
!             @seqclass = Bio::Sequence
!           end
!         end
        end
        attr_reader :raw
***************
*** 53,107 ****
  
        def header
! 	@header or (do_parse or @header)
        end
  
        def match_line
! 	@match_line or (do_parse or @match_line)
        end
  
        def align
! 	do_parse() unless @align
! 	@align
        end
        alias :alignment :align
  
        def to_fasta(*arg)
! 	align.to_fasta(*arg)
        end
  
        def to_a
! 	align.to_fastaformat_array
        end
  
        private
        def do_parse
! 	return nil if @align
! 	a = @raw.split(/\r?\n\r?\n/)
! 	@header = a.shift.to_s
! 	xalign = Bio::Alignment.new
! 	@match_line = ''
! 	if a.size > 0 then
! 	  a[0].gsub!(/\A(\r?\n)+/, '')
! 	  a.collect! { |x| x.split(/\r?\n/) }
            a.each { |x|
              x.each { |y| y.sub!(/ +\d+\s*$/, '') }} #for -SEQNOS=on option
! 	  @tagsize = ( a[0][0].rindex(/\s/) or -1 ) + 1
! 	  a.each do |x|
! 	    @match_line << x.pop.to_s[@tagsize..-1]
! 	  end
! 	  a[0].each do |y|
! 	    xalign.store(y[0, @tagsize].sub(/\s+\z/, ''), '')
! 	  end
! 	  a.each do |x|
! 	    x.each do |y|
! 	      name = y[0, @tagsize].sub(/\s+\z/, '')
! 	      seq = y[@tagsize..-1]
! 	      xalign[name] << seq
! 	    end
! 	  end
! 	  xalign.collect! { |x| @seqclass.new(x) }
! 	end
          @align = xalign
! 	nil
        end
  
--- 53,107 ----
  
        def header
!         @header or (do_parse or @header)
        end
  
        def match_line
!         @match_line or (do_parse or @match_line)
        end
  
        def align
!         do_parse() unless @align
!         @align
        end
        alias :alignment :align
  
        def to_fasta(*arg)
!         align.to_fasta(*arg)
        end
  
        def to_a
!         align.to_fastaformat_array
        end
  
        private
        def do_parse
!         return nil if @align
!         a = @raw.split(/\r?\n\r?\n/)
!         @header = a.shift.to_s
!         xalign = Bio::Alignment.new
!         @match_line = ''
!         if a.size > 0 then
!           a[0].gsub!(/\A(\r?\n)+/, '')
!           a.collect! { |x| x.split(/\r?\n/) }
            a.each { |x|
              x.each { |y| y.sub!(/ +\d+\s*$/, '') }} #for -SEQNOS=on option
!           @tagsize = ( a[0][0].rindex(/\s/) or -1 ) + 1
!           a.each do |x|
!             @match_line << x.pop.to_s[@tagsize..-1]
!           end
!           a[0].each do |y|
!             xalign.store(y[0, @tagsize].sub(/\s+\z/, ''), '')
!           end
!           a.each do |x|
!             x.each do |y|
!               name = y[0, @tagsize].sub(/\s+\z/, '')
!               seq = y[@tagsize..-1]
!               xalign[name] << seq
!             end
!           end
!           xalign.collect! { |x| @seqclass.new(x) }
!         end
          @align = xalign
!         nil
        end
  



More information about the bioruby-cvs mailing list