[BioRuby-cvs] bioruby/lib/bio/appl/tmhmm report.rb,1.2,1.3

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


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

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


Index: report.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/tmhmm/report.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** report.rb	25 Feb 2003 15:44:18 -0000	1.2
--- report.rb	8 Sep 2005 01:22:11 -0000	1.3
***************
*** 29,58 ****
        ent_state = ''
        data.each_line do |line|
! 	if /^\#/ =~ line
! 	  if ent_state == 'next'
! 	    ent_state = 'entry'
! 	  elsif ent_state == 'tmh'
! 	    ent_state = 'next'
! 	  end
! 	else
! 	  ent_state = 'tmh'
! 	end
  
! 	if ent_state != 'next'
! 	  entry << line
! 	else
! 	  if block_given?
! 	    yield Bio::TMHMM::Report.new(entry)
! 	  else
! 	    Bio::TMHMM::Report.new(entry)
! 	  end
! 	  entry = [line]
! 	end
        end
  
        if block_given?
! 	yield Bio::TMHMM::Report.new(entry)
        else
! 	Bio::TMHMM::Report.new(entry)
        end
      end
--- 29,58 ----
        ent_state = ''
        data.each_line do |line|
!         if /^\#/ =~ line
!           if ent_state == 'next'
!             ent_state = 'entry'
!           elsif ent_state == 'tmh'
!             ent_state = 'next'
!           end
!         else
!           ent_state = 'tmh'
!         end
  
!         if ent_state != 'next'
!           entry << line
!         else
!           if block_given?
!             yield Bio::TMHMM::Report.new(entry)
!           else
!             Bio::TMHMM::Report.new(entry)
!           end
!           entry = [line]
!         end
        end
  
        if block_given?
!         yield Bio::TMHMM::Report.new(entry)
        else
!         Bio::TMHMM::Report.new(entry)
        end
      end
***************
*** 62,87 ****
  
        def initialize(entry = nil)
! 	parse_header(entry)
! 	@tmhs = parse_tmhs(entry)
        end
        attr_reader :tmhs, :entry_id, :query_len, :predicted_tmhs,
! 	:exp_aas_in_tmhs, :exp_first_60aa, :total_prob_of_N_in
        alias :length :query_len
  
        def helix
! 	@tmhs.map {|t| t if t.status == 'TMhelix' }.compact
        end
  
        def to_s
! 	[
! 	  [
! 	    ["Length:",                    @query_len],
! 	    ["Number of predicted TMHs:",  @predicted_tmhs],
! 	    ["Exp number of AAs in THMs:", @exp_aas_in_tmhs],
! 	    ["Exp number, first 60 AAs:",  @exp_first_60aa],
! 	    ["Total prob of N-in:",        @total_prob_of_N_in]
! 	  ].map {|e| "\# " + [@entry_id, e].flatten.join("\t") },
! 	  tmhs.map {|ent| ent.to_s }
! 	].flatten.join("\n")
        end
  
--- 62,87 ----
  
        def initialize(entry = nil)
!         parse_header(entry)
!         @tmhs = parse_tmhs(entry)
        end
        attr_reader :tmhs, :entry_id, :query_len, :predicted_tmhs,
!         :exp_aas_in_tmhs, :exp_first_60aa, :total_prob_of_N_in
        alias :length :query_len
  
        def helix
!         @tmhs.map {|t| t if t.status == 'TMhelix' }.compact
        end
  
        def to_s
!         [
!           [
!             ["Length:",                    @query_len],
!             ["Number of predicted TMHs:",  @predicted_tmhs],
!             ["Exp number of AAs in THMs:", @exp_aas_in_tmhs],
!             ["Exp number, first 60 AAs:",  @exp_first_60aa],
!             ["Total prob of N-in:",        @total_prob_of_N_in]
!           ].map {|e| "\# " + [@entry_id, e].flatten.join("\t") },
!           tmhs.map {|ent| ent.to_s }
!         ].flatten.join("\n")
        end
  
***************
*** 90,125 ****
  
        def parse_header(raw)
! 	raw.each do |line|
! 	  next unless /^#/.match(line)
  
! 	  case line
! 	  when / (\S.+) Length: +(\d+)/
! 	    @entry_id  = $1.strip
! 	    @query_len = $2.to_i
! 	  when /Number of predicted TMHs: +(\d+)/
! 	    @predicted_tmhs  = $1.to_i
! 	  when /Exp number of AAs in TMHs: +([\d\.]+)/
! 	    @exp_aas_in_tmhs = $1.to_f
! 	  when /Exp number, first 60 AAs: +([\d\.]+)/
! 	    @exp_first_60aa  = $1.to_f
! 	  when /Total prob of N-in: +([\d\.]+)/
! 	    @total_prob_of_N_in = $1.to_f
! 	  end
! 	end
        end
  
        def parse_tmhs(raw)
! 	tmhs = []
! 	raw.each do |line|
! 	  case line
! 	  when /^[^\#]/
! 	    eid,version,status,r0,r1 = line.split(/\s+/)
! 	    tmhs << Bio::TMHMM::TMH.new(eid.strip,
! 					version.strip, 
! 					status.strip, 
! 					Range.new(r0.to_i, r1.to_i))
! 	  end
! 	end
! 	tmhs
        end
  
--- 90,125 ----
  
        def parse_header(raw)
!         raw.each do |line|
!           next unless /^#/.match(line)
  
!           case line
!           when / (\S.+) Length: +(\d+)/
!             @entry_id  = $1.strip
!             @query_len = $2.to_i
!           when /Number of predicted TMHs: +(\d+)/
!             @predicted_tmhs  = $1.to_i
!           when /Exp number of AAs in TMHs: +([\d\.]+)/
!             @exp_aas_in_tmhs = $1.to_f
!           when /Exp number, first 60 AAs: +([\d\.]+)/
!             @exp_first_60aa  = $1.to_f
!           when /Total prob of N-in: +([\d\.]+)/
!             @total_prob_of_N_in = $1.to_f
!           end
!         end
        end
  
        def parse_tmhs(raw)
!         tmhs = []
!         raw.each do |line|
!           case line
!           when /^[^\#]/
!             eid,version,status,r0,r1 = line.split(/\s+/)
!             tmhs << Bio::TMHMM::TMH.new(eid.strip,
!                                         version.strip, 
!                                         status.strip, 
!                                         Range.new(r0.to_i, r1.to_i))
!           end
!         end
!         tmhs
        end
  
***************
*** 130,137 ****
  
        def initialize(entry_id = nil, version = nil, status = nil, range = nil)
! 	@entry_id = entry_id
! 	@version  = version
! 	@status   = status
! 	@range    = range
        end
        attr_accessor :entry_id, :version, :status, :range
--- 130,137 ----
  
        def initialize(entry_id = nil, version = nil, status = nil, range = nil)
!         @entry_id = entry_id
!         @version  = version
!         @status   = status
!         @range    = range
        end
        attr_accessor :entry_id, :version, :status, :range
***************
*** 139,143 ****
  
        def to_s
! 	[@entry_id, @version, @status, @range.first, @range.last].join("\t")
        end
  
--- 139,143 ----
  
        def to_s
!         [@entry_id, @version, @status, @range.first, @range.last].join("\t")
        end
  



More information about the bioruby-cvs mailing list