[BioRuby-cvs] bioruby/lib/bio alignment.rb,1.12,1.13

Naohisa Goto ngoto at pub.open-bio.org
Fri Dec 2 02:01:40 EST 2005


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

Modified Files:
	alignment.rb 
Log Message:
* consensus_iupac now returns only standard bases
'a', 'c', 'g', 't', 'm', 'r', 'w', 's', 'y', 'k', 'v', 'h', 'd', 'b', 'n',
or nil (in SiteMethods#consensus_iupac) or '?' (or missing_char, in 
EnumerableExtension#consensus_iupac).
Note that consensus_iupac now does not return u and invalid letters
not defined in IUPAC standard even if all bases are equal.
* added more tests to test_alignment.rb



Index: alignment.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/alignment.rb,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** alignment.rb	25 Nov 2005 16:50:39 -0000	1.12
--- alignment.rb	2 Dec 2005 07:01:37 -0000	1.13
***************
*** 228,232 ****
          a = self.collect { |x| x.downcase }.sort.uniq
          if a.size == 1 then
!           a[0]
          elsif r = IUPAC_NUC.find { |x| (a - x).size <= 0 } then
            r[0]
--- 228,239 ----
          a = self.collect { |x| x.downcase }.sort.uniq
          if a.size == 1 then
!           case a[0]
!           when 'a', 'c', 'g', 't'
!             a[0]
!           when 'u'
!             't'
!           else
!             IUPAC_NUC.find { |x| a[0] == x[0] } ? a[0] : nil
!           end
          elsif r = IUPAC_NUC.find { |x| (a - x).size <= 0 } then
            r[0]
***************
*** 329,333 ****
      # For Array or Hash objects, you'd better using
      # ArrayExtension or HashExtension modules, respectively.
!     # They have built-in 'each_seq' method.
      #
      module EnumerableExtension
--- 336,341 ----
      # For Array or Hash objects, you'd better using
      # ArrayExtension or HashExtension modules, respectively.
!     # They would have built-in <tt>each_seq</tt> method and/or
!     # some methods would be redefined.
      #
      module EnumerableExtension
***************
*** 336,340 ****
        # Iterates over each sequences.
        # Yields a sequence.
!       # It acts same as Enumerable#each.
        #
        # You would redefine the method suitable for the class/object.
--- 344,348 ----
        # Iterates over each sequences.
        # Yields a sequence.
!       # It acts the same as Enumerable#each.
        #
        # You would redefine the method suitable for the class/object.
***************
*** 380,383 ****
--- 388,395 ----
        # If the position is out of range, it returns the site
        # of which all are gaps.
+       #
+       # It is a private method.
+       # Only difference from public alignment_site method is
+       # it does not do <tt>set_all_property(get_all_property)</tt>.
        def _alignment_site(position)
          site = Site.new
***************
*** 433,437 ****
        end
  
!       # Iterates over each sequence and each results running block
        # are collected and returns a new alignment as a
        # Bio::Alignment::SequenceArray object.
--- 445,449 ----
        end
  
!       # Iterates over each sequence and results running blocks
        # are collected and returns a new alignment as a
        # Bio::Alignment::SequenceArray object.



More information about the bioruby-cvs mailing list