[BioRuby-cvs] bioruby/lib/bio/util restriction_enzyme.rb, 1.13, 1.14

Trevor Wennblom trevor at dev.open-bio.org
Sun May 13 01:25:27 UTC 2007


Update of /home/repository/bioruby/bioruby/lib/bio/util
In directory dev.open-bio.org:/tmp/cvs-serv4852/lib/bio/util

Modified Files:
	restriction_enzyme.rb 
Log Message:
Fix spacing.


Index: restriction_enzyme.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme.rb,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** restriction_enzyme.rb	5 Apr 2007 23:35:41 -0000	1.13
--- restriction_enzyme.rb	13 May 2007 01:25:25 -0000	1.14
***************
*** 126,228 ****
    
  class Bio::RestrictionEnzyme
!     include CutSymbol
!     extend CutSymbol
  
!     # See Bio::RestrictionEnzyme::DoubleStranded.new for more information.
!     #
!     # ---
!     # *Arguments*
!     # * +users_enzyme_or_rebase_or_pattern+: One of three possible parameters:  The name of an enzyme, a REBASE::EnzymeEntry object, or a nucleotide pattern with a cut mark.
!     # * +cut_locations+: The cut locations in enzyme index notation.
!     # *Returns*:: Bio::RestrictionEnzyme::DoubleStranded
!     #--
!     # Factory for DoubleStranded
!     #++
!     def self.new(users_enzyme_or_rebase_or_pattern, *cut_locations)
!       DoubleStranded.new(users_enzyme_or_rebase_or_pattern, *cut_locations)
!     end
  
!     # REBASE enzyme data information
!     #
!     # Returns a Bio::REBASE object loaded with all of the enzyme data on file.
!     #
!     # ---
!     # *Arguments*
!     # * _none_
!     # *Returns*:: Bio::REBASE
!     def self.rebase
!       enzymes_yaml_file = File.join(File.dirname(File.expand_path(__FILE__)), 'restriction_enzyme', 'enzymes.yaml')
!       @@rebase_enzymes ||= Bio::REBASE.load_yaml(enzymes_yaml_file)
!       @@rebase_enzymes
!     end
  
!     # Check if supplied name is the name of an available enzyme
!     #
!     # See Bio::REBASE.enzyme_name?
!     #
!     # ---
!     # *Arguments*
!     # * +name+: Enzyme name
!     # *Returns*:: +true+ _or_ +false+
!     def self.enzyme_name?( name )
!       self.rebase.enzyme_name?(name)
!     end
  
!     # See Bio::RestrictionEnzyme::Analysis.cut
!     def self.cut( sequence, enzymes )
!       Bio::RestrictionEnzyme::Analysis.cut( sequence, enzymes )
!     end
  
!     # A Bio::RestrictionEnzyme::Fragment is a DNA fragment composed of fused primary and 
!     # complementary strands that would be found floating in solution after a full
!     # sequence is digested by one or more RestrictionEnzymes.
!     #
!     # You will notice that either the primary or complement strand will be
!     # padded with spaces to make them line up according to the original DNA
!     # configuration before they were cut.
!     #
!     # Example:
!     #
!     # Fragment 1:
!     #   primary =    "attaca"
!     #   complement = "  atga"
!     # 
!     # Fragment 2:
!     #   primary =    "g  "
!     #   complement = "cta"
!     # 
!     # View these with the +primary+ and +complement+ methods.
!     # 
!     # Bio::RestrictionEnzyme::Fragment is a simple +Struct+ object.
!     # 
!     # Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragment
!     Fragment = Struct.new(:primary, :complement)
  
!     # Bio::RestrictionEnzyme::Fragments inherits from +Array+.
!     #
!     # Bio::RestrictionEnzyme::Fragments is a container for Fragment objects.  It adds the
!     # methods +primary+ and +complement+ which returns an +Array+ of all
!     # respective strands from it's Fragment members in alphabetically sorted 
!     # order.  Note that it will
!     # not return duplicate items and does not return the spacing/padding 
!     # that you would
!     # find by accessing the members directly.
!     # 
!     # Example:
!     #
!     #   primary = ['attaca', 'g']
!     #   complement = ['atga', 'cta']
!     #
!     # Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragments
!     class Fragments < Array
!       def primary; strip_and_sort(:primary); end
!       def complement; strip_and_sort(:complement); end
  
