From nakao at dev.open-bio.org Tue May 8 13:02:15 2007 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Tue, 08 May 2007 17:02:15 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio db.rb,0.37,0.38 Message-ID: <200705081702.l48H2FLa027873@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv27851/lib/bio Modified Files: db.rb Log Message: * Goto's embl parsing patch applied. http://lists.open-bio.org/pipermail/bioruby/2007-May/000383.html Index: db.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db.rb,v retrieving revision 0.37 retrieving revision 0.38 diff -C2 -d -r0.37 -r0.38 *** db.rb 5 Apr 2007 23:35:39 -0000 0.37 --- db.rb 8 May 2007 17:02:13 -0000 0.38 *************** *** 314,323 **** # Returns the contents of the entry as a Hash. def entry2hash(entry) ! hash = Hash.new('') entry.each_line do |line| tag = tag_get(line) next if tag == 'XX' tag = 'R' if tag =~ /^R./ # Reference lines ! hash[tag] += line end return hash --- 314,323 ---- # Returns the contents of the entry as a Hash. def entry2hash(entry) ! hash = Hash.new { |h,k| h[k] = '' } entry.each_line do |line| tag = tag_get(line) next if tag == 'XX' tag = 'R' if tag =~ /^R./ # Reference lines ! hash[tag].concat line end return hash From trevor at dev.open-bio.org Sat May 12 21:25:27 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 01:25:27 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/util restriction_enzyme.rb, 1.13, 1.14 Message-ID: <200705130125.l4D1PRJD004872@dev.open-bio.org> 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 From trevor at dev.open-bio.org Sun May 13 00:08:04 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 04:08:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/util/restriction_enzyme analysis.rb, 1.18, 1.19 analysis_basic.rb, 1.14, 1.15 Message-ID: <200705130408.l4D484Sw005090@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme In directory dev.open-bio.org:/tmp/cvs-serv5059/lib/bio/util/restriction_enzyme Modified Files: analysis.rb analysis_basic.rb Log Message: Added view_ranges parameter to indicate preservation of cut location data in results. Index: analysis_basic.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/analysis_basic.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** analysis_basic.rb 23 Apr 2007 17:11:11 -0000 1.14 --- analysis_basic.rb 13 May 2007 04:08:02 -0000 1.15 *************** *** 98,102 **** # * +hsh+: +Hash+ Keys are a permutation ID, if any. Values are SequenceRange objects that have cuts applied. # *Returns*:: Bio::RestrictionEnzyme::Analysis::Fragments object populated with Bio::RestrictionEnzyme::Analysis::Fragment objects. ! def fragments_for_display( hsh ) ary = Fragments.new return ary unless hsh --- 98,102 ---- # * +hsh+: +Hash+ Keys are a permutation ID, if any. Values are SequenceRange objects that have cuts applied. # *Returns*:: Bio::RestrictionEnzyme::Analysis::Fragments object populated with Bio::RestrictionEnzyme::Analysis::Fragment objects. ! def fragments_for_display( hsh, view_ranges=false ) ary = Fragments.new return ary unless hsh *************** *** 104,111 **** hsh.each do |permutation_id, sequence_range| sequence_range.fragments.for_display.each do |fragment| ! ary << Bio::RestrictionEnzyme::Fragment.new(fragment.primary, fragment.complement) end end ! ary.uniq! ary end --- 104,117 ---- hsh.each do |permutation_id, sequence_range| sequence_range.fragments.for_display.each do |fragment| ! if view_ranges ! ary << Bio::RestrictionEnzyme::Fragment.new(fragment.primary, fragment.complement, fragment.p_left, fragment.p_right, fragment.c_left, fragment.c_right) ! else ! ary << Bio::RestrictionEnzyme::Fragment.new(fragment.primary, fragment.complement) ! end end end ! ! ary.uniq! unless view_ranges ! ary end Index: analysis.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/analysis.rb,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** analysis.rb 23 Apr 2007 19:42:55 -0000 1.18 --- analysis.rb 13 May 2007 04:08:02 -0000 1.19 *************** *** 49,56 **** # *Returns*:: Bio::RestrictionEnzyme::Fragments object populated with Bio::RestrictionEnzyme::Fragment objects. (Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragments) or a +Symbol+ containing an error code def cut( sequence, *args ) res = cut_and_return_by_permutations( sequence, *args ) return res if res.class == Symbol # Format the fragments for the user ! fragments_for_display( res ) end --- 49,69 ---- # *Returns*:: Bio::RestrictionEnzyme::Fragments object populated with Bio::RestrictionEnzyme::Fragment objects. (Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragments) or a +Symbol+ containing an error code def cut( sequence, *args ) + view_ranges = false + + args.select { |i| i.class == Hash }.each do |hsh| + hsh.each do |key, value| + if key == :view_ranges + unless ( value.kind_of?(TrueClass) or value.kind_of?(FalseClass) ) + raise ArgumentError, "view_ranges must be set to true or false, currently #{value.inspect}." + end + view_ranges = value + end + end + end + res = cut_and_return_by_permutations( sequence, *args ) return res if res.class == Symbol # Format the fragments for the user ! fragments_for_display( res, view_ranges ) end *************** *** 79,84 **** when :max_permutations, 'max_permutations', :maximum_permutations, 'maximum_permutations' maximum_permutations = value.to_i unless value == nil else ! raise ArgumentError, "Received key #{key.inspect} in argument - I only know the key ':max_permutations' currently. Hash passed: #{hsh.inspect}" end end --- 92,98 ---- when :max_permutations, 'max_permutations', :maximum_permutations, 'maximum_permutations' maximum_permutations = value.to_i unless value == nil + when :view_ranges else ! raise ArgumentError, "Received key #{key.inspect} in argument - I only know the key ':max_permutations' and ':view_ranges' currently. Hash passed: #{hsh.inspect}" end end From trevor at dev.open-bio.org Sun May 13 00:08:04 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 04:08:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/util restriction_enzyme.rb, 1.14, 1.15 Message-ID: <200705130408.l4D484Np005087@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util In directory dev.open-bio.org:/tmp/cvs-serv5059/lib/bio/util Modified Files: restriction_enzyme.rb Log Message: Added view_ranges parameter to indicate preservation of cut location data in results. Index: restriction_enzyme.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** restriction_enzyme.rb 13 May 2007 01:25:25 -0000 1.14 --- restriction_enzyme.rb 13 May 2007 04:08:02 -0000 1.15 *************** *** 197,201 **** # # Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragment ! Fragment = Struct.new(:primary, :complement) # Bio::RestrictionEnzyme::Fragments inherits from +Array+. --- 197,201 ---- # # Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragment ! Fragment = Struct.new(:primary, :complement, :p_left, :p_right, :c_left, :c_right) # Bio::RestrictionEnzyme::Fragments inherits from +Array+. From trevor at dev.open-bio.org Sun May 13 00:08:04 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 04:08:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/util/restriction_enzyme/range/sequence_range fragment.rb, 1.4, 1.5 Message-ID: <200705130408.l4D484a7005097@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/range/sequence_range In directory dev.open-bio.org:/tmp/cvs-serv5059/lib/bio/util/restriction_enzyme/range/sequence_range Modified Files: fragment.rb Log Message: Added view_ranges parameter to indicate preservation of cut location data in results. Index: fragment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** fragment.rb 5 Apr 2007 23:35:42 -0000 1.4 --- fragment.rb 13 May 2007 04:08:02 -0000 1.5 *************** *** 34,38 **** end ! DisplayFragment = Struct.new(:primary, :complement) def for_display(p_str=nil, c_str=nil) --- 34,38 ---- end ! DisplayFragment = Struct.new(:primary, :complement, :p_left, :p_right, :c_left, :c_right) def for_display(p_str=nil, c_str=nil) *************** *** 46,49 **** --- 46,54 ---- @complement_bin.include?(item) ? df.complement << c_str[item] : df.complement << ' ' end + + df.p_left = @primary_bin.first + df.p_right = @primary_bin.last + df.c_left = @complement_bin.first + df.c_right = @complement_bin.last df From trevor at dev.open-bio.org Sun May 13 00:08:04 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 04:08:04 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/util/restriction_enzyme test_analysis.rb, 1.11, 1.12 Message-ID: <200705130408.l4D484Ie005108@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/util/restriction_enzyme In directory dev.open-bio.org:/tmp/cvs-serv5059/test/unit/bio/util/restriction_enzyme Modified Files: test_analysis.rb Log Message: Added view_ranges parameter to indicate preservation of cut location data in results. Index: test_analysis.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/util/restriction_enzyme/test_analysis.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_analysis.rb 23 Apr 2007 19:42:55 -0000 1.11 --- test_analysis.rb 13 May 2007 04:08:02 -0000 1.12 *************** *** 69,72 **** --- 69,74 ---- @obj_99 = @t.cut_without_permutations('', 'EcoRII', 'HincII') + @obj_vr1 = @t.cut('gaccaggaaaaagaccaggaaagcctggaaaagttaac', 'EcoRII', {:view_ranges => true}) + @obj_vr2 = @t.cut('cagagag', {:view_ranges => true}, 'ag^ag') end *************** *** 167,170 **** --- 169,243 ---- assert_equal(["a", "gtctctcggtcc"], Bio::Sequence::NA.new('cagagagccaggt').cut_with_enzymes('EcoRII').complement ) end + + def test_view_ranges + assert_equal(["ccaggaaaaaga", "ccaggaaag", "cctggaaaagttaac", "ga"], @obj_vr1.primary) + assert_equal(["ctggtcc", "tttcggacc", "ttttcaattg", "tttttctggtcc"], @obj_vr1.complement) + + a0 = @obj_vr1[0] + assert_equal('ga ', a0.primary) + assert_equal('ctggtcc', a0.complement) + assert_equal(0, a0.p_left) + assert_equal(1, a0.p_right) + assert_equal(0, a0.c_left) + assert_equal(6, a0.c_right) + + a1 = @obj_vr1[1] + assert_equal('ccaggaaaaaga ', a1.primary) + assert_equal(' tttttctggtcc', a1.complement) + assert_equal(2, a1.p_left) + assert_equal(13, a1.p_right) + assert_equal(7, a1.c_left) + assert_equal(18, a1.c_right) + + a2 = @obj_vr1[2] + assert_equal('ccaggaaag ', a2.primary) + assert_equal(' tttcggacc', a2.complement) + assert_equal(14, a2.p_left) + assert_equal(22, a2.p_right) + assert_equal(19, a2.c_left) + assert_equal(27, a2.c_right) + + a3 = @obj_vr1[3] + assert_equal('cctggaaaagttaac', a3.primary) + assert_equal(' ttttcaattg', a3.complement) + assert_equal(23, a3.p_left) + assert_equal(37, a3.p_right) + assert_equal(28, a3.c_left) + assert_equal(37, a3.c_right) + + a4 = @obj_vr1[4] + assert_equal(nil, a4) + + assert_equal(["ag", "ag", "cag"], @obj_vr2.primary) + assert_equal(["gtc", "tc", "tc"], @obj_vr2.complement) + + a0 = @obj_vr2[0] + assert_equal('cag', a0.primary) + assert_equal('gtc', a0.complement) + assert_equal(0, a0.p_left) + assert_equal(2, a0.p_right) + assert_equal(0, a0.c_left) + assert_equal(2, a0.c_right) + + a1 = @obj_vr2[1] + assert_equal('ag', a1.primary) + assert_equal('tc', a1.complement) + assert_equal(3, a1.p_left) + assert_equal(4, a1.p_right) + assert_equal(3, a1.c_left) + assert_equal(4, a1.c_right) + + a2 = @obj_vr2[2] + assert_equal('ag', a2.primary) + assert_equal('tc', a2.complement) + assert_equal(5, a2.p_left) + assert_equal(6, a2.p_right) + assert_equal(5, a2.c_left) + assert_equal(6, a2.c_right) + + a3 = @obj_vr2[3] + assert_equal(nil, a3) + end + end From trevor at dev.open-bio.org Sun May 13 00:08:04 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 04:08:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/util/restriction_enzyme/range sequence_range.rb, 1.7, 1.8 Message-ID: <200705130408.l4D484gg005094@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/range In directory dev.open-bio.org:/tmp/cvs-serv5059/lib/bio/util/restriction_enzyme/range Modified Files: sequence_range.rb Log Message: Added view_ranges parameter to indicate preservation of cut location data in results. Index: sequence_range.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/range/sequence_range.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sequence_range.rb 5 Apr 2007 23:35:42 -0000 1.7 --- sequence_range.rb 13 May 2007 04:08:02 -0000 1.8 *************** *** 130,133 **** --- 130,139 ---- # 3=>#, # 4=>#} + # + # Note that the bin cannot be easily stored as a range since there may be + # nucleotides excised in the middle of a range. + # + # TODO: Perhaps store the bins as one-or-many ranges since missing + # nucleotides due to enzyme cutting is a special case. Bin = Struct.new(:c, :p) From k at dev.open-bio.org Fri May 18 11:22:55 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 18 May 2007 15:22:55 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl fasta.rb,1.24,1.25 Message-ID: <200705181522.l4IFMtxo011531@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv11527/lib/bio/appl Modified Files: fasta.rb Log Message: * bug fix: exec_local fails to exec when @ktup is nil. This problem is reported and fixed by Fredrik Johansson. Thanks! Index: fasta.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/fasta.rb,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** fasta.rb 5 Apr 2007 23:35:39 -0000 1.24 --- fasta.rb 18 May 2007 15:22:52 -0000 1.25 *************** *** 115,119 **** def exec_local(query) cmd = [ @program, *@options ] ! cmd.concat([ '@', @db, @ktup ]) report = nil --- 115,120 ---- def exec_local(query) cmd = [ @program, *@options ] ! cmd.concat([ '@', @db ]) ! cmd.push(@ktup) if @ktup report = nil From k at dev.open-bio.org Fri May 18 11:23:44 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 18 May 2007 15:23:44 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db gff.rb,1.8,1.9 Message-ID: <200705181523.l4IFNivk011574@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv11570/lib/bio/db Modified Files: gff.rb Log Message: * GFF3 separator is '=' instead of ' ' Index: gff.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/gff.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gff.rb 5 Apr 2007 23:35:40 -0000 1.8 --- gff.rb 18 May 2007 15:23:42 -0000 1.9 *************** *** 139,142 **** --- 139,153 ---- class GFF3 < GFF VERSION = 3 + + private + + def parse_attributes(attributes) + hash = Hash.new + attributes.split(/[^\\];/).each do |atr| + key, value = atr.split('=', 2) + hash[key] = value + end + return hash + end end From nakao at dev.open-bio.org Tue May 8 17:02:15 2007 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Tue, 08 May 2007 17:02:15 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio db.rb,0.37,0.38 Message-ID: <200705081702.l48H2FLa027873@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv27851/lib/bio Modified Files: db.rb Log Message: * Goto's embl parsing patch applied. http://lists.open-bio.org/pipermail/bioruby/2007-May/000383.html Index: db.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db.rb,v retrieving revision 0.37 retrieving revision 0.38 diff -C2 -d -r0.37 -r0.38 *** db.rb 5 Apr 2007 23:35:39 -0000 0.37 --- db.rb 8 May 2007 17:02:13 -0000 0.38 *************** *** 314,323 **** # Returns the contents of the entry as a Hash. def entry2hash(entry) ! hash = Hash.new('') entry.each_line do |line| tag = tag_get(line) next if tag == 'XX' tag = 'R' if tag =~ /^R./ # Reference lines ! hash[tag] += line end return hash --- 314,323 ---- # Returns the contents of the entry as a Hash. def entry2hash(entry) ! hash = Hash.new { |h,k| h[k] = '' } entry.each_line do |line| tag = tag_get(line) next if tag == 'XX' tag = 'R' if tag =~ /^R./ # Reference lines ! hash[tag].concat line end return hash From trevor at dev.open-bio.org Sun May 13 01:25:27 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 01:25:27 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/util restriction_enzyme.rb, 1.13, 1.14 Message-ID: <200705130125.l4D1PRJD004872@dev.open-bio.org> 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 From trevor at dev.open-bio.org Sun May 13 04:08:04 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 04:08:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/util/restriction_enzyme analysis.rb, 1.18, 1.19 analysis_basic.rb, 1.14, 1.15 Message-ID: <200705130408.l4D484Sw005090@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme In directory dev.open-bio.org:/tmp/cvs-serv5059/lib/bio/util/restriction_enzyme Modified Files: analysis.rb analysis_basic.rb Log Message: Added view_ranges parameter to indicate preservation of cut location data in results. Index: analysis_basic.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/analysis_basic.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** analysis_basic.rb 23 Apr 2007 17:11:11 -0000 1.14 --- analysis_basic.rb 13 May 2007 04:08:02 -0000 1.15 *************** *** 98,102 **** # * +hsh+: +Hash+ Keys are a permutation ID, if any. Values are SequenceRange objects that have cuts applied. # *Returns*:: Bio::RestrictionEnzyme::Analysis::Fragments object populated with Bio::RestrictionEnzyme::Analysis::Fragment objects. ! def fragments_for_display( hsh ) ary = Fragments.new return ary unless hsh --- 98,102 ---- # * +hsh+: +Hash+ Keys are a permutation ID, if any. Values are SequenceRange objects that have cuts applied. # *Returns*:: Bio::RestrictionEnzyme::Analysis::Fragments object populated with Bio::RestrictionEnzyme::Analysis::Fragment objects. ! def fragments_for_display( hsh, view_ranges=false ) ary = Fragments.new return ary unless hsh *************** *** 104,111 **** hsh.each do |permutation_id, sequence_range| sequence_range.fragments.for_display.each do |fragment| ! ary << Bio::RestrictionEnzyme::Fragment.new(fragment.primary, fragment.complement) end end ! ary.uniq! ary end --- 104,117 ---- hsh.each do |permutation_id, sequence_range| sequence_range.fragments.for_display.each do |fragment| ! if view_ranges ! ary << Bio::RestrictionEnzyme::Fragment.new(fragment.primary, fragment.complement, fragment.p_left, fragment.p_right, fragment.c_left, fragment.c_right) ! else ! ary << Bio::RestrictionEnzyme::Fragment.new(fragment.primary, fragment.complement) ! end end end ! ! ary.uniq! unless view_ranges ! ary end Index: analysis.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/analysis.rb,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** analysis.rb 23 Apr 2007 19:42:55 -0000 1.18 --- analysis.rb 13 May 2007 04:08:02 -0000 1.19 *************** *** 49,56 **** # *Returns*:: Bio::RestrictionEnzyme::Fragments object populated with Bio::RestrictionEnzyme::Fragment objects. (Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragments) or a +Symbol+ containing an error code def cut( sequence, *args ) res = cut_and_return_by_permutations( sequence, *args ) return res if res.class == Symbol # Format the fragments for the user ! fragments_for_display( res ) end --- 49,69 ---- # *Returns*:: Bio::RestrictionEnzyme::Fragments object populated with Bio::RestrictionEnzyme::Fragment objects. (Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragments) or a +Symbol+ containing an error code def cut( sequence, *args ) + view_ranges = false + + args.select { |i| i.class == Hash }.each do |hsh| + hsh.each do |key, value| + if key == :view_ranges + unless ( value.kind_of?(TrueClass) or value.kind_of?(FalseClass) ) + raise ArgumentError, "view_ranges must be set to true or false, currently #{value.inspect}." + end + view_ranges = value + end + end + end + res = cut_and_return_by_permutations( sequence, *args ) return res if res.class == Symbol # Format the fragments for the user ! fragments_for_display( res, view_ranges ) end *************** *** 79,84 **** when :max_permutations, 'max_permutations', :maximum_permutations, 'maximum_permutations' maximum_permutations = value.to_i unless value == nil else ! raise ArgumentError, "Received key #{key.inspect} in argument - I only know the key ':max_permutations' currently. Hash passed: #{hsh.inspect}" end end --- 92,98 ---- when :max_permutations, 'max_permutations', :maximum_permutations, 'maximum_permutations' maximum_permutations = value.to_i unless value == nil + when :view_ranges else ! raise ArgumentError, "Received key #{key.inspect} in argument - I only know the key ':max_permutations' and ':view_ranges' currently. Hash passed: #{hsh.inspect}" end end From trevor at dev.open-bio.org Sun May 13 04:08:04 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 04:08:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/util restriction_enzyme.rb, 1.14, 1.15 Message-ID: <200705130408.l4D484Np005087@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util In directory dev.open-bio.org:/tmp/cvs-serv5059/lib/bio/util Modified Files: restriction_enzyme.rb Log Message: Added view_ranges parameter to indicate preservation of cut location data in results. Index: restriction_enzyme.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme.rb,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** restriction_enzyme.rb 13 May 2007 01:25:25 -0000 1.14 --- restriction_enzyme.rb 13 May 2007 04:08:02 -0000 1.15 *************** *** 197,201 **** # # Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragment ! Fragment = Struct.new(:primary, :complement) # Bio::RestrictionEnzyme::Fragments inherits from +Array+. --- 197,201 ---- # # Note: unrelated to Bio::RestrictionEnzyme::Range::SequenceRange::Fragment ! Fragment = Struct.new(:primary, :complement, :p_left, :p_right, :c_left, :c_right) # Bio::RestrictionEnzyme::Fragments inherits from +Array+. From trevor at dev.open-bio.org Sun May 13 04:08:04 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 04:08:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/util/restriction_enzyme/range/sequence_range fragment.rb, 1.4, 1.5 Message-ID: <200705130408.l4D484a7005097@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/range/sequence_range In directory dev.open-bio.org:/tmp/cvs-serv5059/lib/bio/util/restriction_enzyme/range/sequence_range Modified Files: fragment.rb Log Message: Added view_ranges parameter to indicate preservation of cut location data in results. Index: fragment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/range/sequence_range/fragment.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** fragment.rb 5 Apr 2007 23:35:42 -0000 1.4 --- fragment.rb 13 May 2007 04:08:02 -0000 1.5 *************** *** 34,38 **** end ! DisplayFragment = Struct.new(:primary, :complement) def for_display(p_str=nil, c_str=nil) --- 34,38 ---- end ! DisplayFragment = Struct.new(:primary, :complement, :p_left, :p_right, :c_left, :c_right) def for_display(p_str=nil, c_str=nil) *************** *** 46,49 **** --- 46,54 ---- @complement_bin.include?(item) ? df.complement << c_str[item] : df.complement << ' ' end + + df.p_left = @primary_bin.first + df.p_right = @primary_bin.last + df.c_left = @complement_bin.first + df.c_right = @complement_bin.last df From trevor at dev.open-bio.org Sun May 13 04:08:04 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 04:08:04 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/util/restriction_enzyme test_analysis.rb, 1.11, 1.12 Message-ID: <200705130408.l4D484Ie005108@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/util/restriction_enzyme In directory dev.open-bio.org:/tmp/cvs-serv5059/test/unit/bio/util/restriction_enzyme Modified Files: test_analysis.rb Log Message: Added view_ranges parameter to indicate preservation of cut location data in results. Index: test_analysis.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/util/restriction_enzyme/test_analysis.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_analysis.rb 23 Apr 2007 19:42:55 -0000 1.11 --- test_analysis.rb 13 May 2007 04:08:02 -0000 1.12 *************** *** 69,72 **** --- 69,74 ---- @obj_99 = @t.cut_without_permutations('', 'EcoRII', 'HincII') + @obj_vr1 = @t.cut('gaccaggaaaaagaccaggaaagcctggaaaagttaac', 'EcoRII', {:view_ranges => true}) + @obj_vr2 = @t.cut('cagagag', {:view_ranges => true}, 'ag^ag') end *************** *** 167,170 **** --- 169,243 ---- assert_equal(["a", "gtctctcggtcc"], Bio::Sequence::NA.new('cagagagccaggt').cut_with_enzymes('EcoRII').complement ) end + + def test_view_ranges + assert_equal(["ccaggaaaaaga", "ccaggaaag", "cctggaaaagttaac", "ga"], @obj_vr1.primary) + assert_equal(["ctggtcc", "tttcggacc", "ttttcaattg", "tttttctggtcc"], @obj_vr1.complement) + + a0 = @obj_vr1[0] + assert_equal('ga ', a0.primary) + assert_equal('ctggtcc', a0.complement) + assert_equal(0, a0.p_left) + assert_equal(1, a0.p_right) + assert_equal(0, a0.c_left) + assert_equal(6, a0.c_right) + + a1 = @obj_vr1[1] + assert_equal('ccaggaaaaaga ', a1.primary) + assert_equal(' tttttctggtcc', a1.complement) + assert_equal(2, a1.p_left) + assert_equal(13, a1.p_right) + assert_equal(7, a1.c_left) + assert_equal(18, a1.c_right) + + a2 = @obj_vr1[2] + assert_equal('ccaggaaag ', a2.primary) + assert_equal(' tttcggacc', a2.complement) + assert_equal(14, a2.p_left) + assert_equal(22, a2.p_right) + assert_equal(19, a2.c_left) + assert_equal(27, a2.c_right) + + a3 = @obj_vr1[3] + assert_equal('cctggaaaagttaac', a3.primary) + assert_equal(' ttttcaattg', a3.complement) + assert_equal(23, a3.p_left) + assert_equal(37, a3.p_right) + assert_equal(28, a3.c_left) + assert_equal(37, a3.c_right) + + a4 = @obj_vr1[4] + assert_equal(nil, a4) + + assert_equal(["ag", "ag", "cag"], @obj_vr2.primary) + assert_equal(["gtc", "tc", "tc"], @obj_vr2.complement) + + a0 = @obj_vr2[0] + assert_equal('cag', a0.primary) + assert_equal('gtc', a0.complement) + assert_equal(0, a0.p_left) + assert_equal(2, a0.p_right) + assert_equal(0, a0.c_left) + assert_equal(2, a0.c_right) + + a1 = @obj_vr2[1] + assert_equal('ag', a1.primary) + assert_equal('tc', a1.complement) + assert_equal(3, a1.p_left) + assert_equal(4, a1.p_right) + assert_equal(3, a1.c_left) + assert_equal(4, a1.c_right) + + a2 = @obj_vr2[2] + assert_equal('ag', a2.primary) + assert_equal('tc', a2.complement) + assert_equal(5, a2.p_left) + assert_equal(6, a2.p_right) + assert_equal(5, a2.c_left) + assert_equal(6, a2.c_right) + + a3 = @obj_vr2[3] + assert_equal(nil, a3) + end + end From trevor at dev.open-bio.org Sun May 13 04:08:04 2007 From: trevor at dev.open-bio.org (Trevor Wennblom) Date: Sun, 13 May 2007 04:08:04 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/util/restriction_enzyme/range sequence_range.rb, 1.7, 1.8 Message-ID: <200705130408.l4D484gg005094@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/range In directory dev.open-bio.org:/tmp/cvs-serv5059/lib/bio/util/restriction_enzyme/range Modified Files: sequence_range.rb Log Message: Added view_ranges parameter to indicate preservation of cut location data in results. Index: sequence_range.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/util/restriction_enzyme/range/sequence_range.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sequence_range.rb 5 Apr 2007 23:35:42 -0000 1.7 --- sequence_range.rb 13 May 2007 04:08:02 -0000 1.8 *************** *** 130,133 **** --- 130,139 ---- # 3=>#, # 4=>#} + # + # Note that the bin cannot be easily stored as a range since there may be + # nucleotides excised in the middle of a range. + # + # TODO: Perhaps store the bins as one-or-many ranges since missing + # nucleotides due to enzyme cutting is a special case. Bin = Struct.new(:c, :p) From k at dev.open-bio.org Fri May 18 15:22:55 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 18 May 2007 15:22:55 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl fasta.rb,1.24,1.25 Message-ID: <200705181522.l4IFMtxo011531@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv11527/lib/bio/appl Modified Files: fasta.rb Log Message: * bug fix: exec_local fails to exec when @ktup is nil. This problem is reported and fixed by Fredrik Johansson. Thanks! Index: fasta.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/fasta.rb,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** fasta.rb 5 Apr 2007 23:35:39 -0000 1.24 --- fasta.rb 18 May 2007 15:22:52 -0000 1.25 *************** *** 115,119 **** def exec_local(query) cmd = [ @program, *@options ] ! cmd.concat([ '@', @db, @ktup ]) report = nil --- 115,120 ---- def exec_local(query) cmd = [ @program, *@options ] ! cmd.concat([ '@', @db ]) ! cmd.push(@ktup) if @ktup report = nil From k at dev.open-bio.org Fri May 18 15:23:44 2007 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Fri, 18 May 2007 15:23:44 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db gff.rb,1.8,1.9 Message-ID: <200705181523.l4IFNivk011574@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv11570/lib/bio/db Modified Files: gff.rb Log Message: * GFF3 separator is '=' instead of ' ' Index: gff.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/gff.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gff.rb 5 Apr 2007 23:35:40 -0000 1.8 --- gff.rb 18 May 2007 15:23:42 -0000 1.9 *************** *** 139,142 **** --- 139,153 ---- class GFF3 < GFF VERSION = 3 + + private + + def parse_attributes(attributes) + hash = Hash.new + attributes.split(/[^\\];/).each do |atr| + key, value = atr.split('=', 2) + hash[key] = value + end + return hash + end end