[BioRuby-cvs] bioruby/lib/bio/util restriction_enzyme.rb,1.9,1.10
Trevor Wennblom
trevor at dev.open-bio.org
Fri Jan 5 06:11:17 UTC 2007
Update of /home/repository/bioruby/bioruby/lib/bio/util
In directory dev.open-bio.org:/tmp/cvs-serv15916
Modified Files:
restriction_enzyme.rb
Log Message:
Index: restriction_enzyme.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme.rb,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** restriction_enzyme.rb 5 Jan 2007 06:03:22 -0000 1.9
--- restriction_enzyme.rb 5 Jan 2007 06:11:15 -0000 1.10
***************
*** 233,236 ****
--- 233,275 ----
end
+ # A Fragment is a sequence fragment composed of a primary and
+ # complementary that would be found floating in solution after a full
+ # sequence is digested by a RestrictionEnzyme.
+ #
+ # 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 being cut.
+ #
+ # Example:
+ #
+ # primary = "gattaca"
+ # complement = " atga"
+ #
+ # View these with the 'primary' and 'complement' methods.
+ #
+ # Bio::RestrictionEnzyme::Analysis::Fragment is a simple +Struct+ object.
+ #
+ # *Note: unrelated to SequenceRange::Fragment*
+ Fragment = Struct.new(:primary, :complement)
+
+ # Fragments inherits from +Array+.
+ #
+ # 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. Note that it will
+ # not return duplicate items and does not return the spacing that you would
+ # find by accessing the members directly.
+ #
+ # *Note: unrelated to 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
More information about the bioruby-cvs
mailing list