!       protected
  
!       def strip_and_sort( sym_strand )
!         self.map {|uf| uf.send( sym_strand ).tr(' ', '') }.sort
!       end
      end
  end # RestrictionEnzyme
! end # Bio
--- 126,228 ----
    
  class Bio::RestrictionEnzyme
!   include CutSymbol
!   extend CutSymbol
  
!   # See Bio::RestrictionEnzyme::DoubleStranded.new for more information.
!   #
!   # ---
!   # *Arguments*
!   # * +users_enzyme_or_rebase_or_pattern+: One of three possible parameters:  The name of an enzyme, a REBASE::EnzymeEntry object, or a nucleotide pattern with a cut mark.
!   # * +cut_locations+: The cut locations in enzyme index notation.
!   # *Returns*:: Bio::RestrictionEnzyme::DoubleStranded
!   #--
!   # Factory for DoubleStranded
!   #++
!   def self.new(users_enzyme_or_rebase_or_pattern, *cut_locations)
!     DoubleStranded.new(users_enzyme_or_rebase_or_pattern, *cut_locations)
!   end
  
!   # REBASE enzyme data information
!   #
!   # Returns a Bio::REBASE object loaded with all of the enzyme data on file.
!   #
!   # ---
!   # *Arguments*
!   # * _none_
!   # *Returns*:: Bio::REBASE
!   def self.rebase
!     enzymes_yaml_file = File.join(File.dirname(File.expand_path(__FILE__)), 'restriction_enzyme', 'enzymes.yaml')
!     @@rebase_enzymes ||= Bio::REBASE.load_yaml(enzymes_yaml_file)
!     @@rebase_enzymes
!   end
  
!   # Check if supplied name is the name of an available enzyme
!   #
!   # See Bio::REBASE.enzyme_name?
!   #
!   # ---
!   # *Arguments*
!   # * +name+: Enzyme name
!   # *Returns*:: +true+ _or_ +false+
!   def self.enzyme_name?( name )
!     self.rebase.enzyme_name?(name)
!   end
  
!   # See Bio::RestrictionEnzyme::Analysis.cut
!   def self.cut( sequence, enzymes )
!     Bio::RestrictionEnzyme::Analysis.cut( sequence, enzymes )
!   end
  
!   # A Bio::RestrictionEnzyme::Fragment is a DNA fragment composed of fused primary and 
!   # complementary strands that would be found floating in solution after a full
!   # sequence is digested by one or more RestrictionEnzymes.
!   #
!   # You will notice that either the primary or complement strand will be
!   # padded with spaces to make them line up according to the original DNA
!   # configuration before they were cut.
!   #
!   # Example:
!   #
!   # Fragment 1:
!   #   primary =    "attaca"
!   #   complement = "  atga"
!   # 
!   # Fragment 2:
!   #   primary =    "g  "
!   #   complement = "cta"
!   # 
!   # View these with the +primary+ and +complement+ methods.
!   # 
!   # Bio::RestrictionEnzyme::Fragment is a simple +Struct+ object.
!   # 
!   # Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragment
!   Fragment = Struct.new(:primary, :complement)
  
!   # Bio::RestrictionEnzyme::Fragments inherits from +Array+.
!   #
!   # Bio::RestrictionEnzyme::Fragments is a container for Fragment objects.  It adds the
!   # methods +primary+ and +complement+ which returns an +Array+ of all
!   # respective strands from it's Fragment members in alphabetically sorted 
!   # order.  Note that it will
!   # not return duplicate items and does not return the spacing/padding 
!   # that you would
!   # find by accessing the members directly.
!   # 
!   # Example:
!   #
!   #   primary = ['attaca', 'g']
!   #   complement = ['atga', 'cta']
!   #
!   # Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragments
!   class Fragments < Array
!     def primary; strip_and_sort(:primary); end
!     def complement; strip_and_sort(:complement); end
  
!     protected
  
!     def strip_and_sort( sym_strand )
!       self.map {|uf| uf.send( sym_strand ).tr(' ', '') }.sort
      end
+   end
  end # RestrictionEnzyme
! end # Bio
\ No newline at end of file




More information about the bioruby-cvs mailing list