From aerts at dev.open-bio.org Thu Apr 20 11:58:36 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 20 Apr 2006 15:58:36 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio location.rb,0.22,0.23 Message-ID: <200604201558.k3KFwa79014586@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv14566 Modified Files: location.rb Log Message: Added and reformatted documentation. Index: location.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/location.rb,v retrieving revision 0.22 retrieving revision 0.23 diff -C2 -d -r0.22 -r0.23 *** location.rb 18 Dec 2005 15:50:06 -0000 0.22 --- location.rb 20 Apr 2006 15:58:34 -0000 0.23 *************** *** 2,16 **** # = bio/location.rb - Locations/Location class (GenBank location format) # ! # Copyright:: Copyright (C) 2001, 2005 ! # KATAYAMA Toshiaki # License:: LGPL # # $Id$ # ! # == Appendix : GenBank location descriptor classification # # === Definition of the position notation of the GenBank location format # ! # According to the GenBank manual 'gbrel.txt', I classified position notations # into 10 patterns - (A) to (J). # --- 2,167 ---- # = bio/location.rb - Locations/Location class (GenBank location format) # ! # Copyright:: Copyright (C) 2001, 2005 KATAYAMA Toshiaki ! # 2006 Jan Aerts # License:: LGPL # # $Id$ # ! # ! #-- ! # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! # ! #++ ! # ! ! module Bio ! ! # = DESCRIPTION ! # The Bio::Location class describes the position of a genomic locus. Typically, ! # Bio::Location objects are created automatically when the user creates a ! # Bio::Locations object, instead of initialized directly. ! # ! # = USAGE ! # location = Bio::Location.new('500..550') ! # puts "start=" + location.from.to_s + ";end=" + location.to.to_s ! # ! # #, or better: through Bio::Locations ! # locations = Bio::Locations.new('500..550') ! # locations.each do |location| ! # puts "start=" + location.from.to_s + ";end=" + location.to.to_s ! # end ! class Location ! ! # Parses a'location' segment, which can be 'ID:' + ('n' or 'n..m' or 'n^m' ! # or "seq") with '<' or '>', and returns a Bio::Location object. ! # location = Bio::Location.new('500..550') ! # ! # --- ! # *Arguments*: ! # * (required) _str_: GenBank style position string (see Bio::Locations documentation) ! # *Returns*:: Bio::Location object ! def initialize(location = nil) ! ! if location ! if location =~ /:/ # (G) ID:location ! xref_id, location = location.split(':') ! end ! if location =~ / ! lt = true ! end ! if location =~ />/ ! gt = true ! end ! end ! ! # s : start base, e : end base => from, to ! case location ! when /^[<>]?(\d+)$/ # (A, I) n ! s = e = $1.to_i ! when /^[<>]?(\d+)\.\.[<>]?(\d+)$/ # (B, I) n..m ! s = $1.to_i ! e = $2.to_i ! if e - s < 0 ! # raise "Error: invalid range : #{location}" ! $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG ! end ! when /^[<>]?(\d+)\^[<>]?(\d+)$/ # (C, I) n^m ! s = $1.to_i ! e = $2.to_i ! if e - s != 1 ! # raise "Error: invalid range : #{location}" ! $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG ! end ! when /^"?([ATGCatgc]+)"?$/ # (H) literal sequence ! sequence = $1.downcase ! s = e = nil ! when nil ! ; ! else ! raise "Error: unknown location format : #{location}" ! end ! ! @from = s # start position of the location ! @to = e # end position of the location ! @strand = 1 # strand direction of the location ! # forward => 1 or complement => -1 ! @sequence = sequence # literal sequence of the location ! @lt = lt # true if the position contains '<' ! @gt = gt # true if the position contains '>' ! @xref_id = xref_id # link to the external entry as GenBank ID ! end ! ! attr_accessor :from, :to, :strand, :sequence, :lt, :gt, :xref_id ! ! # Complements the sequence (i.e. alternates the strand). ! # --- ! # *Returns*:: the Bio::Location object ! def complement ! @strand *= -1 ! self # return Location object ! end ! ! # Replaces the sequence of the location. ! # --- ! # *Arguments*: ! # * (required) _sequence_: sequence to be used to replace the sequence at the location ! # *Returns*:: the Bio::Location object ! def replace(sequence) ! @sequence = sequence.downcase ! self # return Location object ! end ! ! # Returns the range (from..to) of the location as a Range object. ! def range ! @from.. at to ! end ! ! end # class location ! ! # = DESCRIPTION ! # The Bio::Locations class is a container for Bio::Location objects: creating a ! # Bio::Locations object (based on a GenBank style position string) will ! # spawn an array of Bio::Location objects. ! # ! # = USAGE ! # locations = Bio::Locations.new('join(complement(500..550), 600..625)') ! # locations.each do |location| ! # puts "class=" + location.class.to_s ! # puts "start=" + location.from.to_s + ";end=" + location.to.to_s \ ! # + ";strand=" + location.strand.to_s ! # end ! # # Output would be: ! # # class=Bio::Location ! # # start=500;end=550;strand=-1 ! # # class=Bio::Location ! # # start=600;end=625;strand=1 ! # ! # # For the following three location strings, print the span and range ! # ['one-of(898,900)..983', ! # 'one-of(5971..6308,5971..6309)', ! # '8050..one-of(10731,10758,10905,11242)'].each do |loc| ! # location = Bio::Locations.new(loc) ! # puts location.span ! # puts location.range ! # end ! # ! # = GENBANK LOCATION DESCRIPTOR CLASSIFICATION # # === Definition of the position notation of the GenBank location format # ! # According to the GenBank manual 'gbrel.txt', position notations were classified # into 10 patterns - (A) to (J). # *************** *** 84,115 **** # === Reduction strategy of the position notations # ! # (A) Location n ! # ! # (B) Location n..m ! # ! # (C) Location n^m ! # ! # (D) (n.m) => Location n ! # ! # (E) one-of(n,m,..) => Location n ! # one-of(n..m,..) => Location n..m ! # ! # (F) order(loc,loc,..) => join(loc, loc,..) ! # group(loc,loc,..) => join(loc, loc,..) ! # join(loc,loc,..) => Sequence ! # ! # (G) ID:loc => Location with ID ! # ! # (H) "atgc" => Location only with Sequence ! # ! # (I) Location n with lt flag ! # >n => Location n with gt flag ! # Location n..m with lt flag ! # n..>m => Location n..m with gt flag ! # m => Location n..m with lt, gt flag ! # ! # (J) complement(loc) => Sequence ! # ! # (K) replace(loc, str) => Location with replacement Sequence # # === GenBank location examples --- 235,259 ---- # === Reduction strategy of the position notations # ! # * (A) Location n ! # * (B) Location n..m ! # * (C) Location n^m ! # * (D) (n.m) => Location n ! # * (E) ! # * one-of(n,m,..) => Location n ! # * one-of(n..m,..) => Location n..m ! # * (F) ! # * order(loc,loc,..) => join(loc, loc,..) ! # * group(loc,loc,..) => join(loc, loc,..) ! # * join(loc,loc,..) => Sequence ! # * (G) ID:loc => Location with ID ! # * (H) "atgc" => Location only with Sequence ! # * (I) ! # * Location n with lt flag ! # * >n => Location n with gt flag ! # * Location n..m with lt flag ! # * n..>m => Location n..m with gt flag ! # * m => Location n..m with lt, gt flag ! # * (J) complement(loc) => Sequence ! # * (K) replace(loc, str) => Location with replacement Sequence # # === GenBank location examples *************** *** 232,340 **** # * [ADR40FIB] replace(510..520, <= replace(510..520, "taatcctaccg") # * [RATDYIIAAB] replace(1306..1443,"aagaacatccacggagtcagaactgggctcttcacgccggatttggcgttcgaggccattgtgaaaaagcaggcaatgcaccagcaagctcagttcctacccctgcgtggacctggttatccaggagctaatcagtacagttaggtggtcaagctgaaagagccctgtctgaaa") - # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ - # - - module Bio - - class Location - - # Pass a range of the 'location' segment. The 'location' segment can be - # 'ID:' + ('n' or 'n..m' or 'n^m' or "seq") with '<' or '>'. - def initialize(location = nil) - - if location - if location =~ /:/ # (G) ID:location - xref_id, location = location.split(':') - end - if location =~ / - lt = true - end - if location =~ />/ - gt = true - end - end - - # s : start base, e : end base => from, to - case location - when /^[<>]?(\d+)$/ # (A, I) n - s = e = $1.to_i - when /^[<>]?(\d+)\.\.[<>]?(\d+)$/ # (B, I) n..m - s = $1.to_i - e = $2.to_i - if e - s < 0 - # raise "Error: invalid range : #{location}" - $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG - end - when /^[<>]?(\d+)\^[<>]?(\d+)$/ # (C, I) n^m - s = $1.to_i - e = $2.to_i - if e - s != 1 - # raise "Error: invalid range : #{location}" - $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG - end - when /^"?([ATGCatgc]+)"?$/ # (H) literal sequence - sequence = $1.downcase - s = e = nil - when nil - ; - else - raise "Error: unknown location format : #{location}" - end - - @from = s # start position of the location - @to = e # end position of the location - @strand = 1 # strand direction of the location - # forward => 1 or complement => -1 - @sequence = sequence # literal sequence of the location - @lt = lt # true if the position contains '<' - @gt = gt # true if the position contains '>' - @xref_id = xref_id # link to the external entry as GenBank ID - end - - attr_accessor :from, :to, :strand, :sequence, :lt, :gt, :xref_id - - # Complement the sequence from outside. - def complement - @strand *= -1 - self # return Location object - end - - # Replace the sequence from outside. - def replace(sequence) - @sequence = sequence.downcase - self # return Location object - end - - # Returns a range (from..to) of the segment as a Range object. - def range - @from.. at to - end - - end # class location - - class Locations - include Enumerable ! # Parse a GenBank style position string and returns a Locations object, ! # which contains a list of Location objects. def initialize(position) if position.is_a? Array --- 376,390 ---- # * [ADR40FIB] replace(510..520, <= replace(510..520, "taatcctaccg") # * [RATDYIIAAB] replace(1306..1443,"aagaacatccacggagtcagaactgggctcttcacgccggatttggcgttcgaggccattgtgaaaaagcaggcaatgcaccagcaagctcagttcctacccctgcgtggacctggttatccaggagctaatcagtacagttaggtggtcaagctgaaagagccctgtctgaaa") class Locations include Enumerable ! # Parses a GenBank style position string and returns a Bio::Locations object, ! # which contains a list of Bio::Location objects. ! # locations = Bio::Locations.new('join(complement(500..550), 600..625)') ! # ! # --- ! # *Arguments*: ! # * (required) _str_: GenBank style position string ! # *Returns*:: Bio::Locations object def initialize(position) if position.is_a? Array *************** *** 342,351 **** else position = gbl_cleanup(position) # preprocessing ! @locations = gbl_pos2loc(position) # create an Array of Location end end attr_accessor :locations ! # Iterates on each Location object. def each @locations.each do |x| --- 392,403 ---- else position = gbl_cleanup(position) # preprocessing ! @locations = gbl_pos2loc(position) # create an Array of Bio::Location objects end end + + # An Array of Bio::Location objects attr_accessor :locations ! # Iterates on each Bio::Location object. def each @locations.each do |x| *************** *** 354,368 **** end ! # Returns nth Location object. def [](n) @locations[n] end ! # Returns first Location object. def first @locations.first end ! # Returns last Location object. def last @locations.last --- 406,420 ---- end ! # Returns nth Bio::Location object. def [](n) @locations[n] end ! # Returns first Bio::Location object. def first @locations.first end ! # Returns last Bio::Location object. def last @locations.last *************** *** 370,374 **** # Returns an Array containing overall min and max position [min, max] ! # of this Locations object. def span span_min = @locations.min { |a,b| a.from <=> b.from } --- 422,426 ---- # Returns an Array containing overall min and max position [min, max] ! # of this Bio::Locations object. def span span_min = @locations.min { |a,b| a.from <=> b.from } *************** *** 397,403 **** alias size length ! # Convert absolute position in DNA (na) to relative position in RNA (na). ! # If type == :aa, ! # convert absolute position in DNA (na) to relative position in Protein (aa). def relative(n, type = nil) case type --- 449,466 ---- alias size length ! # Converts absolute position in the whole of the DNA sequence to relative ! # position in the locus. ! # ! # This method can for example be used to relate positions in a DNA-sequence ! # with those in RNA. In this use, the optional ':aa'-flag returns the position ! # of the associated amino-acid rather than the nucleotide. ! # loc = Bio::Locations.new('complement(12838..13533)') ! # puts loc.relative(13524) # => 10 ! # puts loc.relative(13506, :aa) # => 3 ! # --- ! # *Arguments*: ! # * (required) _position_: nucleotide position within whole of the sequence ! # * _:aa_: flag that lets method return position in aminoacid coordinates ! # *Returns*:: position within the location def relative(n, type = nil) case type *************** *** 415,430 **** end ! # Convert relative position in RNA (na) to absolute position in DNA (na). ! # If type == :aa, ! # convert relative position in Protein (aa) -> absolute position in DNA (na). ! # ! # * Examples ! # ! # loc = Bio::Locations.new('complement(12838..13533)') ! # loc.absolute(10) #=> 13524 (rel2abs) ! # loc.relative(13524) #=> 10 (abs2rel) ! # loc.absolute(10, :aa) #=> 13506 (rel2abs) ! # loc.relative(13506, :aa) #=> 10 (abs2rel) ! # def absolute(n, type = nil) case type --- 478,495 ---- end ! # Converts relative position in the locus to position in the whole of the ! # DNA sequence. ! # ! # This method can for example be used to relate positions in a DNA-sequence ! # with those in RNA. In this use, the optional ':aa'-flag returns the position ! # of the associated amino-acid rather than the nucleotide. ! # loc = Bio::Locations.new('complement(12838..13533)') ! # puts loc.absolute(10) # => 13524 ! # puts loc.absolute(10, :aa) # => 13506 ! # --- ! # *Arguments*: ! # * (required) _position_: nucleotide position within locus ! # * _:aa_: flag to be used if _position_ is a aminoacid position rather than a nucleotide position ! # *Returns*:: position within the whole of the sequence def absolute(n, type = nil) case type *************** *** 591,594 **** --- 656,664 ---- puts "Test new & span methods" [ + '450', + '500..600', + 'join(500..550, 600..625)', + 'complement(join(500..550, 600..625))', + 'join(complement(500..550), 600..625)', '754^755', 'complement(53^54)', *************** *** 618,624 **** ].each do |pos| p pos ! p Bio::Locations.new(pos).span ! p Bio::Locations.new(pos).range ! p Bio::Locations.new(pos) end --- 688,699 ---- ].each do |pos| p pos ! # p Bio::Locations.new(pos) ! # p Bio::Locations.new(pos).span ! # p Bio::Locations.new(pos).range ! Bio::Locations.new(pos).each do |location| ! puts "class=" + location.class.to_s ! puts "start=" + location.from.to_s + "\tend=" + location.to.to_s + "\tstrand=" + location.strand.to_s ! end ! end From aerts at dev.open-bio.org Wed Apr 26 07:05:52 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Wed, 26 Apr 2006 11:05:52 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio feature.rb,1.10,1.11 Message-ID: <200604261105.k3QB5q61032048@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv32028 Modified Files: feature.rb Log Message: Added and reformatted documentation. Qualifiers are now automatically converted into Bio::Feature::Qualifier objects when initializing a new Bio::Feature object. Index: feature.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/feature.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** feature.rb 27 Feb 2006 09:13:46 -0000 1.10 --- feature.rb 26 Apr 2006 11:05:50 -0000 1.11 *************** *** 2,42 **** # = bio/feature.rb - Features/Feature class (GenBank Feature table) # ! # Copyright:: Copyright (c) 2002, 2005 ! # Toshiaki Katayama # License:: Ruby's # # $Id$ - # - # == INSD Feature table definition - # - # See http://www.ddbj.nig.ac.jp/FT/full_index.html for the INSD - # (GenBank/EMBL/DDBJ) Feature table definition. - # - # === Example - # - # # suppose features is a Bio::Features object - # features.each do |feature| - # f_name = feature.feature - # f_pos = feature.position - # puts "#{f_name}:\t#{f_pos}" - # feature.each do |qualifier| - # q_name = qualifier.qualifier - # q_val = qualifier.value - # puts "- #{q_name}:\t#{q_val}" - # end - # end - # - # # Iterates only on CDS features and extract translated amino acid sequences - # features.each("CDS") do |feature| - # hash = feature.assoc - # name = hash["gene"] || hash["product"] || hash["note"] - # seq = hash["translation"] - # pos = feature.position - # if gene and seq - # puts ">#{gene} #{feature.position}" - # puts aaseq - # end - # end - # require 'bio/location' --- 2,10 ---- # = bio/feature.rb - Features/Feature class (GenBank Feature table) # ! # Copyright:: Copyright (c) 2002, 2005 Toshiaki Katayama ! # 2006 Jan Aerts # License:: Ruby's # # $Id$ require 'bio/location' *************** *** 44,52 **** module Bio # Container for the sequence annotation. class Feature ! def initialize(feature = '', position = '', qualifiers = []) ! @feature, @position, @qualifiers = feature, position, qualifiers end --- 12,54 ---- module Bio + # = DESCRIPTION # Container for the sequence annotation. + # + # = USAGE + # # Create a Bio::Feature object. + # # For example: the GenBank-formatted entry in genbank for accession M33388 + # # contains the following feature: + # # exon 1532..1799 + # # /gene="CYP2D6" + # # /note="cytochrome P450 IID6; GOO-132-127" + # # /number="1" + # feature = Bio::Feature.new('exon','1532..1799',['gene' => 'CYP2D6','note' => 'cytochrome P450 IID6; GOO-132-127','number' => '1']) + # + # # Print the feature + # puts feature.feature + "\t" + feature.position + # feature.each do |qualifier| + # puts "- " + qualifier.qualifier + ": " + qualifier.value + # end + # + # = REFERENCES + # INSD feature table definition:: http://www.ddbj.nig.ac.jp/FT/full_index.html class Feature ! # Create a new Bio::Feature object. ! # *Arguments*: ! # * (required) _feature_: type of feature (e.g. "exon") ! # * (required) _position_: position of feature (e.g. "complement(1532..1799)") ! # * (optional) _qualifiers_: list of qualifiers (e.g. "['gene' => 'CYP2D6','number' => '1']") ! # *Returns*:: Bio::Feature object def initialize(feature = '', position = '', qualifiers = []) ! @feature, @position = feature, position ! @qualifiers = Array.new ! if qualifiers.length.modulo(2) > 0 ! $stderr.puts "WARNING" ! end ! while qualifiers.length > 0 ! key = qualifiers.shift ! value = qualifiers.shift || '' ! self.append(Qualifier.new(key, value)) ! end end *************** *** 66,73 **** # Appends a Qualifier object to the Feature. ! # ! # * Returns an Array of Qualifier objects. ! # * If the argument is not a Qualifier object, returns nil. ! # def append(a) @qualifiers.push(a) if a.is_a? Qualifier --- 68,75 ---- # Appends a Qualifier object to the Feature. ! # ! # *Arguments*: ! # * (required) _qualifier_: Bio::Feature::Qualifier object ! # *Returns*:: Bio::Feature object def append(a) @qualifiers.push(a) if a.is_a? Qualifier *************** *** 75,79 **** end ! # Iterates on each qualifier. def each(arg = nil) @qualifiers.each do |x| --- 77,84 ---- end ! # Iterates on each qualifier object. ! # ! # *Arguments*: ! # * (optional) _key_: if specified, only iterates over qualifiers with this key def each(arg = nil) @qualifiers.each do |x| *************** *** 108,114 **** end ! # Container for the qualifier-value pair. class Qualifier ! def initialize(key, value) @qualifier, @value = key, value --- 113,124 ---- end ! # Container for qualifier-value pairs for sequence features. class Qualifier ! # Creates a new Bio::Feature::Qualifier object ! # ! # *Arguments*: ! # * (required) _key_: key of the qualifier (e.g. "gene") ! # * (required) _value_: value of the qualifier (e.g. "CYP2D6") ! # *Returns*:: Bio::Feature::Qualifier object def initialize(key, value) @qualifier, @value = key, value *************** *** 126,132 **** ! # Container for the list of Feature objects. class Features ! def initialize(ary = []) @features = ary --- 136,177 ---- ! # = DESCRIPTION ! # Container for a list of Feature objects. ! # ! # = USAGE ! # # First, create some Bio::Feature objects ! # feature1 = Bio::Feature.new('intron','3627..4059',['gene', 'CYP2D6', 'note', 'G00-132-127','number','4']) ! # feature2 = Bio::Feature.new('exon','4060..4236',['gene', 'CYP2D6', 'note', 'G00-132-127','number','5']) ! # feature3 = Bio::Feature.new('intron','4237..4426',['gene', 'CYP2D6', 'note', 'G00-132-127','number','5']) ! # feature4 = Bio::Feature.new('CDS','join(2538..3626,4060..4236)',['gene', 'CYP2D6','translation','MGXXTVMHLL...']) ! # ! # # And create a container for them ! # feature_container = Bio::Features.new([ feature1, feature2, feature3, feature4 ]) ! # ! # # Iterate over all features and print ! # feature_container.each do |feature| ! # puts feature.feature + "\t" + feature.position ! # feature.each do |qualifier| ! # puts "- " + qualifier.qualifier + ": " + qualifier.value ! # end ! # end ! # ! # # Iterate only over CDS features and extract translated amino acid sequences ! # features.each("CDS") do |feature| ! # hash = feature.to_hash ! # name = hash["gene"] || hash["product"] || hash["note"] ! # aaseq = hash["translation"] ! # pos = feature.position ! # if name and seq ! # puts ">#{gene} #{feature.position}" ! # puts aaseq ! # end ! # end class Features ! # Create a new Bio::Features object. ! # ! # *Arguments*: ! # * (optional) _list of features_: list of Bio::Feature objects ! # *Returns*:: Bio::Features object def initialize(ary = []) @features = ary *************** *** 137,140 **** --- 182,189 ---- # Appends a Feature object to Features. + # + # *Arguments*: + # * (required) _feature_: Bio::Feature object + # *Returns*:: Bio::Features object def append(a) @features.push(a) if a.is_a? Feature *************** *** 142,147 **** end ! # Iterates on each feature. If a feature name is given as an argument, ! # only iterates on each feature belongs to the name (e.g. 'CDS' etc.) def each(arg = nil) @features.each do |x| --- 191,198 ---- end ! # Iterates on each feature object. ! # ! # *Arguments*: ! # * (optional) _key_: if specified, only iterates over features with this key def each(arg = nil) @features.each do |x| *************** *** 170,172 **** --- 221,257 ---- end # Bio + if __FILE__ == $0 + puts "---TESTING Bio::Feature" + feature1 = Bio::Feature.new('exon','1532..1799',['gene','CYP2D6','note','cytochrome P450 IID6; GOO-132-127','number','1', 'note', 'a second note']) + + # Print the feature out + puts feature1.feature + "\t" + feature1.position + feature1.each do |qualifier| + puts "- " + qualifier.qualifier + ": " + qualifier.value + end + + feature2 = Bio::Feature.new('CDS','join(2538..3626,4060..4236)',['gene', 'CYP2D6','translation','MGXXTVMHLL...']) + + puts "---TESTING Bio::Features" + feature3 = Bio::Feature.new('intron','3627..4059',['gene', 'CYP2D6', 'note', 'G00-132-127','number','4']) + feature4 = Bio::Feature.new('exon','4060..4236',['gene', 'CYP2D6', 'note', 'G00-132-127','number','5']) + feature5 = Bio::Feature.new('intron','4237..4426',['gene', 'CYP2D6', 'note', 'G00-132-127','number','5']) + feature_container = Bio::Features.new([ feature1, feature2, feature3, feature4, feature5 ]) + feature_container.each do |feature| + puts "-NEXT FEATURE" + puts feature.feature + "\t" + feature.position + feature.each do |qualifier| + puts "- " + qualifier.qualifier + ": " + qualifier.value + end + end + puts "---TESTING hash function" + feature_container.each('CDS') do |feature| + hash = feature.to_hash + name = hash["gene"] || hash["product"] || hash["note"] + aaseq = hash["translation"] + pos = feature.position + puts ">#{name} #{feature.position}" + puts aaseq + end + end From aerts at dev.open-bio.org Thu Apr 27 05:29:37 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 27 Apr 2006 09:29:37 +0000 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.66,1.67 Message-ID: <200604270929.k3R9Tbx2003641@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory dev.open-bio.org:/tmp/cvs-serv3621 Modified Files: bio.rb Log Message: Added bio/io/ensembl.rb to be autoloaded. Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** bio.rb 27 Feb 2006 09:11:01 -0000 1.66 --- bio.rb 27 Apr 2006 09:29:35 -0000 1.67 *************** *** 132,135 **** --- 132,137 ---- autoload :DBGET, 'bio/io/dbget' + autoload :Ensembl, 'bio/io/ensembl' + ## below are described in bio/appl/blast.rb #class Blast From nakao at dev.open-bio.org Fri Apr 14 00:49:46 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 04:49:46 -0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl embl.rb,1.26,1.27 Message-ID: <200604140549.k3E5nWFn009694@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv9674 Modified Files: embl.rb Log Message: * Removed example codes (if __FILE__ == $0 ... end). * Changed license (LGPL -> Ruby's). Index: embl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/embl.rb,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** embl.rb 28 Jan 2006 06:40:38 -0000 1.26 --- embl.rb 14 Apr 2006 05:49:30 -0000 1.27 *************** *** 3,8 **** # # ! # Copyright:: Copyright (C) 2001-2005 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 3,8 ---- # # ! # Copyright:: Copyright (C) 2001-2006 Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 29,50 **** # http://www.ebi.ac.uk/embl/Documentation/User_manual/usrman.html # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ - # require 'bio/db' --- 29,32 ---- *************** *** 395,454 **** end ! end ! ! end ! ! ! if __FILE__ == $0 ! while ent = $<.gets(Bio::EMBL::RS) ! puts "\n ==> e = Bio::EMBL.new(ent) " ! e = Bio::EMBL.new(ent) ! ! puts "\n ==> e.entry_id " ! p e.entry_id ! puts "\n ==> e.id_line " ! p e.id_line ! puts "\n ==> e.id_line('molecule') " ! p e.id_line('molecule') ! puts "\n ==> e.molecule " ! p e.molecule ! puts "\n ==> e.ac " ! p e.ac ! puts "\n ==> e.sv " ! p e.sv ! puts "\n ==> e.dt " ! p e.dt ! puts "\n ==> e.dt('created') " ! p e.dt('created') ! puts "\n ==> e.de " ! p e.de ! puts "\n ==> e.kw " ! p e.kw ! puts "\n ==> e.os " ! p e.os ! puts "\n ==> e.oc " ! p e.oc ! puts "\n ==> e.og " ! p e.og ! puts "\n ==> e.ref " ! p e.ref ! puts "\n ==> e.dr " ! p e.dr ! puts "\n ==> e.ft " ! p e.ft ! puts "\n ==> e.each_cds {|c| p c}" ! p e.each_cds {|c| p c } ! puts "\n ==> e.sq " ! p e.sq ! puts "\n ==> e.sq('a') " ! p e.sq('a') ! puts "\n ==> e.gc" ! p e.gc ! puts "\n ==> e.seq " ! p e.seq ! end ! ! end ! ! --- 377,381 ---- end ! end # class EMBL + end # module Bio From nakao at dev.open-bio.org Fri Apr 14 00:52:42 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 04:52:42 -0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl sptr.rb,1.30,1.31 Message-ID: <200604140552.k3E5qU1e009726@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv9706 Modified Files: sptr.rb Log Message: * Removed example codes (if __FILE__ == $0 ... end). * Changed license (LGPL -> Ruby's). Index: sptr.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/sptr.rb,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** sptr.rb 28 Jan 2006 06:40:38 -0000 1.30 --- sptr.rb 14 Apr 2006 05:52:28 -0000 1.31 *************** *** 2,7 **** # = bio/db/embl/sptr.rb - UniProt/SwissProt and TrEMBL database class # ! # Copyright:: Copyright (C) 2001-2005 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,7 ---- # = bio/db/embl/sptr.rb - UniProt/SwissProt and TrEMBL database class # ! # Copyright:: Copyright (C) 2001-2006 Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 32,53 **** # http://www.expasy.org/sprot/userman.html # ! #-- ! # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! # ! #++ ! # require 'bio/db' --- 32,36 ---- # http://www.expasy.org/sprot/userman.html # ! require 'bio/db' *************** *** 760,841 **** - if __FILE__ == $0 - # Usage: ruby __FILE__ uniprot_sprot.dat - # Usage: ruby __FILE__ uniprot_sprot.dat | egrep '^RuntimeError' - - begin - require 'pp' - alias pp p - rescue LoadError - end - - def cmd(cmd, tag = nil, ent = $ent) - puts " ==> #{cmd} " - puts Bio::SPTR.new(ent).get(tag) if tag - begin - p eval(cmd) - rescue RuntimeError - puts "RuntimeError(#{Bio::SPTR.new($ent).entry_id})}: #{$!} " - end - puts - end - - - while $ent = $<.gets(Bio::SPTR::RS) - - cmd "Bio::SPTR.new($ent).entry_id" - - cmd "Bio::SPTR.new($ent).id_line", 'ID' - cmd "Bio::SPTR.new($ent).entry" - cmd "Bio::SPTR.new($ent).entry_name" - cmd "Bio::SPTR.new($ent).molecule" - cmd "Bio::SPTR.new($ent).sequence_length" - - cmd "Bio::SPTR.new($ent).ac", 'AC' - cmd "Bio::SPTR.new($ent).accession" - - - cmd "Bio::SPTR.new($ent).gn", 'GN' - cmd "Bio::SPTR.new($ent).gene_name" - cmd "Bio::SPTR.new($ent).gene_names" - - cmd "Bio::SPTR.new($ent).dt", "DT" - ['created','annotation','sequence'].each do |key| - cmd "Bio::SPTR.new($ent).dt('#{key}')" - end - - cmd "Bio::SPTR.new($ent).de", 'DE' - cmd "Bio::SPTR.new($ent).definition" - cmd "Bio::SPTR.new($ent).protein_name" - cmd "Bio::SPTR.new($ent).synonyms" - - cmd "Bio::SPTR.new($ent).kw", 'KW' - - cmd "Bio::SPTR.new($ent).os", 'OS' - - cmd "Bio::SPTR.new($ent).oc", 'OC' - - cmd "Bio::SPTR.new($ent).og", 'OG' - - cmd "Bio::SPTR.new($ent).ox", 'OX' - - cmd "Bio::SPTR.new($ent).ref", 'R' - - cmd "Bio::SPTR.new($ent).cc", 'CC' - cmd "Bio::SPTR.new($ent).cc('ALTERNATIVE PRODUCTS')" - cmd "Bio::SPTR.new($ent).cc('DATABASE')" - cmd "Bio::SPTR.new($ent).cc('MASS SPECTOMETRY')" - - cmd "Bio::SPTR.new($ent).dr", 'DR' - - cmd "Bio::SPTR.new($ent).ft", 'FT' - cmd "Bio::SPTR.new($ent).ft['DOMAIN']" - - cmd "Bio::SPTR.new($ent).sq", "SQ" - cmd "Bio::SPTR.new($ent).seq" - end - - end - =begin --- 743,746 ---- From nakao at dev.open-bio.org Fri Apr 14 01:04:22 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 05:04:22 -0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl common.rb,1.9,1.10 Message-ID: <200604140604.k3E64BXK009760@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv9740 Modified Files: common.rb Log Message: * Changed license (LGPL -> Ruby's). Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/common.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** common.rb 28 Jan 2006 06:40:38 -0000 1.9 --- common.rb 14 Apr 2006 06:04:09 -0000 1.10 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2001-2005 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2001-2005 Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 70,91 **** # http://www.expasy.org/sprot/userman.html # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ - # require 'bio/db' --- 70,73 ---- From nakao at dev.open-bio.org Fri Apr 14 01:28:29 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 05:28:29 -0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io ensembl.rb,NONE,1.1 Message-ID: <200604140628.k3E6SBGn009942@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv9920/d/d/d Added Files: ensembl.rb Log Message: * ensembl.rb) newly added. * test_ensembl.rb) newly added. --- NEW FILE: ensembl.rb --- # # = bio/io/ensembl.rb - An Ensembl Genome Browser client. # # Copyright:: Copyright (C) 2006 # Mitsuteru C. Nakao # License:: Ruby's # # $Id: ensembl.rb,v 1.1 2006/04/14 06:28:09 nakao Exp $ # # == Description # # Client classes for Ensembl Genome Browser. # # == Examples # # seq = Bio::Ensembl::Human.exportview(1, 1000, 100000) # gff = Bio::Ensembl::Human.exportview(1, 1000, 100000, ['gene']) # # seq = Bio::Ensembl::Mouse.exportview(1, 1000, 100000) # gff = Bio::Ensembl::Mouse.exportview(1, 1000, 100000, ['gene', 'variation', 'genscan']) # # # == References # # * Ensembl # http:/www.ensembl.org/ # require 'bio' require 'cgi' module Bio # == Description # # An Ensembl Genome Browser client class. # # == Examples # # seq = Bio::Ensembl::Human.exportview(1, 1000, 100000) # gff = Bio::Ensembl::Human.exportview(1, 1000, 100000, ['gene']) # # seq = Bio::Ensembl::Mouse.exportview(1, 1000, 100000) # gff = Bio::Ensembl::Mouse.exportview(1, 1000, 100000, ['gene', 'variation', 'genscan']) # # == References # # * Ensembl # http:/www.ensembl.org/ # class Ensembl # Hostname of Ensembl Genome Browser. ServerName = 'www.ensembl.org' # Ensembl Genome Browser Client Super Class # # == Examples # # module Bio # class Ensembl::Kumamushi < Base # Organism = 'Milnesium_tardigradum' # end # end # fna = Bio::Ensembl::Kumamushi.exportview(1, 1000, 20000) # class Base # Ensembl ExportView Client. # # Retrieve genomic sequence/features from Ensembl ExportView in plain text. # Ensembl ExportView exports genomic data (sequence and features) in # several file formats including fasta, GFF and tab. # # * ExportViwe (http://www.ensembl.org/Homo_sapiens/exportview). # # == Examples # # # Genomic sequence in Fasta format # Bio::Ensembl::Human.exportview(:seq_region_name => 1, :anchor1 => 1149206, :anchor2 => 1149229) # Bio::Ensembl::Human.exportview(1, 1149206, 1149229) # # # Feature in GFF # Bio::Ensembl::Human.exportview(:seq_region_name => 1, :anchor1 => 1149206, :anchor2 => 1150000, # :options => ['similarity', 'repeat', 'genscan', 'variation', 'gene']) # Bio::Ensembl::Human.exportview(1, 1149206, 1150000, ['variation', 'gene']) # # == Arguments # # Bio::Ensembl::Base#exportview method allow both orderd arguments and # named arguments. # Note: mandatory arguments marked '*'. # # === Orderd Arguments # # 1. seq_region_name - Chromosome number (*) # 2. anchor1 - From coordination (*) # 3. anchor2 - To coordination (*) # 4. options - Features to export (in :format => 'gff' or 'tab') # ['similarity', 'repeat', 'genscan', 'variation', 'gene'] # # === Named Arguments # # * :seq_region_name - Chromosome number (*) # * :anchor1 - From coordination (*) # * :anchor2 - To coordination (*) # * :type1 - From coordination type ['bp', ] # * :type2 - To coordination type ['bp', ] # * :upstream - Bp upstream # * :downstream - Bp downstream # * :format - File format ['fasta', 'gff', 'tab'] # * :options - Features to export (for :format => 'gff' or 'tab') # ['similarity', 'repeat', 'genscan', 'variation', 'gene'] # def self.exportview(*args) cgi = Client.new('exportview', self::Organism) if args.first.class == Hash then opts = args.first else opts = {:seq_region_name => args[0], :anchor1 => args[1], :anchor2 => args[2]} case args.size when 3 then opts.update({:format => 'fasta'}) when 4 then opts.update({:format => 'gff', :options => args[3]}) ; end end @hash = {:type1 => 'bp', :type2 => 'bp', :downstream => '', :upstream => '', :format => 'fasta', :options => [], :action => 'export', :_format => 'Text', :output => 'txt', :submit => 'Continue >>'} cgi.exec(@hash.update(opts)) end # An Ensembl CGI client class # # === Examples # # cgi = Client('martview', 'Homo_sapiens') # cgi.exec(hash_data) # class Client < PSORT::CGIDriver def initialize(cgi_name, genome_name) super(Ensembl::ServerName, ['', genome_name, cgi_name].join('/')) end private def make_args(query) @args = {} query.each { |k, v| @args[k.to_s] = v } nested_args_join(query) end def nested_args_join(hash) tmp = [] hash.each do |key, value| if value.class == Array then value.each { |val| tmp << [key, val] } else tmp << [key, value] end end tmp.map {|x| x.map {|x| CGI.escape(x.to_s) }.join("=") }.join('&') end def parse_report(result_body) result_body end end # class Client end # class Base # Ensembl Human Genome # # See Bio::Ensembl::Base class. # class Human < Base Organism = 'Homo_sapiens' end # class Human # Ensembl Mouse Genome # # See Bio::Ensembl::Base class. # class Mouse < Base Organism = 'Mus_musculus' end # class Mouse end # class Ensembl end # module Bio From nakao at dev.open-bio.org Fri Apr 14 01:28:42 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 05:28:42 -0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/io test_ensembl.rb,NONE,1.1 Message-ID: <200604140628.k3E6SBo7009947@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/io In directory dev.open-bio.org:/tmp/cvs-serv9920/test/unit/bio/io Added Files: test_ensembl.rb Log Message: * ensembl.rb) newly added. * test_ensembl.rb) newly added. --- NEW FILE: test_ensembl.rb --- # # = test/unit/bio/io/test_ensembl.rb - Unit test for Bio::Ensembl. # # Copyright:: Copyright (C) 2006 # Mitsuteru C. Nakao # License:: Ruby's # # $Id: test_ensembl.rb,v 1.1 2006/04/14 06:28:09 nakao Exp $ # require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/io/ensembl' class TestEnsembl < Test::Unit::TestCase def test_server_name assert_equal('www.ensembl.org', Bio::Ensembl::ServerName) end end class TestEnsemblBase < Test::Unit::TestCase def test_exportview end end class TestEnsemblBaseClient < Test::Unit::TestCase def test_class assert_equal(Bio::PSORT::CGIDriver, Bio::Ensembl::Base::Client.superclass) end end class TestEnsemblHuman < Test::Unit::TestCase def test_organism assert_equal("Homo_sapiens", Bio::Ensembl::Human::Organism) end end class TestEnsemblMouse < Test::Unit::TestCase def test_organism assert_equal("Mus_musculus", Bio::Ensembl::Mouse::Organism) end end From nakao at dev.open-bio.org Fri Apr 14 01:33:32 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 05:33:32 -0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.50,1.51 Message-ID: <200604140633.k3E6XL90010004@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv9984 Modified Files: ChangeLog Log Message: * Bio::Ensembl first commit. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** ChangeLog 27 Feb 2006 11:38:14 -0000 1.50 --- ChangeLog 14 Apr 2006 06:33:19 -0000 1.51 *************** *** 1,2 **** --- 1,10 ---- + 2006-04-14 Mitsuteru Nakao + + * lib/bio/io/ensembl.rb + + Bio::Ensembl first commit. It is a client class for Ensembl Genome + Browser. + + 2006-02-27 Toshiaki Katayama From ngoto at dev.open-bio.org Wed Apr 26 08:04:15 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 26 Apr 2006 12:04:15 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.5,1.6 Message-ID: <200604261204.k3QC4FZN032162@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv32140/lib/bio Modified Files: command.rb Log Message: Experimentally added Bio::Command::NetTools.net_http_start() method. Note that it would be removed or the method name would be changed. Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** command.rb 28 Mar 2006 14:00:48 -0000 1.5 --- command.rb 26 Apr 2006 12:04:13 -0000 1.6 *************** *** 13,16 **** --- 13,17 ---- require 'uri' require 'open-uri' + require 'net/http' module Bio *************** *** 162,165 **** --- 163,190 ---- OpenURI.open_uri(uri).read end + + # Same as: + # uri = URI.parse(uri); Net::HTTP.start(uri.host, uri.port) + # and + # it uses proxy if an environment variable (same as OpenURI.open_uri) + # is set. + # uri must be a string or a URI object. + def self.net_http_start(uri, &block) + unless uri.kind_of?(URI::Generic) + uri = URI.parse(uri) + end + if uri.scheme != 'http' then + raise "only http is supported: #{uri.inspect}" + end + # Note: URI#find_proxy is an unofficial method defined in open-uri.rb. + # If the spec of open-uri.rb would be changed, we should change below. + if proxyuri = uri.find_proxy then + raise 'Non-HTTP proxy' if proxyuri.class != URI::HTTP + http = Net::HTTP.Proxy(proxyuri.host, proxyuri.port) + else + http = Net::HTTP + end + http.start(uri.host, uri.port, &block) + end end #module NetTools From ngoto at dev.open-bio.org Wed Apr 26 22:33:45 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Thu, 27 Apr 2006 02:33:45 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.6,1.7 Message-ID: <200604270233.k3R2XjuZ002237@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv2217/lib/bio Modified Files: command.rb Log Message: changed spec of Bio::Command::NetTools.net_http_start() Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** command.rb 26 Apr 2006 12:04:13 -0000 1.6 --- command.rb 27 Apr 2006 02:33:43 -0000 1.7 *************** *** 165,180 **** # Same as: ! # uri = URI.parse(uri); Net::HTTP.start(uri.host, uri.port) # and # it uses proxy if an environment variable (same as OpenURI.open_uri) # is set. ! # uri must be a string or a URI object. ! def self.net_http_start(uri, &block) ! unless uri.kind_of?(URI::Generic) ! uri = URI.parse(uri) ! end ! if uri.scheme != 'http' then ! raise "only http is supported: #{uri.inspect}" ! end # Note: URI#find_proxy is an unofficial method defined in open-uri.rb. # If the spec of open-uri.rb would be changed, we should change below. --- 165,175 ---- # Same as: ! # Net::HTTP.start(address, port) # and # it uses proxy if an environment variable (same as OpenURI.open_uri) # is set. ! # ! def self.net_http_start(address, port = 80, &block) ! uri = URI.parse("http://#{address}:#{port}") # Note: URI#find_proxy is an unofficial method defined in open-uri.rb. # If the spec of open-uri.rb would be changed, we should change below. *************** *** 185,189 **** http = Net::HTTP end ! http.start(uri.host, uri.port, &block) end end #module NetTools --- 180,184 ---- http = Net::HTTP end ! http.start(address, port, &block) end end #module NetTools From ngoto at dev.open-bio.org Wed Apr 26 23:15:29 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Thu, 27 Apr 2006 03:15:29 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.7,1.8 Message-ID: <200604270315.k3R3FTmK002447@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv2392/lib/bio Modified Files: command.rb Log Message: Bio::Command::NetTools can be included in classes. Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** command.rb 27 Apr 2006 02:33:43 -0000 1.7 --- command.rb 27 Apr 2006 03:15:27 -0000 1.8 *************** *** 160,166 **** # Same as OpenURI.open_uri(uri).read. ! def self.read_uri(uri) OpenURI.open_uri(uri).read end # Same as: --- 160,167 ---- # Same as OpenURI.open_uri(uri).read. ! def read_uri(uri) OpenURI.open_uri(uri).read end + module_function :read_uri # Same as: *************** *** 170,174 **** # is set. # ! def self.net_http_start(address, port = 80, &block) uri = URI.parse("http://#{address}:#{port}") # Note: URI#find_proxy is an unofficial method defined in open-uri.rb. --- 171,175 ---- # is set. # ! def net_http_start(address, port = 80, &block) uri = URI.parse("http://#{address}:#{port}") # Note: URI#find_proxy is an unofficial method defined in open-uri.rb. *************** *** 182,185 **** --- 183,188 ---- http.start(address, port, &block) end + module_function :net_http_start + end #module NetTools From nakao at dev.open-bio.org Thu Apr 27 01:38:52 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Thu, 27 Apr 2006 05:38:52 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/io test_ensembl.rb,1.1,1.2 Message-ID: <200604270538.k3R5cqVL002709@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/io In directory dev.open-bio.org:/tmp/cvs-serv2667/test/unit/bio/io Modified Files: test_ensembl.rb Log Message: * ensembl.rb: Use Bio::Command::NetTools.net_http_start for proxy server. * ensembl.rb: Added Ensembl.server_uri method. Index: test_ensembl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/io/test_ensembl.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_ensembl.rb 14 Apr 2006 06:28:09 -0000 1.1 --- test_ensembl.rb 27 Apr 2006 05:38:50 -0000 1.2 *************** *** 19,25 **** class TestEnsembl < Test::Unit::TestCase def test_server_name ! assert_equal('www.ensembl.org', Bio::Ensembl::ServerName) end end --- 19,34 ---- class TestEnsembl < Test::Unit::TestCase def test_server_name ! assert_equal('http://www.ensembl.org', Bio::Ensembl::EBIServerURI) end + def test_server_uri + assert_equal('http://www.ensembl.org', Bio::Ensembl.server_uri) + end + + def test_set_server_uri + host = 'http://localhost' + Bio::Ensembl.server_uri(host) + assert_equal(host, Bio::Ensembl.server_uri) + end end *************** *** 32,36 **** class TestEnsemblBaseClient < Test::Unit::TestCase def test_class ! assert_equal(Bio::PSORT::CGIDriver, Bio::Ensembl::Base::Client.superclass) end end --- 41,45 ---- class TestEnsemblBaseClient < Test::Unit::TestCase def test_class ! end end From nakao at dev.open-bio.org Thu Apr 27 01:38:52 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Thu, 27 Apr 2006 05:38:52 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io ensembl.rb,1.1,1.2 Message-ID: <200604270538.k3R5cqbu002714@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv2667/lib/bio/io Modified Files: ensembl.rb Log Message: * ensembl.rb: Use Bio::Command::NetTools.net_http_start for proxy server. * ensembl.rb: Added Ensembl.server_uri method. Index: ensembl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/ensembl.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ensembl.rb 14 Apr 2006 06:28:09 -0000 1.1 --- ensembl.rb 27 Apr 2006 05:38:50 -0000 1.2 *************** *** 27,31 **** # ! require 'bio' require 'cgi' --- 27,32 ---- # ! require 'bio/command' ! require 'uri' require 'cgi' *************** *** 44,47 **** --- 45,54 ---- # gff = Bio::Ensembl::Mouse.exportview(1, 1000, 100000, ['gene', 'variation', 'genscan']) # + # Bio::Enesmbl.server_uri("http://www.gramene.org") + # class Rice < Base + # Organism = 'Oryza_sativa' + # end + # seq = Bio::Ensembl::Rice.exportview(1, 1000, 100000) + # # == References # *************** *** 49,56 **** # http:/www.ensembl.org/ # class Ensembl ! # Hostname of Ensembl Genome Browser. ! ServerName = 'www.ensembl.org' --- 56,86 ---- # http:/www.ensembl.org/ # + # * GRAMENE + # http://www.gramene.org/ + # class Ensembl ! # Hostname of the Ensembl Genome Browser. ! EBIServerURI = 'http://www.ensembl.org' ! ! # An Alternative Hostname for Ensembl Genome Browser. ! @@server_uri = nil ! ! # Sets and uses an alternative hostname for ensembl genome browser. ! # ! # == Example ! # ! # require 'bio' ! # p Bio::Enesmbl.server_uri #=> 'http://www.ensembl.org' ! # Bio::Enesmbl.server_uri("http://www.gramene.org") ! # p Bio::Enesmbl.server_uri #=> "http://www.gramene.org" ! # ! def self.server_uri(uri = nil) ! if uri ! @@server_uri = uri ! else ! @@server_uri || EBIServerURI ! end ! end *************** *** 79,89 **** # # # Genomic sequence in Fasta format ! # Bio::Ensembl::Human.exportview(:seq_region_name => 1, :anchor1 => 1149206, :anchor2 => 1149229) # Bio::Ensembl::Human.exportview(1, 1149206, 1149229) # # # Feature in GFF ! # Bio::Ensembl::Human.exportview(:seq_region_name => 1, :anchor1 => 1149206, :anchor2 => 1150000, ! # :options => ['similarity', 'repeat', 'genscan', 'variation', 'gene']) ! # Bio::Ensembl::Human.exportview(1, 1149206, 1150000, ['variation', 'gene']) # # == Arguments --- 109,124 ---- # # # Genomic sequence in Fasta format ! # Bio::Ensembl::Human.exportview(:seq_region_name => 1, ! # :anchor1 => 1149206, :anchor2 => 1149229) # Bio::Ensembl::Human.exportview(1, 1149206, 1149229) # # # Feature in GFF ! # Bio::Ensembl::Human.exportview(:seq_region_name => 1, ! # :anchor1 => 1149206, :anchor2 => 1150000, ! # :options => ['similarity', 'repeat', ! # 'genscan', 'variation', ! # 'gene']) ! # Bio::Ensembl::Human.exportview(1, 1149206, 1150000, ! # ['variation', 'gene']) # # == Arguments *************** *** 99,103 **** # 3. anchor2 - To coordination (*) # 4. options - Features to export (in :format => 'gff' or 'tab') ! # ['similarity', 'repeat', 'genscan', 'variation', 'gene'] # # === Named Arguments --- 134,139 ---- # 3. anchor2 - To coordination (*) # 4. options - Features to export (in :format => 'gff' or 'tab') ! # ['similarity', 'repeat', 'genscan', 'variation', ! # 'gene'] # # === Named Arguments *************** *** 112,128 **** # * :format - File format ['fasta', 'gff', 'tab'] # * :options - Features to export (for :format => 'gff' or 'tab') ! # ['similarity', 'repeat', 'genscan', 'variation', 'gene'] # def self.exportview(*args) - cgi = Client.new('exportview', self::Organism) - if args.first.class == Hash then opts = args.first else ! opts = {:seq_region_name => args[0], :anchor1 => args[1], :anchor2 => args[2]} case args.size ! when 3 then opts.update({:format => 'fasta'}) ! when 4 then opts.update({:format => 'gff', :options => args[3]}) ; end end ! @hash = {:type1 => 'bp', :type2 => 'bp', :downstream => '', --- 148,169 ---- # * :format - File format ['fasta', 'gff', 'tab'] # * :options - Features to export (for :format => 'gff' or 'tab') ! # ['similarity', 'repeat', 'genscan', 'variation', ! # 'gene'] # def self.exportview(*args) if args.first.class == Hash then opts = args.first else ! options = {:seq_region_name => args[0], ! :anchor1 => args[1], ! :anchor2 => args[2]} case args.size ! when 3 then ! options.update({:format => 'fasta'}) ! when 4 then ! options.update({:format => 'gff', :options => args[3]}) ! end end ! ! @data = {:type1 => 'bp', :type2 => 'bp', :downstream => '', *************** *** 130,169 **** :format => 'fasta', :options => [], ! :action => 'export', :_format => 'Text', :output => 'txt', :submit => 'Continue >>'} ! cgi.exec(@hash.update(opts)) end # An Ensembl CGI client class # # === Examples # ! # cgi = Client('martview', 'Homo_sapiens') ! # cgi.exec(hash_data) # ! class Client < PSORT::CGIDriver def initialize(cgi_name, genome_name) ! super(Ensembl::ServerName, ['', genome_name, cgi_name].join('/')) end ! private ! def make_args(query) ! @args = {} ! query.each { |k, v| @args[k.to_s] = v } ! nested_args_join(query) end ! def nested_args_join(hash) tmp = [] hash.each do |key, value| ! if value.class == Array then value.each { |val| tmp << [key, val] } else tmp << [key, value] end end ! tmp.map {|x| x.map {|x| CGI.escape(x.to_s) }.join("=") }.join('&') end - def parse_report(result_body) - result_body - end end # class Client --- 171,238 ---- :format => 'fasta', :options => [], ! :action => 'export', ! :_format => 'Text', ! :output => 'txt', ! :submit => 'Continue >>'} ! cgi = Client.new('exportview', self::Organism) ! cgi.exec(@data.update(options)) end + + # An Ensembl CGI client class + # + # Enable the use of HTTP access via a proxy by setting the proxy address up + # as the 'http_proxy' enviroment variable. # # === Examples # ! # cgi = Client.new('martview', 'Homo_sapiens') ! # result_body = cgi.exec(hash_data) # ! class Client ! ! # Sets cgi_name and genome_name. ! # ! # === Example ! # ! # cgi = Client.new('martview', 'Homo_sapiens') ! # def initialize(cgi_name, genome_name) ! @uri = URI.parse(Ensembl.server_uri) ! @path = ['', genome_name, cgi_name].join('/') end ! # Executes query with data. ! # ! # === Example ! # ! # result_body = cgi.exec(hash_data) ! # ! def exec(data_hash) ! data = make_args(data_hash) ! result = nil ! Bio::Command::NetTools.net_http_start(@uri.host, @uri.port) {|http| ! result, = http.post(@path, data) ! } ! result.body end ! private ! ! def make_args(hash) tmp = [] hash.each do |key, value| ! if value.class == Array then ! value.each { |val| tmp << [key, val] } ! else ! tmp << [key, value] ! end end ! tmp.map {|e| e.map {|x| CGI.escape(x.to_s) }.join("=") }.join('&') end end # class Client From ngoto at dev.open-bio.org Sun Apr 30 01:40:25 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:40:25 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/bl2seq report.rb,1.6,1.7 Message-ID: <200604300540.k3U5ePMf018074@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq In directory dev.open-bio.org:/tmp/cvs-serv18054 Modified Files: report.rb Log Message: changes license to Ruby's. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq/report.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** report.rb 18 Dec 2005 15:58:39 -0000 1.6 --- report.rb 30 Apr 2006 05:40:23 -0000 1.7 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2005 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2005 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 01:47:27 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:47:27 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast wublast.rb,1.6,1.7 Message-ID: <200604300547.k3U5lRRv018148@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv18107/blast Modified Files: wublast.rb Log Message: parse error (missing hits) for some hits of which database sequence names contain 'Score'. Index: wublast.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/wublast.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wublast.rb 22 Feb 2006 08:46:15 -0000 1.6 --- wublast.rb 30 Apr 2006 05:47:25 -0000 1.7 *************** *** 281,285 **** r = data.first end ! if /^\s+Score/ =~ r then @hsps << HSP.new(data) else --- 281,285 ---- r = data.first end ! if /\A\s+Score/ =~ r then @hsps << HSP.new(data) else From ngoto at dev.open-bio.org Sun Apr 30 01:48:01 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:48:01 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format0.rb,1.17,1.18 Message-ID: <200604300548.k3U5m18v018180@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv18160/blast Modified Files: format0.rb Log Message: parse error (missing hits) for some hits of which database sequence names contain 'Score'. Index: format0.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format0.rb,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** format0.rb 22 Feb 2006 08:46:15 -0000 1.17 --- format0.rb 30 Apr 2006 05:47:59 -0000 1.18 *************** *** 781,785 **** @f0hitname = data.shift @hsps = [] ! while r = data[0] and /^\s+Score/ =~ r @hsps << HSP.new(data) end --- 781,785 ---- @f0hitname = data.shift @hsps = [] ! while r = data[0] and /\A\s+Score/ =~ r @hsps << HSP.new(data) end From ngoto at dev.open-bio.org Sun Apr 30 01:50:21 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:50:21 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl clustalw.rb, 1.10, 1.11 mafft.rb, 1.9, 1.10 sim4.rb, 1.5, 1.6 Message-ID: <200604300550.k3U5oLwo018302@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv18276 Modified Files: clustalw.rb mafft.rb sim4.rb Log Message: changed license to Ruby's Index: sim4.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sim4.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sim4.rb 18 Dec 2005 15:58:40 -0000 1.5 --- sim4.rb 30 Apr 2006 05:50:19 -0000 1.6 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: Ruby's # # $Id$ Index: clustalw.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/clustalw.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** clustalw.rb 18 Dec 2005 15:58:40 -0000 1.10 --- clustalw.rb 30 Apr 2006 05:50:19 -0000 1.11 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: Ruby's # # $Id$ Index: mafft.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/mafft.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mafft.rb 18 Dec 2005 15:58:40 -0000 1.9 --- mafft.rb 30 Apr 2006 05:50:19 -0000 1.10 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 01:50:21 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:50:21 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/clustalw report.rb,1.9,1.10 Message-ID: <200604300550.k3U5oLJO018309@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/clustalw In directory dev.open-bio.org:/tmp/cvs-serv18276/clustalw Modified Files: report.rb Log Message: changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/clustalw/report.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** report.rb 18 Dec 2005 15:58:40 -0000 1.9 --- report.rb 30 Apr 2006 05:50:19 -0000 1.10 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 01:50:21 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:50:21 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/mafft report.rb,1.8,1.9 Message-ID: <200604300550.k3U5oLpH018314@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/mafft In directory dev.open-bio.org:/tmp/cvs-serv18276/mafft Modified Files: report.rb Log Message: changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/mafft/report.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** report.rb 18 Dec 2005 15:58:40 -0000 1.8 --- report.rb 30 Apr 2006 05:50:19 -0000 1.9 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 01:50:21 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:50:21 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/sim4 report.rb,1.7,1.8 Message-ID: <200604300550.k3U5oLFj018319@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/sim4 In directory dev.open-bio.org:/tmp/cvs-serv18276/sim4 Modified Files: report.rb Log Message: changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sim4/report.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** report.rb 18 Dec 2005 15:58:40 -0000 1.7 --- report.rb 30 Apr 2006 05:50:19 -0000 1.8 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 01:56:42 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:56:42 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio alignment.rb,1.15,1.16 Message-ID: <200604300556.k3U5ugBr018426@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv18406 Modified Files: alignment.rb Log Message: changed license to Ruby's Index: alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/alignment.rb,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** alignment.rb 24 Jan 2006 14:16:59 -0000 1.15 --- alignment.rb 30 Apr 2006 05:56:40 -0000 1.16 *************** *** 5,28 **** # GOTO Naohisa # ! # License:: LGPL # # $Id$ # - #-- - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - #++ - # # = About Bio::Alignment # --- 5,12 ---- # GOTO Naohisa # ! # License:: Ruby's # # $Id$ # # = About Bio::Alignment # From ngoto at dev.open-bio.org Sun Apr 30 01:57:42 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:57:42 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db fantom.rb,1.11,1.12 Message-ID: <200604300557.k3U5vgsw018500@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv18480/db Modified Files: fantom.rb Log Message: changed license to Ruby's Index: fantom.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/fantom.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** fantom.rb 26 Sep 2005 13:00:06 -0000 1.11 --- fantom.rb 30 Apr 2006 05:57:40 -0000 1.12 *************** *** 2,20 **** # bio/db/fantom.rb - RIKEN FANTOM2 database classes # ! # Copyright (C) 2003 GOTO Naohisa ! # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id$ --- 2,7 ---- # bio/db/fantom.rb - RIKEN FANTOM2 database classes # ! # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 01:58:52 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:58:52 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io/flatfile bdb.rb,1.8,1.9 Message-ID: <200604300558.k3U5wqaF018532@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io/flatfile In directory dev.open-bio.org:/tmp/cvs-serv18512/io/flatfile Modified Files: bdb.rb Log Message: changed license to Ruby's Index: bdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile/bdb.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bdb.rb 26 Sep 2005 13:00:08 -0000 1.8 --- bdb.rb 30 Apr 2006 05:58:50 -0000 1.9 *************** *** 2,20 **** # bio/io/flatfile/bdb.rb - OBDA flatfile index by Berkley DB # ! # Copyright (C) 2002 GOTO Naohisa ! # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id$ --- 2,7 ---- # bio/io/flatfile/bdb.rb - OBDA flatfile index by Berkley DB # ! # Copyright:: Copyright (C) 2002 GOTO Naohisa ! # License:: Ruby's # # $Id$ From nakao at dev.open-bio.org Sun Apr 30 03:11:30 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:30 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast xmlparser.rb,1.13,1.14 Message-ID: <200604300711.k3U7BUm3018668@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/appl/blast Modified Files: xmlparser.rb Log Message: * changed license to Ruby's Index: xmlparser.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/xmlparser.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** xmlparser.rb 8 Sep 2005 01:22:08 -0000 1.13 --- xmlparser.rb 30 Apr 2006 07:11:28 -0000 1.14 *************** *** 1,23 **** # ! # bio/appl/blast/xmlparser.rb - BLAST XML output (-m 7) parser by XMLParser # ! # Copyright (C) 2001 Mitsuteru C. Nakao ! # Copyright (C) 2003 KATAYAMA Toshiaki # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 1,31 ---- # ! # = bio/appl/blast/xmlparser.rb - BLAST XML output (-m 7) parser by XMLParser # ! # Copyright:: Copyright (C) 2001 ! # Mitsuteru C. Nakao ! # Copyright:: Copyright (C) 2003 ! # KATAYAMA Toshiaki ! # Lisence:: Ruby's # ! # $Id$ # ! # == Description ! # ! # A parser for blast XML report (format 7) based on the XMLParser. ! # This file is automatically loaded by bio/appl/blast/report.rb if ! # the XMLParser installed. # ! # BioRuby provides two implements of the paser for the blast XML format report ! # (format 7) based on the XMLParser and the REXML. # ! # == Examples ! # ! # == References ! # ! # * Blast ! # http:// ! # ! # * XMLParser ! # http:// # *************** *** 28,217 **** module Bio ! class Blast ! class Report ! private ! def xmlparser_parse(xml) ! parser = XMLParser.new ! def parser.default; end ! ! begin ! tag_stack = Array.new ! hash = Hash.new ! parser.parse(xml) do |type, name, data| ! #print "type=#{type.inspect} name=#{name.inspect} data=#{data.inspect}\n" # for DEBUG ! case type ! when XMLParser::START_ELEM ! tag_stack.push(name) ! hash.update(data) ! case name ! when 'Iteration' ! iteration = Iteration.new ! @iterations.push(iteration) ! when 'Hit' ! hit = Hit.new ! hit.query_id = @query_id ! hit.query_def = @query_def ! hit.query_len = @query_len ! @iterations.last.hits.push(hit) ! when 'Hsp' ! hsp = Hsp.new ! @iterations.last.hits.last.hsps.push(hsp) ! end ! when XMLParser::END_ELEM ! case name ! when /^BlastOutput/ ! xmlparser_parse_program(name,hash) ! hash = Hash.new ! when /^Parameters$/ ! xmlparser_parse_parameters(hash) ! hash = Hash.new ! when /^Iteration/ ! xmlparser_parse_iteration(name, hash) ! hash = Hash.new ! when /^Hit/ ! xmlparser_parse_hit(name, hash) ! hash = Hash.new ! when /^Hsp$/ ! xmlparser_parse_hsp(hash) ! hash = Hash.new ! when /^Statistics$/ ! xmlparser_parse_statistics(hash) ! hash = Hash.new ! end ! tag_stack.pop ! when XMLParser::CDATA ! if hash[tag_stack.last].nil? ! hash[tag_stack.last] = data unless data.strip.empty? ! else ! hash[tag_stack.last].concat(data) if data ! end ! when XMLParser::PI end end - rescue XMLParserError - line = parser.line - column = parser.column - print "Parse error at #{line}(#{column}) : #{$!}\n" end end ! def xmlparser_parse_program(tag, hash) ! case tag ! when 'BlastOutput_program' ! @program = hash[tag] ! when 'BlastOutput_version' ! @version = hash[tag] ! when 'BlastOutput_reference' ! @reference = hash[tag] ! when 'BlastOutput_db' ! @db = hash[tag].strip ! when 'BlastOutput_query-ID' ! @query_id = hash[tag] ! when 'BlastOutput_query-def' ! @query_def = hash[tag] ! when 'BlastOutput_query-len' ! @query_len = hash[tag].to_i ! end end ! def xmlparser_parse_parameters(hash) ! labels = { ! 'matrix' => 'Parameters_matrix', ! 'expect' => 'Parameters_expect', ! 'include' => 'Parameters_include', ! 'sc-match' => 'Parameters_sc-match', ! 'sc-mismatch' => 'Parameters_sc-mismatch', ! 'gap-open' => 'Parameters_gap-open', ! 'gap-extend' => 'Parameters_gap-extend', ! 'filter' => 'Parameters_filter', ! 'pattern' => 'Parameters_pattern', ! 'entrez-query'=> 'Parameters_entrez-query', ! } ! labels.each do |k,v| ! case k ! when 'filter', 'matrix' ! @parameters[k] = hash[v].to_s ! else ! @parameters[k] = hash[v].to_i ! end end end ! def xmlparser_parse_iteration(tag, hash) ! case tag ! when 'Iteration_iter-num' ! @iterations.last.num = hash[tag].to_i ! when 'Iteration_message' ! @iterations.last.message = hash[tag].to_s ! end end ! def xmlparser_parse_hit(tag, hash) ! hit = @iterations.last.hits.last ! case tag ! when 'Hit_num' ! hit.num = hash[tag].to_i ! when 'Hit_id' ! hit.hit_id = hash[tag].clone ! when 'Hit_def' ! hit.definition = hash[tag].clone ! when 'Hit_accession' ! hit.accession = hash[tag].clone ! when 'Hit_len' ! hit.len = hash[tag].clone.to_i ! end end ! def xmlparser_parse_hsp(hash) ! hsp = @iterations.last.hits.last.hsps.last ! hsp.num = hash['Hsp_num'].to_i ! hsp.bit_score = hash['Hsp_bit-score'].to_f ! hsp.score = hash['Hsp_score'].to_i ! hsp.evalue = hash['Hsp_evalue'].to_f ! hsp.query_from = hash['Hsp_query-from'].to_i ! hsp.query_to = hash['Hsp_query-to'].to_i ! hsp.hit_from = hash['Hsp_hit-from'].to_i ! hsp.hit_to = hash['Hsp_hit-to'].to_i ! hsp.pattern_from = hash['Hsp_pattern-from'].to_i ! hsp.pattern_to = hash['Hsp_pattern-to'].to_i ! hsp.query_frame = hash['Hsp_query-frame'].to_i ! hsp.hit_frame = hash['Hsp_hit-frame'].to_i ! hsp.identity = hash['Hsp_identity'].to_i ! hsp.positive = hash['Hsp_positive'].to_i ! hsp.gaps = hash['Hsp_gaps'].to_i ! hsp.align_len = hash['Hsp_align-len'].to_i ! hsp.density = hash['Hsp_density'].to_i ! hsp.qseq = hash['Hsp_qseq'] ! hsp.hseq = hash['Hsp_hseq'] ! hsp.midline = hash['Hsp_midline'] ! end ! def xmlparser_parse_statistics(hash) ! labels = { ! 'db-num' => 'Statistics_db-num', ! 'db-len' => 'Statistics_db-len', ! 'hsp-len' => 'Statistics_hsp-len', ! 'eff-space' => 'Statistics_eff-space', ! 'kappa' => 'Statistics_kappa', ! 'lambda' => 'Statistics_lambda', ! 'entropy' => 'Statistics_entropy' ! } ! labels.each do |k,v| ! case k ! when 'db-num', 'db-len', 'hsp-len' ! @iterations.last.statistics[k] = hash[v].to_i ! else ! @iterations.last.statistics[k] = hash[v].to_f ! end end end - end ! end ! end --- 36,224 ---- module Bio ! class Blast ! class Report ! private ! def xmlparser_parse(xml) ! parser = XMLParser.new ! def parser.default; end ! ! begin ! tag_stack = Array.new ! hash = Hash.new ! parser.parse(xml) do |type, name, data| ! case type ! when XMLParser::START_ELEM ! tag_stack.push(name) ! hash.update(data) ! case name ! when 'Iteration' ! iteration = Iteration.new ! @iterations.push(iteration) ! when 'Hit' ! hit = Hit.new ! hit.query_id = @query_id ! hit.query_def = @query_def ! hit.query_len = @query_len ! @iterations.last.hits.push(hit) ! when 'Hsp' ! hsp = Hsp.new ! @iterations.last.hits.last.hsps.push(hsp) end + when XMLParser::END_ELEM + case name + when /^BlastOutput/ + xmlparser_parse_program(name,hash) + hash = Hash.new + when /^Parameters$/ + xmlparser_parse_parameters(hash) + hash = Hash.new + when /^Iteration/ + xmlparser_parse_iteration(name, hash) + hash = Hash.new + when /^Hit/ + xmlparser_parse_hit(name, hash) + hash = Hash.new + when /^Hsp$/ + xmlparser_parse_hsp(hash) + hash = Hash.new + when /^Statistics$/ + xmlparser_parse_statistics(hash) + hash = Hash.new + end + tag_stack.pop + when XMLParser::CDATA + if hash[tag_stack.last].nil? + hash[tag_stack.last] = data unless data.strip.empty? + else + hash[tag_stack.last].concat(data) if data + end + when XMLParser::PI end end + rescue XMLParserError + line = parser.line + column = parser.column + print "Parse error at #{line}(#{column}) : #{$!}\n" end + end ! def xmlparser_parse_program(tag, hash) ! case tag ! when 'BlastOutput_program' ! @program = hash[tag] ! when 'BlastOutput_version' ! @version = hash[tag] ! when 'BlastOutput_reference' ! @reference = hash[tag] ! when 'BlastOutput_db' ! @db = hash[tag].strip ! when 'BlastOutput_query-ID' ! @query_id = hash[tag] ! when 'BlastOutput_query-def' ! @query_def = hash[tag] ! when 'BlastOutput_query-len' ! @query_len = hash[tag].to_i end + end ! def xmlparser_parse_parameters(hash) ! labels = { ! 'matrix' => 'Parameters_matrix', ! 'expect' => 'Parameters_expect', ! 'include' => 'Parameters_include', ! 'sc-match' => 'Parameters_sc-match', ! 'sc-mismatch' => 'Parameters_sc-mismatch', ! 'gap-open' => 'Parameters_gap-open', ! 'gap-extend' => 'Parameters_gap-extend', ! 'filter' => 'Parameters_filter', ! 'pattern' => 'Parameters_pattern', ! 'entrez-query' => 'Parameters_entrez-query', ! } ! labels.each do |k,v| ! case k ! when 'filter', 'matrix' ! @parameters[k] = hash[v].to_s ! else ! @parameters[k] = hash[v].to_i end end + end ! def xmlparser_parse_iteration(tag, hash) ! case tag ! when 'Iteration_iter-num' ! @iterations.last.num = hash[tag].to_i ! when 'Iteration_message' ! @iterations.last.message = hash[tag].to_s end + end ! def xmlparser_parse_hit(tag, hash) ! hit = @iterations.last.hits.last ! case tag ! when 'Hit_num' ! hit.num = hash[tag].to_i ! when 'Hit_id' ! hit.hit_id = hash[tag].clone ! when 'Hit_def' ! hit.definition = hash[tag].clone ! when 'Hit_accession' ! hit.accession = hash[tag].clone ! when 'Hit_len' ! hit.len = hash[tag].clone.to_i end + end ! def xmlparser_parse_hsp(hash) ! hsp = @iterations.last.hits.last.hsps.last ! hsp.num = hash['Hsp_num'].to_i ! hsp.bit_score = hash['Hsp_bit-score'].to_f ! hsp.score = hash['Hsp_score'].to_i ! hsp.evalue = hash['Hsp_evalue'].to_f ! hsp.query_from = hash['Hsp_query-from'].to_i ! hsp.query_to = hash['Hsp_query-to'].to_i ! hsp.hit_from = hash['Hsp_hit-from'].to_i ! hsp.hit_to = hash['Hsp_hit-to'].to_i ! hsp.pattern_from = hash['Hsp_pattern-from'].to_i ! hsp.pattern_to = hash['Hsp_pattern-to'].to_i ! hsp.query_frame = hash['Hsp_query-frame'].to_i ! hsp.hit_frame = hash['Hsp_hit-frame'].to_i ! hsp.identity = hash['Hsp_identity'].to_i ! hsp.positive = hash['Hsp_positive'].to_i ! hsp.gaps = hash['Hsp_gaps'].to_i ! hsp.align_len = hash['Hsp_align-len'].to_i ! hsp.density = hash['Hsp_density'].to_i ! hsp.qseq = hash['Hsp_qseq'] ! hsp.hseq = hash['Hsp_hseq'] ! hsp.midline = hash['Hsp_midline'] ! end ! def xmlparser_parse_statistics(hash) ! labels = { ! 'db-num' => 'Statistics_db-num', ! 'db-len' => 'Statistics_db-len', ! 'hsp-len' => 'Statistics_hsp-len', ! 'eff-space' => 'Statistics_eff-space', ! 'kappa' => 'Statistics_kappa', ! 'lambda' => 'Statistics_lambda', ! 'entropy' => 'Statistics_entropy' ! } ! labels.each do |k,v| ! case k ! when 'db-num', 'db-len', 'hsp-len' ! @iterations.last.statistics[k] = hash[v].to_i ! else ! @iterations.last.statistics[k] = hash[v].to_f end end end ! ! end # class Report ! end # class Blast ! end # module Bio From nakao at dev.open-bio.org Sun Apr 30 03:11:30 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:30 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/psort report.rb,1.12,1.13 Message-ID: <200604300711.k3U7BUtC018673@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/psort In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/appl/psort Modified Files: report.rb Log Message: * changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/psort/report.rb,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** report.rb 3 Nov 2005 10:50:58 -0000 1.12 --- report.rb 30 Apr 2006 07:11:28 -0000 1.13 *************** *** 2,7 **** # = bio/appl/psort/report.rb - PSORT systems report classes # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,8 ---- # = bio/appl/psort/report.rb - PSORT systems report classes # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 9,30 **** # == A Report classes for PSORT Systems # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - # ++ - # require 'bio/sequence' --- 10,13 ---- From nakao at dev.open-bio.org Sun Apr 30 03:11:31 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:31 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/targetp report.rb,1.7,1.8 Message-ID: <200604300711.k3U7BVlq018678@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/targetp In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/appl/targetp Modified Files: report.rb Log Message: * changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/targetp/report.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** report.rb 18 Dec 2005 15:58:41 -0000 1.7 --- report.rb 30 Apr 2006 07:11:28 -0000 1.8 *************** *** 2,7 **** # = bio/appl/targetp/report.rb - TargetP report class # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,8 ---- # = bio/appl/targetp/report.rb - TargetP report class # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 13,33 **** # == Example # == References - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ # --- 14,17 ---- From nakao at dev.open-bio.org Sun Apr 30 03:11:31 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:31 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/genscan report.rb,1.8,1.9 Message-ID: <200604300711.k3U7BVhB018688@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/genscan In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/appl/genscan Modified Files: report.rb Log Message: * changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/genscan/report.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** report.rb 18 Dec 2005 15:58:40 -0000 1.8 --- report.rb 30 Apr 2006 07:11:29 -0000 1.9 *************** *** 2,7 **** # = bio/appl/genscan/report.rb - Genscan report classes # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,8 ---- # = bio/appl/genscan/report.rb - Genscan report classes # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 11,35 **** # # == Example - # == References - # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! # ! # $Id$ ! # ! #++ # --- 12,17 ---- # # == Example # ! # == References # From nakao at dev.open-bio.org Sun Apr 30 03:11:31 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:31 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/tmhmm report.rb,1.6,1.7 Message-ID: <200604300711.k3U7BVdR018683@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/tmhmm In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/appl/tmhmm Modified Files: report.rb Log Message: * changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/tmhmm/report.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** report.rb 18 Dec 2005 15:58:41 -0000 1.6 --- report.rb 30 Apr 2006 07:11:29 -0000 1.7 *************** *** 2,7 **** # = bio/appl/tmhmm/report.rb - TMHMM report class # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,8 ---- # = bio/appl/tmhmm/report.rb - TMHMM report class # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 12,32 **** # == Example # == References - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ # --- 13,16 ---- From nakao at dev.open-bio.org Sun Apr 30 03:11:31 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:31 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl common.rb,1.10,1.11 Message-ID: <200604300711.k3U7BV2X018693@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/db/embl Modified Files: common.rb Log Message: * changed license to Ruby's Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/common.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** common.rb 14 Apr 2006 06:04:09 -0000 1.10 --- common.rb 30 Apr 2006 07:11:29 -0000 1.11 *************** *** 2,6 **** # = bio/db/embl.rb - Common methods for EMBL style database classes # ! # Copyright:: Copyright (C) 2001-2005 Mitsuteru C. Nakao # License:: Ruby's # --- 2,7 ---- # = bio/db/embl.rb - Common methods for EMBL style database classes # ! # Copyright:: Copyright (C) 2001-2006 ! # Mitsuteru C. Nakao # License:: Ruby's # From nakao at dev.open-bio.org Sun Apr 30 03:11:30 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:30 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db go.rb,1.9,1.10 Message-ID: <200604300711.k3U7BU1g018663@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/db Modified Files: go.rb Log Message: * changed license to Ruby's Index: go.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/go.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** go.rb 31 Oct 2005 18:32:36 -0000 1.9 --- go.rb 30 Apr 2006 07:11:28 -0000 1.10 *************** *** 2,7 **** # = bio/db/go.rb - Classes for Gene Ontology # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: # # $Id$ --- 2,8 ---- # = bio/db/go.rb - Classes for Gene Ontology # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 12,32 **** # # == References - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ # --- 13,16 ---- From nakao at dev.open-bio.org Sun Apr 30 03:13:41 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:13:41 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/sosui report.rb,1.9,1.10 Message-ID: <200604300713.k3U7DfjR018777@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/sosui In directory dev.open-bio.org:/tmp/cvs-serv18750/lib/bio/appl/sosui Modified Files: report.rb Log Message: * changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sosui/report.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** report.rb 18 Dec 2005 15:58:41 -0000 1.9 --- report.rb 30 Apr 2006 07:13:39 -0000 1.10 *************** *** 2,7 **** # = bio/appl/sosui/report.rb - SOSUI report class # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,8 ---- # = bio/appl/sosui/report.rb - SOSUI report class # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 10,31 **** # # == References - # * http://sosui.proteome.bio.tuat.ac.jp/sosui_submit.html - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! # ! #++ # --- 11,16 ---- # # == References # ! # * http://sosui.proteome.bio.tuat.ac.jp/sosui_submit.html # From nakao at dev.open-bio.org Sun Apr 30 03:13:41 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:13:41 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl psort.rb,1.8,1.9 Message-ID: <200604300713.k3U7Dfpp018772@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv18750/lib/bio/appl Modified Files: psort.rb Log Message: * changed license to Ruby's Index: psort.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/psort.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** psort.rb 1 Nov 2005 05:15:15 -0000 1.8 --- psort.rb 30 Apr 2006 07:13:39 -0000 1.9 *************** *** 1,8 **** # # = bio/appl/psort.rb - PSORT, protein sorting site prediction systems # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL ! # # # $Id$ --- 1,10 ---- + module Bio + # # = bio/appl/psort.rb - PSORT, protein sorting site prediction systems # ! # Copyright:: Copyright (C) 2003-2006 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 25,59 **** # # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ - # require 'bio/sequence' require 'bio/db/fasta' - require 'net/http' require 'cgi' ! module Bio ! ! ! ! class PSORT # a Hash for PSORT official hosts: # Key value (host) --- 27,40 ---- # # require 'bio/sequence' + require 'bio/command' require 'bio/db/fasta' require 'cgi' ! # class PSORT + # a Hash for PSORT official hosts: # Key value (host) *************** *** 62,78 **** # Okazaki psort.nibb.ac.jp # Peking srs.pku.edu.cn:8088 ! WWWServer = { ! 'IMSUT' => {'host' => 'psort.hgc.jp', #'psort.ims.u-tokyo.ac.jp', ! 'PSORT1' => '/cgi-bin/okumura.pl', ! 'PSORT2' => '/cgi-bin/runpsort.pl'}, ! 'Okazaki' => {'host' => 'psort.nibb.ac.jp', ! 'PSORT1' => '/cgi-bin/okumura.pl', ! 'PSORT2' => '/cgi-bin/runpsort.pl'}, ! 'Peking' => {'host' => 'srs.pku.edu.en:8088', ! 'PSORT1' => '/cgi-bin/okumura.pl', ! 'PSORT2' => '/cgi-bin/runpsort.pl'} } - # = Generic CGI client class # A generic CGI client class for Bio::PSORT::* classes. --- 43,58 ---- # Okazaki psort.nibb.ac.jp # Peking srs.pku.edu.cn:8088 ! ServerURI = { ! :IMSUT => { ! :PSORT1 => URI.parse("http://psort.hgc.jp/cgi-bin/okumura.pl"), ! :PSORT2 => URI.parse("http://psort.hgc.jp/cgi-bin/runpsort.pl") }, ! :Okazaki => { ! :PSORT1 => URI.parse("http://psort.nibb.ac.jp/cgi-bin/okumura.pl"), ! :PSORT2 => URI.parse("http://psort.nibb.ac.jp/cgi-bin/runpsort.pl") }, ! :Peking => { ! :PSORT1 => URI.parse("http:///src.pku.edu.cn:8088/cgi-bin/okumura.pl"), ! :PSORT2 => URI.parse("http://src.pku.edu.cn:8088/cgi-bin/runpsort.pl") }, } # = Generic CGI client class # A generic CGI client class for Bio::PSORT::* classes. *************** *** 104,113 **** ! # Sets remote ``host'' and cgi ``path''. ! def initialize(host = '', path = '') ! @host = host ! @path = path @args = {} ! @report end --- 84,107 ---- ! # Sets remote host name and cgi path or uri. ! # ! # == Examples ! # ! # CGIDriver.new("localhost", "/cgi-bin/psort_www.pl") ! # ! # CGIDriver.new("http://localhost/cgi-bin/psort_www.pl") ! # ! # CGIDriver.new(URI.parse("http://localhost/cgi-bin/psort_www.pl")) ! # ! def initialize(host = '', path = '') ! case host.to_s ! when /^http:/ ! uri = host.to_s ! else ! uri = 'http://' + host + '/' + path ! end ! @uri = URI.parse(uri) @args = {} ! @report = '' end *************** *** 118,122 **** begin ! result, = Net::HTTP.new(@host).post(@path, data) @report = result.body output = parse_report(@report) --- 112,119 ---- begin ! result = nil ! Bio::Command::NetTools.net_http_start(@uri.host) {|http| ! result, = http.post(@uri.path, data) ! } @report = result.body output = parse_report(@report) *************** *** 140,144 **** # Erases HTML tags def erase_html_tags(str) ! return str.gsub(/<\S.*?>/,'') end --- 137,141 ---- # Erases HTML tags def erase_html_tags(str) ! return str.gsub(/<\S.*?>/, '') end *************** *** 149,153 **** tmp << CGI.escape(key.to_s) + '=' + CGI.escape(val.to_s) end ! return tmp.join(delim) # not ';' but '&' in psort's cgi end --- 146,150 ---- tmp << CGI.escape(key.to_s) + '=' + CGI.escape(val.to_s) end ! return tmp.join(delim) # not ';' but '&' in the psort cgi script. end *************** *** 157,160 **** --- 154,158 ---- # = Bio::PSORT::PSORT1 + # # Bio::PSORT::PSORT1 is a wapper class for the original PSORT program. # *************** *** 169,175 **** --- 167,175 ---- # # == References + # # 1. Nakai, K. and Kanehisa, M., A knowledge base for predicting protein # localization sites in eukaryotic cells, Genomics 14, 897-911 (1992). # [PMID:1478671] + # class PSORT1 *************** *** 179,184 **** # connecting to the IMSUT server. def self.imsut ! self.new(Remote.new(WWWServer['IMSUT']['host'], ! WWWServer['IMSUT']['PSORT1'])) end --- 179,183 ---- # connecting to the IMSUT server. def self.imsut ! self.new(Remote.new(ServerURI[:IMSUT][:PSORT1])) end *************** *** 187,192 **** # connecting to the NIBB server. def self.okazaki ! self.new(Remote.new(WWWServer['Okazaki']['host'], ! WWWServer['Okazaki']['PSORT1'])) end --- 186,190 ---- # connecting to the NIBB server. def self.okazaki ! self.new(Remote.new(ServerURI[:Okazaki][:PSORT1])) end *************** *** 195,209 **** # connecting to the Peking server. def self.peking ! self.new(Remote.new(WWWServer['Peking']['host'], ! WWWServer['Peking']['PSORT1'])) end ! # Sets a server CGI Driver (Bio::PSORT::PSORT1::Remote). ! def initialize(driver, origin = 'yeast') ! @serv = driver ! @origin = origin # Gram-positive bacterium, Gram-negative bacterium, ! # yeast, aminal, plant ! @title = 'MYSEQ' @sequence = '' end --- 193,207 ---- # connecting to the Peking server. def self.peking ! self.new(Remote.new(ServerURI[:Peking][:PSORT1])) end ! # Sets a cgi client (Bio::PSORT::PSORT1::Remote). ! # ! def initialize(driver, origin = 'yeast', title = 'MYSEQ') ! @serv = driver ! @origin = origin # Gram-positive bacterium, Gram-negative bacterium, ! # yeast, aminal, plant ! @title = title @sequence = '' end *************** *** 237,243 **** def exec(faa, parsing = true) if faa.class == Bio::FastaFormat ! @title = faa.entry_id if @title == 'MYSEQ' ! @sequence = faa.seq ! @serv.args = {'title' => @title, 'origin' => @origin} @serv.parsing = parsing return @serv.exec(sequence) --- 235,241 ---- def exec(faa, parsing = true) if faa.class == Bio::FastaFormat ! @title = faa.entry_id if @title == 'MYSEQ' ! @sequence = faa.seq ! @serv.args = {'title' => @title, 'origin' => @origin} @serv.parsing = parsing return @serv.exec(sequence) *************** *** 268,274 **** # Sets remote ``host'' and cgi ``path''. ! def initialize(host, path) ! @origin = 'yeast' ! @title = 'MYSEQ' @parsing = true super(host, path) --- 266,272 ---- # Sets remote ``host'' and cgi ``path''. ! def initialize(host, path = nil, title = 'MYSEQ', origin = 'yeast') ! @title = title ! @origin = origin @parsing = true super(host, path) *************** *** 327,331 **** # Okazaki psort.nibb.ac.jp /cgi-bin/runpsort.pl # Peking srs.pku.edu.cn:8088 /cgi-bin/runpsort.pl ! def self.remote(host, path) self.new(Remote.new(host, path)) end --- 325,329 ---- # Okazaki psort.nibb.ac.jp /cgi-bin/runpsort.pl # Peking srs.pku.edu.cn:8088 /cgi-bin/runpsort.pl ! def self.remote(host, path = nil) self.new(Remote.new(host, path)) end *************** *** 334,339 **** # connecting to the IMSUT server. def self.imsut ! self.remote(WWWServer['IMSUT']['host'], ! WWWServer['IMSUT']['PSORT2']) end --- 332,336 ---- # connecting to the IMSUT server. def self.imsut ! self.remote(ServerURI[:IMSUT][:PSORT2]) end *************** *** 341,346 **** # connecting to the NIBB server. def self.okazaki ! self.remote(WWWServer['Okazaki']['host'], ! WWWServer['Okazaki']['PSORT2']) end --- 338,342 ---- # connecting to the NIBB server. def self.okazaki ! self.remote(ServerURI[:Okazaki][:PSORT2]) end *************** *** 348,353 **** # connecting to the Peking server. def self.peking ! self.remote(WWWServer['Peking']['host'], ! WWWServer['Peking']['PSORT2']) end --- 344,348 ---- # connecting to the Peking server. def self.peking ! self.remote(ServerURI[:Peking][:PSORT2]) end *************** *** 374,380 **** def exec(faa, parsing = true) if faa.class == Bio::FastaFormat ! @title = faa.entry_id if @title == nil ! @sequence = faa.seq ! @serv.args = {'origin' => @origin, 'title' => @title} @serv.parsing = parsing return @serv.exec(@sequence) --- 369,375 ---- def exec(faa, parsing = true) if faa.class == Bio::FastaFormat ! @title = faa.entry_id if @title == nil ! @sequence = faa.seq ! @serv.args = {'origin' => @origin, 'title' => @title} @serv.parsing = parsing return @serv.exec(@sequence) From aerts at dev.open-bio.org Thu Apr 20 15:58:36 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 20 Apr 2006 15:58:36 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio location.rb,0.22,0.23 Message-ID: <200604201558.k3KFwa79014586@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv14566 Modified Files: location.rb Log Message: Added and reformatted documentation. Index: location.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/location.rb,v retrieving revision 0.22 retrieving revision 0.23 diff -C2 -d -r0.22 -r0.23 *** location.rb 18 Dec 2005 15:50:06 -0000 0.22 --- location.rb 20 Apr 2006 15:58:34 -0000 0.23 *************** *** 2,16 **** # = bio/location.rb - Locations/Location class (GenBank location format) # ! # Copyright:: Copyright (C) 2001, 2005 ! # KATAYAMA Toshiaki # License:: LGPL # # $Id$ # ! # == Appendix : GenBank location descriptor classification # # === Definition of the position notation of the GenBank location format # ! # According to the GenBank manual 'gbrel.txt', I classified position notations # into 10 patterns - (A) to (J). # --- 2,167 ---- # = bio/location.rb - Locations/Location class (GenBank location format) # ! # Copyright:: Copyright (C) 2001, 2005 KATAYAMA Toshiaki ! # 2006 Jan Aerts # License:: LGPL # # $Id$ # ! # ! #-- ! # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! # ! #++ ! # ! ! module Bio ! ! # = DESCRIPTION ! # The Bio::Location class describes the position of a genomic locus. Typically, ! # Bio::Location objects are created automatically when the user creates a ! # Bio::Locations object, instead of initialized directly. ! # ! # = USAGE ! # location = Bio::Location.new('500..550') ! # puts "start=" + location.from.to_s + ";end=" + location.to.to_s ! # ! # #, or better: through Bio::Locations ! # locations = Bio::Locations.new('500..550') ! # locations.each do |location| ! # puts "start=" + location.from.to_s + ";end=" + location.to.to_s ! # end ! class Location ! ! # Parses a'location' segment, which can be 'ID:' + ('n' or 'n..m' or 'n^m' ! # or "seq") with '<' or '>', and returns a Bio::Location object. ! # location = Bio::Location.new('500..550') ! # ! # --- ! # *Arguments*: ! # * (required) _str_: GenBank style position string (see Bio::Locations documentation) ! # *Returns*:: Bio::Location object ! def initialize(location = nil) ! ! if location ! if location =~ /:/ # (G) ID:location ! xref_id, location = location.split(':') ! end ! if location =~ / ! lt = true ! end ! if location =~ />/ ! gt = true ! end ! end ! ! # s : start base, e : end base => from, to ! case location ! when /^[<>]?(\d+)$/ # (A, I) n ! s = e = $1.to_i ! when /^[<>]?(\d+)\.\.[<>]?(\d+)$/ # (B, I) n..m ! s = $1.to_i ! e = $2.to_i ! if e - s < 0 ! # raise "Error: invalid range : #{location}" ! $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG ! end ! when /^[<>]?(\d+)\^[<>]?(\d+)$/ # (C, I) n^m ! s = $1.to_i ! e = $2.to_i ! if e - s != 1 ! # raise "Error: invalid range : #{location}" ! $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG ! end ! when /^"?([ATGCatgc]+)"?$/ # (H) literal sequence ! sequence = $1.downcase ! s = e = nil ! when nil ! ; ! else ! raise "Error: unknown location format : #{location}" ! end ! ! @from = s # start position of the location ! @to = e # end position of the location ! @strand = 1 # strand direction of the location ! # forward => 1 or complement => -1 ! @sequence = sequence # literal sequence of the location ! @lt = lt # true if the position contains '<' ! @gt = gt # true if the position contains '>' ! @xref_id = xref_id # link to the external entry as GenBank ID ! end ! ! attr_accessor :from, :to, :strand, :sequence, :lt, :gt, :xref_id ! ! # Complements the sequence (i.e. alternates the strand). ! # --- ! # *Returns*:: the Bio::Location object ! def complement ! @strand *= -1 ! self # return Location object ! end ! ! # Replaces the sequence of the location. ! # --- ! # *Arguments*: ! # * (required) _sequence_: sequence to be used to replace the sequence at the location ! # *Returns*:: the Bio::Location object ! def replace(sequence) ! @sequence = sequence.downcase ! self # return Location object ! end ! ! # Returns the range (from..to) of the location as a Range object. ! def range ! @from.. at to ! end ! ! end # class location ! ! # = DESCRIPTION ! # The Bio::Locations class is a container for Bio::Location objects: creating a ! # Bio::Locations object (based on a GenBank style position string) will ! # spawn an array of Bio::Location objects. ! # ! # = USAGE ! # locations = Bio::Locations.new('join(complement(500..550), 600..625)') ! # locations.each do |location| ! # puts "class=" + location.class.to_s ! # puts "start=" + location.from.to_s + ";end=" + location.to.to_s \ ! # + ";strand=" + location.strand.to_s ! # end ! # # Output would be: ! # # class=Bio::Location ! # # start=500;end=550;strand=-1 ! # # class=Bio::Location ! # # start=600;end=625;strand=1 ! # ! # # For the following three location strings, print the span and range ! # ['one-of(898,900)..983', ! # 'one-of(5971..6308,5971..6309)', ! # '8050..one-of(10731,10758,10905,11242)'].each do |loc| ! # location = Bio::Locations.new(loc) ! # puts location.span ! # puts location.range ! # end ! # ! # = GENBANK LOCATION DESCRIPTOR CLASSIFICATION # # === Definition of the position notation of the GenBank location format # ! # According to the GenBank manual 'gbrel.txt', position notations were classified # into 10 patterns - (A) to (J). # *************** *** 84,115 **** # === Reduction strategy of the position notations # ! # (A) Location n ! # ! # (B) Location n..m ! # ! # (C) Location n^m ! # ! # (D) (n.m) => Location n ! # ! # (E) one-of(n,m,..) => Location n ! # one-of(n..m,..) => Location n..m ! # ! # (F) order(loc,loc,..) => join(loc, loc,..) ! # group(loc,loc,..) => join(loc, loc,..) ! # join(loc,loc,..) => Sequence ! # ! # (G) ID:loc => Location with ID ! # ! # (H) "atgc" => Location only with Sequence ! # ! # (I) Location n with lt flag ! # >n => Location n with gt flag ! # Location n..m with lt flag ! # n..>m => Location n..m with gt flag ! # m => Location n..m with lt, gt flag ! # ! # (J) complement(loc) => Sequence ! # ! # (K) replace(loc, str) => Location with replacement Sequence # # === GenBank location examples --- 235,259 ---- # === Reduction strategy of the position notations # ! # * (A) Location n ! # * (B) Location n..m ! # * (C) Location n^m ! # * (D) (n.m) => Location n ! # * (E) ! # * one-of(n,m,..) => Location n ! # * one-of(n..m,..) => Location n..m ! # * (F) ! # * order(loc,loc,..) => join(loc, loc,..) ! # * group(loc,loc,..) => join(loc, loc,..) ! # * join(loc,loc,..) => Sequence ! # * (G) ID:loc => Location with ID ! # * (H) "atgc" => Location only with Sequence ! # * (I) ! # * Location n with lt flag ! # * >n => Location n with gt flag ! # * Location n..m with lt flag ! # * n..>m => Location n..m with gt flag ! # * m => Location n..m with lt, gt flag ! # * (J) complement(loc) => Sequence ! # * (K) replace(loc, str) => Location with replacement Sequence # # === GenBank location examples *************** *** 232,340 **** # * [ADR40FIB] replace(510..520, <= replace(510..520, "taatcctaccg") # * [RATDYIIAAB] replace(1306..1443,"aagaacatccacggagtcagaactgggctcttcacgccggatttggcgttcgaggccattgtgaaaaagcaggcaatgcaccagcaagctcagttcctacccctgcgtggacctggttatccaggagctaatcagtacagttaggtggtcaagctgaaagagccctgtctgaaa") - # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ - # - - module Bio - - class Location - - # Pass a range of the 'location' segment. The 'location' segment can be - # 'ID:' + ('n' or 'n..m' or 'n^m' or "seq") with '<' or '>'. - def initialize(location = nil) - - if location - if location =~ /:/ # (G) ID:location - xref_id, location = location.split(':') - end - if location =~ / - lt = true - end - if location =~ />/ - gt = true - end - end - - # s : start base, e : end base => from, to - case location - when /^[<>]?(\d+)$/ # (A, I) n - s = e = $1.to_i - when /^[<>]?(\d+)\.\.[<>]?(\d+)$/ # (B, I) n..m - s = $1.to_i - e = $2.to_i - if e - s < 0 - # raise "Error: invalid range : #{location}" - $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG - end - when /^[<>]?(\d+)\^[<>]?(\d+)$/ # (C, I) n^m - s = $1.to_i - e = $2.to_i - if e - s != 1 - # raise "Error: invalid range : #{location}" - $stderr.puts "[Warning] invalid range : #{location}" if $DEBUG - end - when /^"?([ATGCatgc]+)"?$/ # (H) literal sequence - sequence = $1.downcase - s = e = nil - when nil - ; - else - raise "Error: unknown location format : #{location}" - end - - @from = s # start position of the location - @to = e # end position of the location - @strand = 1 # strand direction of the location - # forward => 1 or complement => -1 - @sequence = sequence # literal sequence of the location - @lt = lt # true if the position contains '<' - @gt = gt # true if the position contains '>' - @xref_id = xref_id # link to the external entry as GenBank ID - end - - attr_accessor :from, :to, :strand, :sequence, :lt, :gt, :xref_id - - # Complement the sequence from outside. - def complement - @strand *= -1 - self # return Location object - end - - # Replace the sequence from outside. - def replace(sequence) - @sequence = sequence.downcase - self # return Location object - end - - # Returns a range (from..to) of the segment as a Range object. - def range - @from.. at to - end - - end # class location - - class Locations - include Enumerable ! # Parse a GenBank style position string and returns a Locations object, ! # which contains a list of Location objects. def initialize(position) if position.is_a? Array --- 376,390 ---- # * [ADR40FIB] replace(510..520, <= replace(510..520, "taatcctaccg") # * [RATDYIIAAB] replace(1306..1443,"aagaacatccacggagtcagaactgggctcttcacgccggatttggcgttcgaggccattgtgaaaaagcaggcaatgcaccagcaagctcagttcctacccctgcgtggacctggttatccaggagctaatcagtacagttaggtggtcaagctgaaagagccctgtctgaaa") class Locations include Enumerable ! # Parses a GenBank style position string and returns a Bio::Locations object, ! # which contains a list of Bio::Location objects. ! # locations = Bio::Locations.new('join(complement(500..550), 600..625)') ! # ! # --- ! # *Arguments*: ! # * (required) _str_: GenBank style position string ! # *Returns*:: Bio::Locations object def initialize(position) if position.is_a? Array *************** *** 342,351 **** else position = gbl_cleanup(position) # preprocessing ! @locations = gbl_pos2loc(position) # create an Array of Location end end attr_accessor :locations ! # Iterates on each Location object. def each @locations.each do |x| --- 392,403 ---- else position = gbl_cleanup(position) # preprocessing ! @locations = gbl_pos2loc(position) # create an Array of Bio::Location objects end end + + # An Array of Bio::Location objects attr_accessor :locations ! # Iterates on each Bio::Location object. def each @locations.each do |x| *************** *** 354,368 **** end ! # Returns nth Location object. def [](n) @locations[n] end ! # Returns first Location object. def first @locations.first end ! # Returns last Location object. def last @locations.last --- 406,420 ---- end ! # Returns nth Bio::Location object. def [](n) @locations[n] end ! # Returns first Bio::Location object. def first @locations.first end ! # Returns last Bio::Location object. def last @locations.last *************** *** 370,374 **** # Returns an Array containing overall min and max position [min, max] ! # of this Locations object. def span span_min = @locations.min { |a,b| a.from <=> b.from } --- 422,426 ---- # Returns an Array containing overall min and max position [min, max] ! # of this Bio::Locations object. def span span_min = @locations.min { |a,b| a.from <=> b.from } *************** *** 397,403 **** alias size length ! # Convert absolute position in DNA (na) to relative position in RNA (na). ! # If type == :aa, ! # convert absolute position in DNA (na) to relative position in Protein (aa). def relative(n, type = nil) case type --- 449,466 ---- alias size length ! # Converts absolute position in the whole of the DNA sequence to relative ! # position in the locus. ! # ! # This method can for example be used to relate positions in a DNA-sequence ! # with those in RNA. In this use, the optional ':aa'-flag returns the position ! # of the associated amino-acid rather than the nucleotide. ! # loc = Bio::Locations.new('complement(12838..13533)') ! # puts loc.relative(13524) # => 10 ! # puts loc.relative(13506, :aa) # => 3 ! # --- ! # *Arguments*: ! # * (required) _position_: nucleotide position within whole of the sequence ! # * _:aa_: flag that lets method return position in aminoacid coordinates ! # *Returns*:: position within the location def relative(n, type = nil) case type *************** *** 415,430 **** end ! # Convert relative position in RNA (na) to absolute position in DNA (na). ! # If type == :aa, ! # convert relative position in Protein (aa) -> absolute position in DNA (na). ! # ! # * Examples ! # ! # loc = Bio::Locations.new('complement(12838..13533)') ! # loc.absolute(10) #=> 13524 (rel2abs) ! # loc.relative(13524) #=> 10 (abs2rel) ! # loc.absolute(10, :aa) #=> 13506 (rel2abs) ! # loc.relative(13506, :aa) #=> 10 (abs2rel) ! # def absolute(n, type = nil) case type --- 478,495 ---- end ! # Converts relative position in the locus to position in the whole of the ! # DNA sequence. ! # ! # This method can for example be used to relate positions in a DNA-sequence ! # with those in RNA. In this use, the optional ':aa'-flag returns the position ! # of the associated amino-acid rather than the nucleotide. ! # loc = Bio::Locations.new('complement(12838..13533)') ! # puts loc.absolute(10) # => 13524 ! # puts loc.absolute(10, :aa) # => 13506 ! # --- ! # *Arguments*: ! # * (required) _position_: nucleotide position within locus ! # * _:aa_: flag to be used if _position_ is a aminoacid position rather than a nucleotide position ! # *Returns*:: position within the whole of the sequence def absolute(n, type = nil) case type *************** *** 591,594 **** --- 656,664 ---- puts "Test new & span methods" [ + '450', + '500..600', + 'join(500..550, 600..625)', + 'complement(join(500..550, 600..625))', + 'join(complement(500..550), 600..625)', '754^755', 'complement(53^54)', *************** *** 618,624 **** ].each do |pos| p pos ! p Bio::Locations.new(pos).span ! p Bio::Locations.new(pos).range ! p Bio::Locations.new(pos) end --- 688,699 ---- ].each do |pos| p pos ! # p Bio::Locations.new(pos) ! # p Bio::Locations.new(pos).span ! # p Bio::Locations.new(pos).range ! Bio::Locations.new(pos).each do |location| ! puts "class=" + location.class.to_s ! puts "start=" + location.from.to_s + "\tend=" + location.to.to_s + "\tstrand=" + location.strand.to_s ! end ! end From aerts at dev.open-bio.org Wed Apr 26 11:05:52 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Wed, 26 Apr 2006 11:05:52 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio feature.rb,1.10,1.11 Message-ID: <200604261105.k3QB5q61032048@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv32028 Modified Files: feature.rb Log Message: Added and reformatted documentation. Qualifiers are now automatically converted into Bio::Feature::Qualifier objects when initializing a new Bio::Feature object. Index: feature.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/feature.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** feature.rb 27 Feb 2006 09:13:46 -0000 1.10 --- feature.rb 26 Apr 2006 11:05:50 -0000 1.11 *************** *** 2,42 **** # = bio/feature.rb - Features/Feature class (GenBank Feature table) # ! # Copyright:: Copyright (c) 2002, 2005 ! # Toshiaki Katayama # License:: Ruby's # # $Id$ - # - # == INSD Feature table definition - # - # See http://www.ddbj.nig.ac.jp/FT/full_index.html for the INSD - # (GenBank/EMBL/DDBJ) Feature table definition. - # - # === Example - # - # # suppose features is a Bio::Features object - # features.each do |feature| - # f_name = feature.feature - # f_pos = feature.position - # puts "#{f_name}:\t#{f_pos}" - # feature.each do |qualifier| - # q_name = qualifier.qualifier - # q_val = qualifier.value - # puts "- #{q_name}:\t#{q_val}" - # end - # end - # - # # Iterates only on CDS features and extract translated amino acid sequences - # features.each("CDS") do |feature| - # hash = feature.assoc - # name = hash["gene"] || hash["product"] || hash["note"] - # seq = hash["translation"] - # pos = feature.position - # if gene and seq - # puts ">#{gene} #{feature.position}" - # puts aaseq - # end - # end - # require 'bio/location' --- 2,10 ---- # = bio/feature.rb - Features/Feature class (GenBank Feature table) # ! # Copyright:: Copyright (c) 2002, 2005 Toshiaki Katayama ! # 2006 Jan Aerts # License:: Ruby's # # $Id$ require 'bio/location' *************** *** 44,52 **** module Bio # Container for the sequence annotation. class Feature ! def initialize(feature = '', position = '', qualifiers = []) ! @feature, @position, @qualifiers = feature, position, qualifiers end --- 12,54 ---- module Bio + # = DESCRIPTION # Container for the sequence annotation. + # + # = USAGE + # # Create a Bio::Feature object. + # # For example: the GenBank-formatted entry in genbank for accession M33388 + # # contains the following feature: + # # exon 1532..1799 + # # /gene="CYP2D6" + # # /note="cytochrome P450 IID6; GOO-132-127" + # # /number="1" + # feature = Bio::Feature.new('exon','1532..1799',['gene' => 'CYP2D6','note' => 'cytochrome P450 IID6; GOO-132-127','number' => '1']) + # + # # Print the feature + # puts feature.feature + "\t" + feature.position + # feature.each do |qualifier| + # puts "- " + qualifier.qualifier + ": " + qualifier.value + # end + # + # = REFERENCES + # INSD feature table definition:: http://www.ddbj.nig.ac.jp/FT/full_index.html class Feature ! # Create a new Bio::Feature object. ! # *Arguments*: ! # * (required) _feature_: type of feature (e.g. "exon") ! # * (required) _position_: position of feature (e.g. "complement(1532..1799)") ! # * (optional) _qualifiers_: list of qualifiers (e.g. "['gene' => 'CYP2D6','number' => '1']") ! # *Returns*:: Bio::Feature object def initialize(feature = '', position = '', qualifiers = []) ! @feature, @position = feature, position ! @qualifiers = Array.new ! if qualifiers.length.modulo(2) > 0 ! $stderr.puts "WARNING" ! end ! while qualifiers.length > 0 ! key = qualifiers.shift ! value = qualifiers.shift || '' ! self.append(Qualifier.new(key, value)) ! end end *************** *** 66,73 **** # Appends a Qualifier object to the Feature. ! # ! # * Returns an Array of Qualifier objects. ! # * If the argument is not a Qualifier object, returns nil. ! # def append(a) @qualifiers.push(a) if a.is_a? Qualifier --- 68,75 ---- # Appends a Qualifier object to the Feature. ! # ! # *Arguments*: ! # * (required) _qualifier_: Bio::Feature::Qualifier object ! # *Returns*:: Bio::Feature object def append(a) @qualifiers.push(a) if a.is_a? Qualifier *************** *** 75,79 **** end ! # Iterates on each qualifier. def each(arg = nil) @qualifiers.each do |x| --- 77,84 ---- end ! # Iterates on each qualifier object. ! # ! # *Arguments*: ! # * (optional) _key_: if specified, only iterates over qualifiers with this key def each(arg = nil) @qualifiers.each do |x| *************** *** 108,114 **** end ! # Container for the qualifier-value pair. class Qualifier ! def initialize(key, value) @qualifier, @value = key, value --- 113,124 ---- end ! # Container for qualifier-value pairs for sequence features. class Qualifier ! # Creates a new Bio::Feature::Qualifier object ! # ! # *Arguments*: ! # * (required) _key_: key of the qualifier (e.g. "gene") ! # * (required) _value_: value of the qualifier (e.g. "CYP2D6") ! # *Returns*:: Bio::Feature::Qualifier object def initialize(key, value) @qualifier, @value = key, value *************** *** 126,132 **** ! # Container for the list of Feature objects. class Features ! def initialize(ary = []) @features = ary --- 136,177 ---- ! # = DESCRIPTION ! # Container for a list of Feature objects. ! # ! # = USAGE ! # # First, create some Bio::Feature objects ! # feature1 = Bio::Feature.new('intron','3627..4059',['gene', 'CYP2D6', 'note', 'G00-132-127','number','4']) ! # feature2 = Bio::Feature.new('exon','4060..4236',['gene', 'CYP2D6', 'note', 'G00-132-127','number','5']) ! # feature3 = Bio::Feature.new('intron','4237..4426',['gene', 'CYP2D6', 'note', 'G00-132-127','number','5']) ! # feature4 = Bio::Feature.new('CDS','join(2538..3626,4060..4236)',['gene', 'CYP2D6','translation','MGXXTVMHLL...']) ! # ! # # And create a container for them ! # feature_container = Bio::Features.new([ feature1, feature2, feature3, feature4 ]) ! # ! # # Iterate over all features and print ! # feature_container.each do |feature| ! # puts feature.feature + "\t" + feature.position ! # feature.each do |qualifier| ! # puts "- " + qualifier.qualifier + ": " + qualifier.value ! # end ! # end ! # ! # # Iterate only over CDS features and extract translated amino acid sequences ! # features.each("CDS") do |feature| ! # hash = feature.to_hash ! # name = hash["gene"] || hash["product"] || hash["note"] ! # aaseq = hash["translation"] ! # pos = feature.position ! # if name and seq ! # puts ">#{gene} #{feature.position}" ! # puts aaseq ! # end ! # end class Features ! # Create a new Bio::Features object. ! # ! # *Arguments*: ! # * (optional) _list of features_: list of Bio::Feature objects ! # *Returns*:: Bio::Features object def initialize(ary = []) @features = ary *************** *** 137,140 **** --- 182,189 ---- # Appends a Feature object to Features. + # + # *Arguments*: + # * (required) _feature_: Bio::Feature object + # *Returns*:: Bio::Features object def append(a) @features.push(a) if a.is_a? Feature *************** *** 142,147 **** end ! # Iterates on each feature. If a feature name is given as an argument, ! # only iterates on each feature belongs to the name (e.g. 'CDS' etc.) def each(arg = nil) @features.each do |x| --- 191,198 ---- end ! # Iterates on each feature object. ! # ! # *Arguments*: ! # * (optional) _key_: if specified, only iterates over features with this key def each(arg = nil) @features.each do |x| *************** *** 170,172 **** --- 221,257 ---- end # Bio + if __FILE__ == $0 + puts "---TESTING Bio::Feature" + feature1 = Bio::Feature.new('exon','1532..1799',['gene','CYP2D6','note','cytochrome P450 IID6; GOO-132-127','number','1', 'note', 'a second note']) + + # Print the feature out + puts feature1.feature + "\t" + feature1.position + feature1.each do |qualifier| + puts "- " + qualifier.qualifier + ": " + qualifier.value + end + + feature2 = Bio::Feature.new('CDS','join(2538..3626,4060..4236)',['gene', 'CYP2D6','translation','MGXXTVMHLL...']) + + puts "---TESTING Bio::Features" + feature3 = Bio::Feature.new('intron','3627..4059',['gene', 'CYP2D6', 'note', 'G00-132-127','number','4']) + feature4 = Bio::Feature.new('exon','4060..4236',['gene', 'CYP2D6', 'note', 'G00-132-127','number','5']) + feature5 = Bio::Feature.new('intron','4237..4426',['gene', 'CYP2D6', 'note', 'G00-132-127','number','5']) + feature_container = Bio::Features.new([ feature1, feature2, feature3, feature4, feature5 ]) + feature_container.each do |feature| + puts "-NEXT FEATURE" + puts feature.feature + "\t" + feature.position + feature.each do |qualifier| + puts "- " + qualifier.qualifier + ": " + qualifier.value + end + end + puts "---TESTING hash function" + feature_container.each('CDS') do |feature| + hash = feature.to_hash + name = hash["gene"] || hash["product"] || hash["note"] + aaseq = hash["translation"] + pos = feature.position + puts ">#{name} #{feature.position}" + puts aaseq + end + end From aerts at dev.open-bio.org Thu Apr 27 09:29:37 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 27 Apr 2006 09:29:37 +0000 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.66,1.67 Message-ID: <200604270929.k3R9Tbx2003641@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory dev.open-bio.org:/tmp/cvs-serv3621 Modified Files: bio.rb Log Message: Added bio/io/ensembl.rb to be autoloaded. Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** bio.rb 27 Feb 2006 09:11:01 -0000 1.66 --- bio.rb 27 Apr 2006 09:29:35 -0000 1.67 *************** *** 132,135 **** --- 132,137 ---- autoload :DBGET, 'bio/io/dbget' + autoload :Ensembl, 'bio/io/ensembl' + ## below are described in bio/appl/blast.rb #class Blast From nakao at dev.open-bio.org Fri Apr 14 04:49:46 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 04:49:46 -0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl embl.rb,1.26,1.27 Message-ID: <200604140549.k3E5nWFn009694@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv9674 Modified Files: embl.rb Log Message: * Removed example codes (if __FILE__ == $0 ... end). * Changed license (LGPL -> Ruby's). Index: embl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/embl.rb,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** embl.rb 28 Jan 2006 06:40:38 -0000 1.26 --- embl.rb 14 Apr 2006 05:49:30 -0000 1.27 *************** *** 3,8 **** # # ! # Copyright:: Copyright (C) 2001-2005 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 3,8 ---- # # ! # Copyright:: Copyright (C) 2001-2006 Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 29,50 **** # http://www.ebi.ac.uk/embl/Documentation/User_manual/usrman.html # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ - # require 'bio/db' --- 29,32 ---- *************** *** 395,454 **** end ! end ! ! end ! ! ! if __FILE__ == $0 ! while ent = $<.gets(Bio::EMBL::RS) ! puts "\n ==> e = Bio::EMBL.new(ent) " ! e = Bio::EMBL.new(ent) ! ! puts "\n ==> e.entry_id " ! p e.entry_id ! puts "\n ==> e.id_line " ! p e.id_line ! puts "\n ==> e.id_line('molecule') " ! p e.id_line('molecule') ! puts "\n ==> e.molecule " ! p e.molecule ! puts "\n ==> e.ac " ! p e.ac ! puts "\n ==> e.sv " ! p e.sv ! puts "\n ==> e.dt " ! p e.dt ! puts "\n ==> e.dt('created') " ! p e.dt('created') ! puts "\n ==> e.de " ! p e.de ! puts "\n ==> e.kw " ! p e.kw ! puts "\n ==> e.os " ! p e.os ! puts "\n ==> e.oc " ! p e.oc ! puts "\n ==> e.og " ! p e.og ! puts "\n ==> e.ref " ! p e.ref ! puts "\n ==> e.dr " ! p e.dr ! puts "\n ==> e.ft " ! p e.ft ! puts "\n ==> e.each_cds {|c| p c}" ! p e.each_cds {|c| p c } ! puts "\n ==> e.sq " ! p e.sq ! puts "\n ==> e.sq('a') " ! p e.sq('a') ! puts "\n ==> e.gc" ! p e.gc ! puts "\n ==> e.seq " ! p e.seq ! end ! ! end ! ! --- 377,381 ---- end ! end # class EMBL + end # module Bio From nakao at dev.open-bio.org Fri Apr 14 04:52:42 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 04:52:42 -0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl sptr.rb,1.30,1.31 Message-ID: <200604140552.k3E5qU1e009726@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv9706 Modified Files: sptr.rb Log Message: * Removed example codes (if __FILE__ == $0 ... end). * Changed license (LGPL -> Ruby's). Index: sptr.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/sptr.rb,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** sptr.rb 28 Jan 2006 06:40:38 -0000 1.30 --- sptr.rb 14 Apr 2006 05:52:28 -0000 1.31 *************** *** 2,7 **** # = bio/db/embl/sptr.rb - UniProt/SwissProt and TrEMBL database class # ! # Copyright:: Copyright (C) 2001-2005 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,7 ---- # = bio/db/embl/sptr.rb - UniProt/SwissProt and TrEMBL database class # ! # Copyright:: Copyright (C) 2001-2006 Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 32,53 **** # http://www.expasy.org/sprot/userman.html # ! #-- ! # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! # ! #++ ! # require 'bio/db' --- 32,36 ---- # http://www.expasy.org/sprot/userman.html # ! require 'bio/db' *************** *** 760,841 **** - if __FILE__ == $0 - # Usage: ruby __FILE__ uniprot_sprot.dat - # Usage: ruby __FILE__ uniprot_sprot.dat | egrep '^RuntimeError' - - begin - require 'pp' - alias pp p - rescue LoadError - end - - def cmd(cmd, tag = nil, ent = $ent) - puts " ==> #{cmd} " - puts Bio::SPTR.new(ent).get(tag) if tag - begin - p eval(cmd) - rescue RuntimeError - puts "RuntimeError(#{Bio::SPTR.new($ent).entry_id})}: #{$!} " - end - puts - end - - - while $ent = $<.gets(Bio::SPTR::RS) - - cmd "Bio::SPTR.new($ent).entry_id" - - cmd "Bio::SPTR.new($ent).id_line", 'ID' - cmd "Bio::SPTR.new($ent).entry" - cmd "Bio::SPTR.new($ent).entry_name" - cmd "Bio::SPTR.new($ent).molecule" - cmd "Bio::SPTR.new($ent).sequence_length" - - cmd "Bio::SPTR.new($ent).ac", 'AC' - cmd "Bio::SPTR.new($ent).accession" - - - cmd "Bio::SPTR.new($ent).gn", 'GN' - cmd "Bio::SPTR.new($ent).gene_name" - cmd "Bio::SPTR.new($ent).gene_names" - - cmd "Bio::SPTR.new($ent).dt", "DT" - ['created','annotation','sequence'].each do |key| - cmd "Bio::SPTR.new($ent).dt('#{key}')" - end - - cmd "Bio::SPTR.new($ent).de", 'DE' - cmd "Bio::SPTR.new($ent).definition" - cmd "Bio::SPTR.new($ent).protein_name" - cmd "Bio::SPTR.new($ent).synonyms" - - cmd "Bio::SPTR.new($ent).kw", 'KW' - - cmd "Bio::SPTR.new($ent).os", 'OS' - - cmd "Bio::SPTR.new($ent).oc", 'OC' - - cmd "Bio::SPTR.new($ent).og", 'OG' - - cmd "Bio::SPTR.new($ent).ox", 'OX' - - cmd "Bio::SPTR.new($ent).ref", 'R' - - cmd "Bio::SPTR.new($ent).cc", 'CC' - cmd "Bio::SPTR.new($ent).cc('ALTERNATIVE PRODUCTS')" - cmd "Bio::SPTR.new($ent).cc('DATABASE')" - cmd "Bio::SPTR.new($ent).cc('MASS SPECTOMETRY')" - - cmd "Bio::SPTR.new($ent).dr", 'DR' - - cmd "Bio::SPTR.new($ent).ft", 'FT' - cmd "Bio::SPTR.new($ent).ft['DOMAIN']" - - cmd "Bio::SPTR.new($ent).sq", "SQ" - cmd "Bio::SPTR.new($ent).seq" - end - - end - =begin --- 743,746 ---- From nakao at dev.open-bio.org Fri Apr 14 05:04:22 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 05:04:22 -0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl common.rb,1.9,1.10 Message-ID: <200604140604.k3E64BXK009760@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv9740 Modified Files: common.rb Log Message: * Changed license (LGPL -> Ruby's). Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/common.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** common.rb 28 Jan 2006 06:40:38 -0000 1.9 --- common.rb 14 Apr 2006 06:04:09 -0000 1.10 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2001-2005 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2001-2005 Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 70,91 **** # http://www.expasy.org/sprot/userman.html # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ - # require 'bio/db' --- 70,73 ---- From nakao at dev.open-bio.org Fri Apr 14 05:28:29 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 05:28:29 -0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io ensembl.rb,NONE,1.1 Message-ID: <200604140628.k3E6SBGn009942@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv9920/d/d/d Added Files: ensembl.rb Log Message: * ensembl.rb) newly added. * test_ensembl.rb) newly added. --- NEW FILE: ensembl.rb --- # # = bio/io/ensembl.rb - An Ensembl Genome Browser client. # # Copyright:: Copyright (C) 2006 # Mitsuteru C. Nakao # License:: Ruby's # # $Id: ensembl.rb,v 1.1 2006/04/14 06:28:09 nakao Exp $ # # == Description # # Client classes for Ensembl Genome Browser. # # == Examples # # seq = Bio::Ensembl::Human.exportview(1, 1000, 100000) # gff = Bio::Ensembl::Human.exportview(1, 1000, 100000, ['gene']) # # seq = Bio::Ensembl::Mouse.exportview(1, 1000, 100000) # gff = Bio::Ensembl::Mouse.exportview(1, 1000, 100000, ['gene', 'variation', 'genscan']) # # # == References # # * Ensembl # http:/www.ensembl.org/ # require 'bio' require 'cgi' module Bio # == Description # # An Ensembl Genome Browser client class. # # == Examples # # seq = Bio::Ensembl::Human.exportview(1, 1000, 100000) # gff = Bio::Ensembl::Human.exportview(1, 1000, 100000, ['gene']) # # seq = Bio::Ensembl::Mouse.exportview(1, 1000, 100000) # gff = Bio::Ensembl::Mouse.exportview(1, 1000, 100000, ['gene', 'variation', 'genscan']) # # == References # # * Ensembl # http:/www.ensembl.org/ # class Ensembl # Hostname of Ensembl Genome Browser. ServerName = 'www.ensembl.org' # Ensembl Genome Browser Client Super Class # # == Examples # # module Bio # class Ensembl::Kumamushi < Base # Organism = 'Milnesium_tardigradum' # end # end # fna = Bio::Ensembl::Kumamushi.exportview(1, 1000, 20000) # class Base # Ensembl ExportView Client. # # Retrieve genomic sequence/features from Ensembl ExportView in plain text. # Ensembl ExportView exports genomic data (sequence and features) in # several file formats including fasta, GFF and tab. # # * ExportViwe (http://www.ensembl.org/Homo_sapiens/exportview). # # == Examples # # # Genomic sequence in Fasta format # Bio::Ensembl::Human.exportview(:seq_region_name => 1, :anchor1 => 1149206, :anchor2 => 1149229) # Bio::Ensembl::Human.exportview(1, 1149206, 1149229) # # # Feature in GFF # Bio::Ensembl::Human.exportview(:seq_region_name => 1, :anchor1 => 1149206, :anchor2 => 1150000, # :options => ['similarity', 'repeat', 'genscan', 'variation', 'gene']) # Bio::Ensembl::Human.exportview(1, 1149206, 1150000, ['variation', 'gene']) # # == Arguments # # Bio::Ensembl::Base#exportview method allow both orderd arguments and # named arguments. # Note: mandatory arguments marked '*'. # # === Orderd Arguments # # 1. seq_region_name - Chromosome number (*) # 2. anchor1 - From coordination (*) # 3. anchor2 - To coordination (*) # 4. options - Features to export (in :format => 'gff' or 'tab') # ['similarity', 'repeat', 'genscan', 'variation', 'gene'] # # === Named Arguments # # * :seq_region_name - Chromosome number (*) # * :anchor1 - From coordination (*) # * :anchor2 - To coordination (*) # * :type1 - From coordination type ['bp', ] # * :type2 - To coordination type ['bp', ] # * :upstream - Bp upstream # * :downstream - Bp downstream # * :format - File format ['fasta', 'gff', 'tab'] # * :options - Features to export (for :format => 'gff' or 'tab') # ['similarity', 'repeat', 'genscan', 'variation', 'gene'] # def self.exportview(*args) cgi = Client.new('exportview', self::Organism) if args.first.class == Hash then opts = args.first else opts = {:seq_region_name => args[0], :anchor1 => args[1], :anchor2 => args[2]} case args.size when 3 then opts.update({:format => 'fasta'}) when 4 then opts.update({:format => 'gff', :options => args[3]}) ; end end @hash = {:type1 => 'bp', :type2 => 'bp', :downstream => '', :upstream => '', :format => 'fasta', :options => [], :action => 'export', :_format => 'Text', :output => 'txt', :submit => 'Continue >>'} cgi.exec(@hash.update(opts)) end # An Ensembl CGI client class # # === Examples # # cgi = Client('martview', 'Homo_sapiens') # cgi.exec(hash_data) # class Client < PSORT::CGIDriver def initialize(cgi_name, genome_name) super(Ensembl::ServerName, ['', genome_name, cgi_name].join('/')) end private def make_args(query) @args = {} query.each { |k, v| @args[k.to_s] = v } nested_args_join(query) end def nested_args_join(hash) tmp = [] hash.each do |key, value| if value.class == Array then value.each { |val| tmp << [key, val] } else tmp << [key, value] end end tmp.map {|x| x.map {|x| CGI.escape(x.to_s) }.join("=") }.join('&') end def parse_report(result_body) result_body end end # class Client end # class Base # Ensembl Human Genome # # See Bio::Ensembl::Base class. # class Human < Base Organism = 'Homo_sapiens' end # class Human # Ensembl Mouse Genome # # See Bio::Ensembl::Base class. # class Mouse < Base Organism = 'Mus_musculus' end # class Mouse end # class Ensembl end # module Bio From nakao at dev.open-bio.org Fri Apr 14 05:28:42 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 05:28:42 -0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/io test_ensembl.rb,NONE,1.1 Message-ID: <200604140628.k3E6SBo7009947@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/io In directory dev.open-bio.org:/tmp/cvs-serv9920/test/unit/bio/io Added Files: test_ensembl.rb Log Message: * ensembl.rb) newly added. * test_ensembl.rb) newly added. --- NEW FILE: test_ensembl.rb --- # # = test/unit/bio/io/test_ensembl.rb - Unit test for Bio::Ensembl. # # Copyright:: Copyright (C) 2006 # Mitsuteru C. Nakao # License:: Ruby's # # $Id: test_ensembl.rb,v 1.1 2006/04/14 06:28:09 nakao Exp $ # require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 4, 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/io/ensembl' class TestEnsembl < Test::Unit::TestCase def test_server_name assert_equal('www.ensembl.org', Bio::Ensembl::ServerName) end end class TestEnsemblBase < Test::Unit::TestCase def test_exportview end end class TestEnsemblBaseClient < Test::Unit::TestCase def test_class assert_equal(Bio::PSORT::CGIDriver, Bio::Ensembl::Base::Client.superclass) end end class TestEnsemblHuman < Test::Unit::TestCase def test_organism assert_equal("Homo_sapiens", Bio::Ensembl::Human::Organism) end end class TestEnsemblMouse < Test::Unit::TestCase def test_organism assert_equal("Mus_musculus", Bio::Ensembl::Mouse::Organism) end end From nakao at dev.open-bio.org Fri Apr 14 05:33:32 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Fri, 14 Apr 2006 05:33:32 -0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.50,1.51 Message-ID: <200604140633.k3E6XL90010004@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv9984 Modified Files: ChangeLog Log Message: * Bio::Ensembl first commit. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** ChangeLog 27 Feb 2006 11:38:14 -0000 1.50 --- ChangeLog 14 Apr 2006 06:33:19 -0000 1.51 *************** *** 1,2 **** --- 1,10 ---- + 2006-04-14 Mitsuteru Nakao + + * lib/bio/io/ensembl.rb + + Bio::Ensembl first commit. It is a client class for Ensembl Genome + Browser. + + 2006-02-27 Toshiaki Katayama From ngoto at dev.open-bio.org Wed Apr 26 12:04:15 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Wed, 26 Apr 2006 12:04:15 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.5,1.6 Message-ID: <200604261204.k3QC4FZN032162@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv32140/lib/bio Modified Files: command.rb Log Message: Experimentally added Bio::Command::NetTools.net_http_start() method. Note that it would be removed or the method name would be changed. Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** command.rb 28 Mar 2006 14:00:48 -0000 1.5 --- command.rb 26 Apr 2006 12:04:13 -0000 1.6 *************** *** 13,16 **** --- 13,17 ---- require 'uri' require 'open-uri' + require 'net/http' module Bio *************** *** 162,165 **** --- 163,190 ---- OpenURI.open_uri(uri).read end + + # Same as: + # uri = URI.parse(uri); Net::HTTP.start(uri.host, uri.port) + # and + # it uses proxy if an environment variable (same as OpenURI.open_uri) + # is set. + # uri must be a string or a URI object. + def self.net_http_start(uri, &block) + unless uri.kind_of?(URI::Generic) + uri = URI.parse(uri) + end + if uri.scheme != 'http' then + raise "only http is supported: #{uri.inspect}" + end + # Note: URI#find_proxy is an unofficial method defined in open-uri.rb. + # If the spec of open-uri.rb would be changed, we should change below. + if proxyuri = uri.find_proxy then + raise 'Non-HTTP proxy' if proxyuri.class != URI::HTTP + http = Net::HTTP.Proxy(proxyuri.host, proxyuri.port) + else + http = Net::HTTP + end + http.start(uri.host, uri.port, &block) + end end #module NetTools From ngoto at dev.open-bio.org Thu Apr 27 02:33:45 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Thu, 27 Apr 2006 02:33:45 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.6,1.7 Message-ID: <200604270233.k3R2XjuZ002237@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv2217/lib/bio Modified Files: command.rb Log Message: changed spec of Bio::Command::NetTools.net_http_start() Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** command.rb 26 Apr 2006 12:04:13 -0000 1.6 --- command.rb 27 Apr 2006 02:33:43 -0000 1.7 *************** *** 165,180 **** # Same as: ! # uri = URI.parse(uri); Net::HTTP.start(uri.host, uri.port) # and # it uses proxy if an environment variable (same as OpenURI.open_uri) # is set. ! # uri must be a string or a URI object. ! def self.net_http_start(uri, &block) ! unless uri.kind_of?(URI::Generic) ! uri = URI.parse(uri) ! end ! if uri.scheme != 'http' then ! raise "only http is supported: #{uri.inspect}" ! end # Note: URI#find_proxy is an unofficial method defined in open-uri.rb. # If the spec of open-uri.rb would be changed, we should change below. --- 165,175 ---- # Same as: ! # Net::HTTP.start(address, port) # and # it uses proxy if an environment variable (same as OpenURI.open_uri) # is set. ! # ! def self.net_http_start(address, port = 80, &block) ! uri = URI.parse("http://#{address}:#{port}") # Note: URI#find_proxy is an unofficial method defined in open-uri.rb. # If the spec of open-uri.rb would be changed, we should change below. *************** *** 185,189 **** http = Net::HTTP end ! http.start(uri.host, uri.port, &block) end end #module NetTools --- 180,184 ---- http = Net::HTTP end ! http.start(address, port, &block) end end #module NetTools From ngoto at dev.open-bio.org Thu Apr 27 03:15:29 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Thu, 27 Apr 2006 03:15:29 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.7,1.8 Message-ID: <200604270315.k3R3FTmK002447@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv2392/lib/bio Modified Files: command.rb Log Message: Bio::Command::NetTools can be included in classes. Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** command.rb 27 Apr 2006 02:33:43 -0000 1.7 --- command.rb 27 Apr 2006 03:15:27 -0000 1.8 *************** *** 160,166 **** # Same as OpenURI.open_uri(uri).read. ! def self.read_uri(uri) OpenURI.open_uri(uri).read end # Same as: --- 160,167 ---- # Same as OpenURI.open_uri(uri).read. ! def read_uri(uri) OpenURI.open_uri(uri).read end + module_function :read_uri # Same as: *************** *** 170,174 **** # is set. # ! def self.net_http_start(address, port = 80, &block) uri = URI.parse("http://#{address}:#{port}") # Note: URI#find_proxy is an unofficial method defined in open-uri.rb. --- 171,175 ---- # is set. # ! def net_http_start(address, port = 80, &block) uri = URI.parse("http://#{address}:#{port}") # Note: URI#find_proxy is an unofficial method defined in open-uri.rb. *************** *** 182,185 **** --- 183,188 ---- http.start(address, port, &block) end + module_function :net_http_start + end #module NetTools From nakao at dev.open-bio.org Thu Apr 27 05:38:52 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Thu, 27 Apr 2006 05:38:52 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/io test_ensembl.rb,1.1,1.2 Message-ID: <200604270538.k3R5cqVL002709@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/io In directory dev.open-bio.org:/tmp/cvs-serv2667/test/unit/bio/io Modified Files: test_ensembl.rb Log Message: * ensembl.rb: Use Bio::Command::NetTools.net_http_start for proxy server. * ensembl.rb: Added Ensembl.server_uri method. Index: test_ensembl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/test/unit/bio/io/test_ensembl.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_ensembl.rb 14 Apr 2006 06:28:09 -0000 1.1 --- test_ensembl.rb 27 Apr 2006 05:38:50 -0000 1.2 *************** *** 19,25 **** class TestEnsembl < Test::Unit::TestCase def test_server_name ! assert_equal('www.ensembl.org', Bio::Ensembl::ServerName) end end --- 19,34 ---- class TestEnsembl < Test::Unit::TestCase def test_server_name ! assert_equal('http://www.ensembl.org', Bio::Ensembl::EBIServerURI) end + def test_server_uri + assert_equal('http://www.ensembl.org', Bio::Ensembl.server_uri) + end + + def test_set_server_uri + host = 'http://localhost' + Bio::Ensembl.server_uri(host) + assert_equal(host, Bio::Ensembl.server_uri) + end end *************** *** 32,36 **** class TestEnsemblBaseClient < Test::Unit::TestCase def test_class ! assert_equal(Bio::PSORT::CGIDriver, Bio::Ensembl::Base::Client.superclass) end end --- 41,45 ---- class TestEnsemblBaseClient < Test::Unit::TestCase def test_class ! end end From nakao at dev.open-bio.org Thu Apr 27 05:38:52 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Thu, 27 Apr 2006 05:38:52 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io ensembl.rb,1.1,1.2 Message-ID: <200604270538.k3R5cqbu002714@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv2667/lib/bio/io Modified Files: ensembl.rb Log Message: * ensembl.rb: Use Bio::Command::NetTools.net_http_start for proxy server. * ensembl.rb: Added Ensembl.server_uri method. Index: ensembl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/ensembl.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ensembl.rb 14 Apr 2006 06:28:09 -0000 1.1 --- ensembl.rb 27 Apr 2006 05:38:50 -0000 1.2 *************** *** 27,31 **** # ! require 'bio' require 'cgi' --- 27,32 ---- # ! require 'bio/command' ! require 'uri' require 'cgi' *************** *** 44,47 **** --- 45,54 ---- # gff = Bio::Ensembl::Mouse.exportview(1, 1000, 100000, ['gene', 'variation', 'genscan']) # + # Bio::Enesmbl.server_uri("http://www.gramene.org") + # class Rice < Base + # Organism = 'Oryza_sativa' + # end + # seq = Bio::Ensembl::Rice.exportview(1, 1000, 100000) + # # == References # *************** *** 49,56 **** # http:/www.ensembl.org/ # class Ensembl ! # Hostname of Ensembl Genome Browser. ! ServerName = 'www.ensembl.org' --- 56,86 ---- # http:/www.ensembl.org/ # + # * GRAMENE + # http://www.gramene.org/ + # class Ensembl ! # Hostname of the Ensembl Genome Browser. ! EBIServerURI = 'http://www.ensembl.org' ! ! # An Alternative Hostname for Ensembl Genome Browser. ! @@server_uri = nil ! ! # Sets and uses an alternative hostname for ensembl genome browser. ! # ! # == Example ! # ! # require 'bio' ! # p Bio::Enesmbl.server_uri #=> 'http://www.ensembl.org' ! # Bio::Enesmbl.server_uri("http://www.gramene.org") ! # p Bio::Enesmbl.server_uri #=> "http://www.gramene.org" ! # ! def self.server_uri(uri = nil) ! if uri ! @@server_uri = uri ! else ! @@server_uri || EBIServerURI ! end ! end *************** *** 79,89 **** # # # Genomic sequence in Fasta format ! # Bio::Ensembl::Human.exportview(:seq_region_name => 1, :anchor1 => 1149206, :anchor2 => 1149229) # Bio::Ensembl::Human.exportview(1, 1149206, 1149229) # # # Feature in GFF ! # Bio::Ensembl::Human.exportview(:seq_region_name => 1, :anchor1 => 1149206, :anchor2 => 1150000, ! # :options => ['similarity', 'repeat', 'genscan', 'variation', 'gene']) ! # Bio::Ensembl::Human.exportview(1, 1149206, 1150000, ['variation', 'gene']) # # == Arguments --- 109,124 ---- # # # Genomic sequence in Fasta format ! # Bio::Ensembl::Human.exportview(:seq_region_name => 1, ! # :anchor1 => 1149206, :anchor2 => 1149229) # Bio::Ensembl::Human.exportview(1, 1149206, 1149229) # # # Feature in GFF ! # Bio::Ensembl::Human.exportview(:seq_region_name => 1, ! # :anchor1 => 1149206, :anchor2 => 1150000, ! # :options => ['similarity', 'repeat', ! # 'genscan', 'variation', ! # 'gene']) ! # Bio::Ensembl::Human.exportview(1, 1149206, 1150000, ! # ['variation', 'gene']) # # == Arguments *************** *** 99,103 **** # 3. anchor2 - To coordination (*) # 4. options - Features to export (in :format => 'gff' or 'tab') ! # ['similarity', 'repeat', 'genscan', 'variation', 'gene'] # # === Named Arguments --- 134,139 ---- # 3. anchor2 - To coordination (*) # 4. options - Features to export (in :format => 'gff' or 'tab') ! # ['similarity', 'repeat', 'genscan', 'variation', ! # 'gene'] # # === Named Arguments *************** *** 112,128 **** # * :format - File format ['fasta', 'gff', 'tab'] # * :options - Features to export (for :format => 'gff' or 'tab') ! # ['similarity', 'repeat', 'genscan', 'variation', 'gene'] # def self.exportview(*args) - cgi = Client.new('exportview', self::Organism) - if args.first.class == Hash then opts = args.first else ! opts = {:seq_region_name => args[0], :anchor1 => args[1], :anchor2 => args[2]} case args.size ! when 3 then opts.update({:format => 'fasta'}) ! when 4 then opts.update({:format => 'gff', :options => args[3]}) ; end end ! @hash = {:type1 => 'bp', :type2 => 'bp', :downstream => '', --- 148,169 ---- # * :format - File format ['fasta', 'gff', 'tab'] # * :options - Features to export (for :format => 'gff' or 'tab') ! # ['similarity', 'repeat', 'genscan', 'variation', ! # 'gene'] # def self.exportview(*args) if args.first.class == Hash then opts = args.first else ! options = {:seq_region_name => args[0], ! :anchor1 => args[1], ! :anchor2 => args[2]} case args.size ! when 3 then ! options.update({:format => 'fasta'}) ! when 4 then ! options.update({:format => 'gff', :options => args[3]}) ! end end ! ! @data = {:type1 => 'bp', :type2 => 'bp', :downstream => '', *************** *** 130,169 **** :format => 'fasta', :options => [], ! :action => 'export', :_format => 'Text', :output => 'txt', :submit => 'Continue >>'} ! cgi.exec(@hash.update(opts)) end # An Ensembl CGI client class # # === Examples # ! # cgi = Client('martview', 'Homo_sapiens') ! # cgi.exec(hash_data) # ! class Client < PSORT::CGIDriver def initialize(cgi_name, genome_name) ! super(Ensembl::ServerName, ['', genome_name, cgi_name].join('/')) end ! private ! def make_args(query) ! @args = {} ! query.each { |k, v| @args[k.to_s] = v } ! nested_args_join(query) end ! def nested_args_join(hash) tmp = [] hash.each do |key, value| ! if value.class == Array then value.each { |val| tmp << [key, val] } else tmp << [key, value] end end ! tmp.map {|x| x.map {|x| CGI.escape(x.to_s) }.join("=") }.join('&') end - def parse_report(result_body) - result_body - end end # class Client --- 171,238 ---- :format => 'fasta', :options => [], ! :action => 'export', ! :_format => 'Text', ! :output => 'txt', ! :submit => 'Continue >>'} ! cgi = Client.new('exportview', self::Organism) ! cgi.exec(@data.update(options)) end + + # An Ensembl CGI client class + # + # Enable the use of HTTP access via a proxy by setting the proxy address up + # as the 'http_proxy' enviroment variable. # # === Examples # ! # cgi = Client.new('martview', 'Homo_sapiens') ! # result_body = cgi.exec(hash_data) # ! class Client ! ! # Sets cgi_name and genome_name. ! # ! # === Example ! # ! # cgi = Client.new('martview', 'Homo_sapiens') ! # def initialize(cgi_name, genome_name) ! @uri = URI.parse(Ensembl.server_uri) ! @path = ['', genome_name, cgi_name].join('/') end ! # Executes query with data. ! # ! # === Example ! # ! # result_body = cgi.exec(hash_data) ! # ! def exec(data_hash) ! data = make_args(data_hash) ! result = nil ! Bio::Command::NetTools.net_http_start(@uri.host, @uri.port) {|http| ! result, = http.post(@path, data) ! } ! result.body end ! private ! ! def make_args(hash) tmp = [] hash.each do |key, value| ! if value.class == Array then ! value.each { |val| tmp << [key, val] } ! else ! tmp << [key, value] ! end end ! tmp.map {|e| e.map {|x| CGI.escape(x.to_s) }.join("=") }.join('&') end end # class Client From ngoto at dev.open-bio.org Sun Apr 30 05:40:25 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:40:25 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/bl2seq report.rb,1.6,1.7 Message-ID: <200604300540.k3U5ePMf018074@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq In directory dev.open-bio.org:/tmp/cvs-serv18054 Modified Files: report.rb Log Message: changes license to Ruby's. Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/bl2seq/report.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** report.rb 18 Dec 2005 15:58:39 -0000 1.6 --- report.rb 30 Apr 2006 05:40:23 -0000 1.7 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2005 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2005 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 05:47:27 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:47:27 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast wublast.rb,1.6,1.7 Message-ID: <200604300547.k3U5lRRv018148@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv18107/blast Modified Files: wublast.rb Log Message: parse error (missing hits) for some hits of which database sequence names contain 'Score'. Index: wublast.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/wublast.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** wublast.rb 22 Feb 2006 08:46:15 -0000 1.6 --- wublast.rb 30 Apr 2006 05:47:25 -0000 1.7 *************** *** 281,285 **** r = data.first end ! if /^\s+Score/ =~ r then @hsps << HSP.new(data) else --- 281,285 ---- r = data.first end ! if /\A\s+Score/ =~ r then @hsps << HSP.new(data) else From ngoto at dev.open-bio.org Sun Apr 30 05:48:01 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:48:01 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast format0.rb,1.17,1.18 Message-ID: <200604300548.k3U5m18v018180@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv18160/blast Modified Files: format0.rb Log Message: parse error (missing hits) for some hits of which database sequence names contain 'Score'. Index: format0.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/format0.rb,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** format0.rb 22 Feb 2006 08:46:15 -0000 1.17 --- format0.rb 30 Apr 2006 05:47:59 -0000 1.18 *************** *** 781,785 **** @f0hitname = data.shift @hsps = [] ! while r = data[0] and /^\s+Score/ =~ r @hsps << HSP.new(data) end --- 781,785 ---- @f0hitname = data.shift @hsps = [] ! while r = data[0] and /\A\s+Score/ =~ r @hsps << HSP.new(data) end From ngoto at dev.open-bio.org Sun Apr 30 05:50:21 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:50:21 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl clustalw.rb, 1.10, 1.11 mafft.rb, 1.9, 1.10 sim4.rb, 1.5, 1.6 Message-ID: <200604300550.k3U5oLwo018302@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv18276 Modified Files: clustalw.rb mafft.rb sim4.rb Log Message: changed license to Ruby's Index: sim4.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sim4.rb,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sim4.rb 18 Dec 2005 15:58:40 -0000 1.5 --- sim4.rb 30 Apr 2006 05:50:19 -0000 1.6 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: Ruby's # # $Id$ Index: clustalw.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/clustalw.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** clustalw.rb 18 Dec 2005 15:58:40 -0000 1.10 --- clustalw.rb 30 Apr 2006 05:50:19 -0000 1.11 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: Ruby's # # $Id$ Index: mafft.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/mafft.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mafft.rb 18 Dec 2005 15:58:40 -0000 1.9 --- mafft.rb 30 Apr 2006 05:50:19 -0000 1.10 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 05:50:21 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:50:21 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/clustalw report.rb,1.9,1.10 Message-ID: <200604300550.k3U5oLJO018309@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/clustalw In directory dev.open-bio.org:/tmp/cvs-serv18276/clustalw Modified Files: report.rb Log Message: changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/clustalw/report.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** report.rb 18 Dec 2005 15:58:40 -0000 1.9 --- report.rb 30 Apr 2006 05:50:19 -0000 1.10 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 05:50:21 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:50:21 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/mafft report.rb,1.8,1.9 Message-ID: <200604300550.k3U5oLpH018314@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/mafft In directory dev.open-bio.org:/tmp/cvs-serv18276/mafft Modified Files: report.rb Log Message: changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/mafft/report.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** report.rb 18 Dec 2005 15:58:40 -0000 1.8 --- report.rb 30 Apr 2006 05:50:19 -0000 1.9 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 05:50:21 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:50:21 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/sim4 report.rb,1.7,1.8 Message-ID: <200604300550.k3U5oLFj018319@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/sim4 In directory dev.open-bio.org:/tmp/cvs-serv18276/sim4 Modified Files: report.rb Log Message: changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sim4/report.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** report.rb 18 Dec 2005 15:58:40 -0000 1.7 --- report.rb 30 Apr 2006 05:50:19 -0000 1.8 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: LGPL ! # ! #-- ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! #++ # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2004 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 05:56:42 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:56:42 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio alignment.rb,1.15,1.16 Message-ID: <200604300556.k3U5ugBr018426@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv18406 Modified Files: alignment.rb Log Message: changed license to Ruby's Index: alignment.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/alignment.rb,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** alignment.rb 24 Jan 2006 14:16:59 -0000 1.15 --- alignment.rb 30 Apr 2006 05:56:40 -0000 1.16 *************** *** 5,28 **** # GOTO Naohisa # ! # License:: LGPL # # $Id$ # - #-- - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - #++ - # # = About Bio::Alignment # --- 5,12 ---- # GOTO Naohisa # ! # License:: Ruby's # # $Id$ # # = About Bio::Alignment # From ngoto at dev.open-bio.org Sun Apr 30 05:57:42 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:57:42 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db fantom.rb,1.11,1.12 Message-ID: <200604300557.k3U5vgsw018500@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv18480/db Modified Files: fantom.rb Log Message: changed license to Ruby's Index: fantom.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/fantom.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** fantom.rb 26 Sep 2005 13:00:06 -0000 1.11 --- fantom.rb 30 Apr 2006 05:57:40 -0000 1.12 *************** *** 2,20 **** # bio/db/fantom.rb - RIKEN FANTOM2 database classes # ! # Copyright (C) 2003 GOTO Naohisa ! # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id$ --- 2,7 ---- # bio/db/fantom.rb - RIKEN FANTOM2 database classes # ! # Copyright:: Copyright (C) 2003 GOTO Naohisa ! # License:: Ruby's # # $Id$ From ngoto at dev.open-bio.org Sun Apr 30 05:58:52 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Sun, 30 Apr 2006 05:58:52 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io/flatfile bdb.rb,1.8,1.9 Message-ID: <200604300558.k3U5wqaF018532@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io/flatfile In directory dev.open-bio.org:/tmp/cvs-serv18512/io/flatfile Modified Files: bdb.rb Log Message: changed license to Ruby's Index: bdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/flatfile/bdb.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bdb.rb 26 Sep 2005 13:00:08 -0000 1.8 --- bdb.rb 30 Apr 2006 05:58:50 -0000 1.9 *************** *** 2,20 **** # bio/io/flatfile/bdb.rb - OBDA flatfile index by Berkley DB # ! # Copyright (C) 2002 GOTO Naohisa ! # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. ! # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id$ --- 2,7 ---- # bio/io/flatfile/bdb.rb - OBDA flatfile index by Berkley DB # ! # Copyright:: Copyright (C) 2002 GOTO Naohisa ! # License:: Ruby's # # $Id$ From nakao at dev.open-bio.org Sun Apr 30 07:11:30 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:30 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blast xmlparser.rb,1.13,1.14 Message-ID: <200604300711.k3U7BUm3018668@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blast In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/appl/blast Modified Files: xmlparser.rb Log Message: * changed license to Ruby's Index: xmlparser.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast/xmlparser.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** xmlparser.rb 8 Sep 2005 01:22:08 -0000 1.13 --- xmlparser.rb 30 Apr 2006 07:11:28 -0000 1.14 *************** *** 1,23 **** # ! # bio/appl/blast/xmlparser.rb - BLAST XML output (-m 7) parser by XMLParser # ! # Copyright (C) 2001 Mitsuteru C. Nakao ! # Copyright (C) 2003 KATAYAMA Toshiaki # ! # This library is free software; you can redistribute it and/or ! # modify it under the terms of the GNU Lesser General Public ! # License as published by the Free Software Foundation; either ! # version 2 of the License, or (at your option) any later version. # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ! # $Id$ # --- 1,31 ---- # ! # = bio/appl/blast/xmlparser.rb - BLAST XML output (-m 7) parser by XMLParser # ! # Copyright:: Copyright (C) 2001 ! # Mitsuteru C. Nakao ! # Copyright:: Copyright (C) 2003 ! # KATAYAMA Toshiaki ! # Lisence:: Ruby's # ! # $Id$ # ! # == Description ! # ! # A parser for blast XML report (format 7) based on the XMLParser. ! # This file is automatically loaded by bio/appl/blast/report.rb if ! # the XMLParser installed. # ! # BioRuby provides two implements of the paser for the blast XML format report ! # (format 7) based on the XMLParser and the REXML. # ! # == Examples ! # ! # == References ! # ! # * Blast ! # http:// ! # ! # * XMLParser ! # http:// # *************** *** 28,217 **** module Bio ! class Blast ! class Report ! private ! def xmlparser_parse(xml) ! parser = XMLParser.new ! def parser.default; end ! ! begin ! tag_stack = Array.new ! hash = Hash.new ! parser.parse(xml) do |type, name, data| ! #print "type=#{type.inspect} name=#{name.inspect} data=#{data.inspect}\n" # for DEBUG ! case type ! when XMLParser::START_ELEM ! tag_stack.push(name) ! hash.update(data) ! case name ! when 'Iteration' ! iteration = Iteration.new ! @iterations.push(iteration) ! when 'Hit' ! hit = Hit.new ! hit.query_id = @query_id ! hit.query_def = @query_def ! hit.query_len = @query_len ! @iterations.last.hits.push(hit) ! when 'Hsp' ! hsp = Hsp.new ! @iterations.last.hits.last.hsps.push(hsp) ! end ! when XMLParser::END_ELEM ! case name ! when /^BlastOutput/ ! xmlparser_parse_program(name,hash) ! hash = Hash.new ! when /^Parameters$/ ! xmlparser_parse_parameters(hash) ! hash = Hash.new ! when /^Iteration/ ! xmlparser_parse_iteration(name, hash) ! hash = Hash.new ! when /^Hit/ ! xmlparser_parse_hit(name, hash) ! hash = Hash.new ! when /^Hsp$/ ! xmlparser_parse_hsp(hash) ! hash = Hash.new ! when /^Statistics$/ ! xmlparser_parse_statistics(hash) ! hash = Hash.new ! end ! tag_stack.pop ! when XMLParser::CDATA ! if hash[tag_stack.last].nil? ! hash[tag_stack.last] = data unless data.strip.empty? ! else ! hash[tag_stack.last].concat(data) if data ! end ! when XMLParser::PI end end - rescue XMLParserError - line = parser.line - column = parser.column - print "Parse error at #{line}(#{column}) : #{$!}\n" end end ! def xmlparser_parse_program(tag, hash) ! case tag ! when 'BlastOutput_program' ! @program = hash[tag] ! when 'BlastOutput_version' ! @version = hash[tag] ! when 'BlastOutput_reference' ! @reference = hash[tag] ! when 'BlastOutput_db' ! @db = hash[tag].strip ! when 'BlastOutput_query-ID' ! @query_id = hash[tag] ! when 'BlastOutput_query-def' ! @query_def = hash[tag] ! when 'BlastOutput_query-len' ! @query_len = hash[tag].to_i ! end end ! def xmlparser_parse_parameters(hash) ! labels = { ! 'matrix' => 'Parameters_matrix', ! 'expect' => 'Parameters_expect', ! 'include' => 'Parameters_include', ! 'sc-match' => 'Parameters_sc-match', ! 'sc-mismatch' => 'Parameters_sc-mismatch', ! 'gap-open' => 'Parameters_gap-open', ! 'gap-extend' => 'Parameters_gap-extend', ! 'filter' => 'Parameters_filter', ! 'pattern' => 'Parameters_pattern', ! 'entrez-query'=> 'Parameters_entrez-query', ! } ! labels.each do |k,v| ! case k ! when 'filter', 'matrix' ! @parameters[k] = hash[v].to_s ! else ! @parameters[k] = hash[v].to_i ! end end end ! def xmlparser_parse_iteration(tag, hash) ! case tag ! when 'Iteration_iter-num' ! @iterations.last.num = hash[tag].to_i ! when 'Iteration_message' ! @iterations.last.message = hash[tag].to_s ! end end ! def xmlparser_parse_hit(tag, hash) ! hit = @iterations.last.hits.last ! case tag ! when 'Hit_num' ! hit.num = hash[tag].to_i ! when 'Hit_id' ! hit.hit_id = hash[tag].clone ! when 'Hit_def' ! hit.definition = hash[tag].clone ! when 'Hit_accession' ! hit.accession = hash[tag].clone ! when 'Hit_len' ! hit.len = hash[tag].clone.to_i ! end end ! def xmlparser_parse_hsp(hash) ! hsp = @iterations.last.hits.last.hsps.last ! hsp.num = hash['Hsp_num'].to_i ! hsp.bit_score = hash['Hsp_bit-score'].to_f ! hsp.score = hash['Hsp_score'].to_i ! hsp.evalue = hash['Hsp_evalue'].to_f ! hsp.query_from = hash['Hsp_query-from'].to_i ! hsp.query_to = hash['Hsp_query-to'].to_i ! hsp.hit_from = hash['Hsp_hit-from'].to_i ! hsp.hit_to = hash['Hsp_hit-to'].to_i ! hsp.pattern_from = hash['Hsp_pattern-from'].to_i ! hsp.pattern_to = hash['Hsp_pattern-to'].to_i ! hsp.query_frame = hash['Hsp_query-frame'].to_i ! hsp.hit_frame = hash['Hsp_hit-frame'].to_i ! hsp.identity = hash['Hsp_identity'].to_i ! hsp.positive = hash['Hsp_positive'].to_i ! hsp.gaps = hash['Hsp_gaps'].to_i ! hsp.align_len = hash['Hsp_align-len'].to_i ! hsp.density = hash['Hsp_density'].to_i ! hsp.qseq = hash['Hsp_qseq'] ! hsp.hseq = hash['Hsp_hseq'] ! hsp.midline = hash['Hsp_midline'] ! end ! def xmlparser_parse_statistics(hash) ! labels = { ! 'db-num' => 'Statistics_db-num', ! 'db-len' => 'Statistics_db-len', ! 'hsp-len' => 'Statistics_hsp-len', ! 'eff-space' => 'Statistics_eff-space', ! 'kappa' => 'Statistics_kappa', ! 'lambda' => 'Statistics_lambda', ! 'entropy' => 'Statistics_entropy' ! } ! labels.each do |k,v| ! case k ! when 'db-num', 'db-len', 'hsp-len' ! @iterations.last.statistics[k] = hash[v].to_i ! else ! @iterations.last.statistics[k] = hash[v].to_f ! end end end - end ! end ! end --- 36,224 ---- module Bio ! class Blast ! class Report ! private ! def xmlparser_parse(xml) ! parser = XMLParser.new ! def parser.default; end ! ! begin ! tag_stack = Array.new ! hash = Hash.new ! parser.parse(xml) do |type, name, data| ! case type ! when XMLParser::START_ELEM ! tag_stack.push(name) ! hash.update(data) ! case name ! when 'Iteration' ! iteration = Iteration.new ! @iterations.push(iteration) ! when 'Hit' ! hit = Hit.new ! hit.query_id = @query_id ! hit.query_def = @query_def ! hit.query_len = @query_len ! @iterations.last.hits.push(hit) ! when 'Hsp' ! hsp = Hsp.new ! @iterations.last.hits.last.hsps.push(hsp) end + when XMLParser::END_ELEM + case name + when /^BlastOutput/ + xmlparser_parse_program(name,hash) + hash = Hash.new + when /^Parameters$/ + xmlparser_parse_parameters(hash) + hash = Hash.new + when /^Iteration/ + xmlparser_parse_iteration(name, hash) + hash = Hash.new + when /^Hit/ + xmlparser_parse_hit(name, hash) + hash = Hash.new + when /^Hsp$/ + xmlparser_parse_hsp(hash) + hash = Hash.new + when /^Statistics$/ + xmlparser_parse_statistics(hash) + hash = Hash.new + end + tag_stack.pop + when XMLParser::CDATA + if hash[tag_stack.last].nil? + hash[tag_stack.last] = data unless data.strip.empty? + else + hash[tag_stack.last].concat(data) if data + end + when XMLParser::PI end end + rescue XMLParserError + line = parser.line + column = parser.column + print "Parse error at #{line}(#{column}) : #{$!}\n" end + end ! def xmlparser_parse_program(tag, hash) ! case tag ! when 'BlastOutput_program' ! @program = hash[tag] ! when 'BlastOutput_version' ! @version = hash[tag] ! when 'BlastOutput_reference' ! @reference = hash[tag] ! when 'BlastOutput_db' ! @db = hash[tag].strip ! when 'BlastOutput_query-ID' ! @query_id = hash[tag] ! when 'BlastOutput_query-def' ! @query_def = hash[tag] ! when 'BlastOutput_query-len' ! @query_len = hash[tag].to_i end + end ! def xmlparser_parse_parameters(hash) ! labels = { ! 'matrix' => 'Parameters_matrix', ! 'expect' => 'Parameters_expect', ! 'include' => 'Parameters_include', ! 'sc-match' => 'Parameters_sc-match', ! 'sc-mismatch' => 'Parameters_sc-mismatch', ! 'gap-open' => 'Parameters_gap-open', ! 'gap-extend' => 'Parameters_gap-extend', ! 'filter' => 'Parameters_filter', ! 'pattern' => 'Parameters_pattern', ! 'entrez-query' => 'Parameters_entrez-query', ! } ! labels.each do |k,v| ! case k ! when 'filter', 'matrix' ! @parameters[k] = hash[v].to_s ! else ! @parameters[k] = hash[v].to_i end end + end ! def xmlparser_parse_iteration(tag, hash) ! case tag ! when 'Iteration_iter-num' ! @iterations.last.num = hash[tag].to_i ! when 'Iteration_message' ! @iterations.last.message = hash[tag].to_s end + end ! def xmlparser_parse_hit(tag, hash) ! hit = @iterations.last.hits.last ! case tag ! when 'Hit_num' ! hit.num = hash[tag].to_i ! when 'Hit_id' ! hit.hit_id = hash[tag].clone ! when 'Hit_def' ! hit.definition = hash[tag].clone ! when 'Hit_accession' ! hit.accession = hash[tag].clone ! when 'Hit_len' ! hit.len = hash[tag].clone.to_i end + end ! def xmlparser_parse_hsp(hash) ! hsp = @iterations.last.hits.last.hsps.last ! hsp.num = hash['Hsp_num'].to_i ! hsp.bit_score = hash['Hsp_bit-score'].to_f ! hsp.score = hash['Hsp_score'].to_i ! hsp.evalue = hash['Hsp_evalue'].to_f ! hsp.query_from = hash['Hsp_query-from'].to_i ! hsp.query_to = hash['Hsp_query-to'].to_i ! hsp.hit_from = hash['Hsp_hit-from'].to_i ! hsp.hit_to = hash['Hsp_hit-to'].to_i ! hsp.pattern_from = hash['Hsp_pattern-from'].to_i ! hsp.pattern_to = hash['Hsp_pattern-to'].to_i ! hsp.query_frame = hash['Hsp_query-frame'].to_i ! hsp.hit_frame = hash['Hsp_hit-frame'].to_i ! hsp.identity = hash['Hsp_identity'].to_i ! hsp.positive = hash['Hsp_positive'].to_i ! hsp.gaps = hash['Hsp_gaps'].to_i ! hsp.align_len = hash['Hsp_align-len'].to_i ! hsp.density = hash['Hsp_density'].to_i ! hsp.qseq = hash['Hsp_qseq'] ! hsp.hseq = hash['Hsp_hseq'] ! hsp.midline = hash['Hsp_midline'] ! end ! def xmlparser_parse_statistics(hash) ! labels = { ! 'db-num' => 'Statistics_db-num', ! 'db-len' => 'Statistics_db-len', ! 'hsp-len' => 'Statistics_hsp-len', ! 'eff-space' => 'Statistics_eff-space', ! 'kappa' => 'Statistics_kappa', ! 'lambda' => 'Statistics_lambda', ! 'entropy' => 'Statistics_entropy' ! } ! labels.each do |k,v| ! case k ! when 'db-num', 'db-len', 'hsp-len' ! @iterations.last.statistics[k] = hash[v].to_i ! else ! @iterations.last.statistics[k] = hash[v].to_f end end end ! ! end # class Report ! end # class Blast ! end # module Bio From nakao at dev.open-bio.org Sun Apr 30 07:11:30 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:30 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/psort report.rb,1.12,1.13 Message-ID: <200604300711.k3U7BUtC018673@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/psort In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/appl/psort Modified Files: report.rb Log Message: * changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/psort/report.rb,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** report.rb 3 Nov 2005 10:50:58 -0000 1.12 --- report.rb 30 Apr 2006 07:11:28 -0000 1.13 *************** *** 2,7 **** # = bio/appl/psort/report.rb - PSORT systems report classes # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,8 ---- # = bio/appl/psort/report.rb - PSORT systems report classes # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 9,30 **** # == A Report classes for PSORT Systems # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - # ++ - # require 'bio/sequence' --- 10,13 ---- From nakao at dev.open-bio.org Sun Apr 30 07:11:31 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:31 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/targetp report.rb,1.7,1.8 Message-ID: <200604300711.k3U7BVlq018678@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/targetp In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/appl/targetp Modified Files: report.rb Log Message: * changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/targetp/report.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** report.rb 18 Dec 2005 15:58:41 -0000 1.7 --- report.rb 30 Apr 2006 07:11:28 -0000 1.8 *************** *** 2,7 **** # = bio/appl/targetp/report.rb - TargetP report class # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,8 ---- # = bio/appl/targetp/report.rb - TargetP report class # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 13,33 **** # == Example # == References - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ # --- 14,17 ---- From nakao at dev.open-bio.org Sun Apr 30 07:11:31 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:31 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/genscan report.rb,1.8,1.9 Message-ID: <200604300711.k3U7BVhB018688@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/genscan In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/appl/genscan Modified Files: report.rb Log Message: * changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/genscan/report.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** report.rb 18 Dec 2005 15:58:40 -0000 1.8 --- report.rb 30 Apr 2006 07:11:29 -0000 1.9 *************** *** 2,7 **** # = bio/appl/genscan/report.rb - Genscan report classes # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,8 ---- # = bio/appl/genscan/report.rb - Genscan report classes # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 11,35 **** # # == Example - # == References - # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! # ! # $Id$ ! # ! #++ # --- 12,17 ---- # # == Example # ! # == References # From nakao at dev.open-bio.org Sun Apr 30 07:11:31 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:31 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/tmhmm report.rb,1.6,1.7 Message-ID: <200604300711.k3U7BVdR018683@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/tmhmm In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/appl/tmhmm Modified Files: report.rb Log Message: * changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/tmhmm/report.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** report.rb 18 Dec 2005 15:58:41 -0000 1.6 --- report.rb 30 Apr 2006 07:11:29 -0000 1.7 *************** *** 2,7 **** # = bio/appl/tmhmm/report.rb - TMHMM report class # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,8 ---- # = bio/appl/tmhmm/report.rb - TMHMM report class # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 12,32 **** # == Example # == References - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ # --- 13,16 ---- From nakao at dev.open-bio.org Sun Apr 30 07:11:31 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:31 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl common.rb,1.10,1.11 Message-ID: <200604300711.k3U7BV2X018693@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/db/embl Modified Files: common.rb Log Message: * changed license to Ruby's Index: common.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/common.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** common.rb 14 Apr 2006 06:04:09 -0000 1.10 --- common.rb 30 Apr 2006 07:11:29 -0000 1.11 *************** *** 2,6 **** # = bio/db/embl.rb - Common methods for EMBL style database classes # ! # Copyright:: Copyright (C) 2001-2005 Mitsuteru C. Nakao # License:: Ruby's # --- 2,7 ---- # = bio/db/embl.rb - Common methods for EMBL style database classes # ! # Copyright:: Copyright (C) 2001-2006 ! # Mitsuteru C. Nakao # License:: Ruby's # From nakao at dev.open-bio.org Sun Apr 30 07:11:30 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:11:30 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db go.rb,1.9,1.10 Message-ID: <200604300711.k3U7BU1g018663@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv18631/lib/bio/db Modified Files: go.rb Log Message: * changed license to Ruby's Index: go.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/go.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** go.rb 31 Oct 2005 18:32:36 -0000 1.9 --- go.rb 30 Apr 2006 07:11:28 -0000 1.10 *************** *** 2,7 **** # = bio/db/go.rb - Classes for Gene Ontology # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: # # $Id$ --- 2,8 ---- # = bio/db/go.rb - Classes for Gene Ontology # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 12,32 **** # # == References - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ # --- 13,16 ---- From nakao at dev.open-bio.org Sun Apr 30 07:13:41 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:13:41 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/sosui report.rb,1.9,1.10 Message-ID: <200604300713.k3U7DfjR018777@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/sosui In directory dev.open-bio.org:/tmp/cvs-serv18750/lib/bio/appl/sosui Modified Files: report.rb Log Message: * changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/sosui/report.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** report.rb 18 Dec 2005 15:58:41 -0000 1.9 --- report.rb 30 Apr 2006 07:13:39 -0000 1.10 *************** *** 2,7 **** # = bio/appl/sosui/report.rb - SOSUI report class # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL # # $Id$ --- 2,8 ---- # = bio/appl/sosui/report.rb - SOSUI report class # ! # Copyright:: Copyright (C) 2003 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 10,31 **** # # == References - # * http://sosui.proteome.bio.tuat.ac.jp/sosui_submit.html - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. # ! # This library is distributed in the hope that it will be useful, ! # but WITHOUT ANY WARRANTY; without even the implied warranty of ! # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! # Lesser General Public License for more details. ! # ! # You should have received a copy of the GNU Lesser General Public ! # License along with this library; if not, write to the Free Software ! # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! # ! #++ # --- 11,16 ---- # # == References # ! # * http://sosui.proteome.bio.tuat.ac.jp/sosui_submit.html # From nakao at dev.open-bio.org Sun Apr 30 07:13:41 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Sun, 30 Apr 2006 07:13:41 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl psort.rb,1.8,1.9 Message-ID: <200604300713.k3U7Dfpp018772@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv18750/lib/bio/appl Modified Files: psort.rb Log Message: * changed license to Ruby's Index: psort.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/psort.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** psort.rb 1 Nov 2005 05:15:15 -0000 1.8 --- psort.rb 30 Apr 2006 07:13:39 -0000 1.9 *************** *** 1,8 **** # # = bio/appl/psort.rb - PSORT, protein sorting site prediction systems # ! # Copyright:: Copyright (C) 2003 Mitsuteru C. Nakao ! # License:: LGPL ! # # # $Id$ --- 1,10 ---- + module Bio + # # = bio/appl/psort.rb - PSORT, protein sorting site prediction systems # ! # Copyright:: Copyright (C) 2003-2006 ! # Mitsuteru C. Nakao ! # License:: Ruby's # # $Id$ *************** *** 25,59 **** # # - #-- - # - # This library is free software; you can redistribute it and/or - # modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 2 of the License, or (at your option) any later version. - # - # This library is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - # - #++ - # require 'bio/sequence' require 'bio/db/fasta' - require 'net/http' require 'cgi' ! module Bio ! ! ! ! class PSORT # a Hash for PSORT official hosts: # Key value (host) --- 27,40 ---- # # require 'bio/sequence' + require 'bio/command' require 'bio/db/fasta' require 'cgi' ! # class PSORT + # a Hash for PSORT official hosts: # Key value (host) *************** *** 62,78 **** # Okazaki psort.nibb.ac.jp # Peking srs.pku.edu.cn:8088 ! WWWServer = { ! 'IMSUT' => {'host' => 'psort.hgc.jp', #'psort.ims.u-tokyo.ac.jp', ! 'PSORT1' => '/cgi-bin/okumura.pl', ! 'PSORT2' => '/cgi-bin/runpsort.pl'}, ! 'Okazaki' => {'host' => 'psort.nibb.ac.jp', ! 'PSORT1' => '/cgi-bin/okumura.pl', ! 'PSORT2' => '/cgi-bin/runpsort.pl'}, ! 'Peking' => {'host' => 'srs.pku.edu.en:8088', ! 'PSORT1' => '/cgi-bin/okumura.pl', ! 'PSORT2' => '/cgi-bin/runpsort.pl'} } - # = Generic CGI client class # A generic CGI client class for Bio::PSORT::* classes. --- 43,58 ---- # Okazaki psort.nibb.ac.jp # Peking srs.pku.edu.cn:8088 ! ServerURI = { ! :IMSUT => { ! :PSORT1 => URI.parse("http://psort.hgc.jp/cgi-bin/okumura.pl"), ! :PSORT2 => URI.parse("http://psort.hgc.jp/cgi-bin/runpsort.pl") }, ! :Okazaki => { ! :PSORT1 => URI.parse("http://psort.nibb.ac.jp/cgi-bin/okumura.pl"), ! :PSORT2 => URI.parse("http://psort.nibb.ac.jp/cgi-bin/runpsort.pl") }, ! :Peking => { ! :PSORT1 => URI.parse("http:///src.pku.edu.cn:8088/cgi-bin/okumura.pl"), ! :PSORT2 => URI.parse("http://src.pku.edu.cn:8088/cgi-bin/runpsort.pl") }, } # = Generic CGI client class # A generic CGI client class for Bio::PSORT::* classes. *************** *** 104,113 **** ! # Sets remote ``host'' and cgi ``path''. ! def initialize(host = '', path = '') ! @host = host ! @path = path @args = {} ! @report end --- 84,107 ---- ! # Sets remote host name and cgi path or uri. ! # ! # == Examples ! # ! # CGIDriver.new("localhost", "/cgi-bin/psort_www.pl") ! # ! # CGIDriver.new("http://localhost/cgi-bin/psort_www.pl") ! # ! # CGIDriver.new(URI.parse("http://localhost/cgi-bin/psort_www.pl")) ! # ! def initialize(host = '', path = '') ! case host.to_s ! when /^http:/ ! uri = host.to_s ! else ! uri = 'http://' + host + '/' + path ! end ! @uri = URI.parse(uri) @args = {} ! @report = '' end *************** *** 118,122 **** begin ! result, = Net::HTTP.new(@host).post(@path, data) @report = result.body output = parse_report(@report) --- 112,119 ---- begin ! result = nil ! Bio::Command::NetTools.net_http_start(@uri.host) {|http| ! result, = http.post(@uri.path, data) ! } @report = result.body output = parse_report(@report) *************** *** 140,144 **** # Erases HTML tags def erase_html_tags(str) ! return str.gsub(/<\S.*?>/,'') end --- 137,141 ---- # Erases HTML tags def erase_html_tags(str) ! return str.gsub(/<\S.*?>/, '') end *************** *** 149,153 **** tmp << CGI.escape(key.to_s) + '=' + CGI.escape(val.to_s) end ! return tmp.join(delim) # not ';' but '&' in psort's cgi end --- 146,150 ---- tmp << CGI.escape(key.to_s) + '=' + CGI.escape(val.to_s) end ! return tmp.join(delim) # not ';' but '&' in the psort cgi script. end *************** *** 157,160 **** --- 154,158 ---- # = Bio::PSORT::PSORT1 + # # Bio::PSORT::PSORT1 is a wapper class for the original PSORT program. # *************** *** 169,175 **** --- 167,175 ---- # # == References + # # 1. Nakai, K. and Kanehisa, M., A knowledge base for predicting protein # localization sites in eukaryotic cells, Genomics 14, 897-911 (1992). # [PMID:1478671] + # class PSORT1 *************** *** 179,184 **** # connecting to the IMSUT server. def self.imsut ! self.new(Remote.new(WWWServer['IMSUT']['host'], ! WWWServer['IMSUT']['PSORT1'])) end --- 179,183 ---- # connecting to the IMSUT server. def self.imsut ! self.new(Remote.new(ServerURI[:IMSUT][:PSORT1])) end *************** *** 187,192 **** # connecting to the NIBB server. def self.okazaki ! self.new(Remote.new(WWWServer['Okazaki']['host'], ! WWWServer['Okazaki']['PSORT1'])) end --- 186,190 ---- # connecting to the NIBB server. def self.okazaki ! self.new(Remote.new(ServerURI[:Okazaki][:PSORT1])) end *************** *** 195,209 **** # connecting to the Peking server. def self.peking ! self.new(Remote.new(WWWServer['Peking']['host'], ! WWWServer['Peking']['PSORT1'])) end ! # Sets a server CGI Driver (Bio::PSORT::PSORT1::Remote). ! def initialize(driver, origin = 'yeast') ! @serv = driver ! @origin = origin # Gram-positive bacterium, Gram-negative bacterium, ! # yeast, aminal, plant ! @title = 'MYSEQ' @sequence = '' end --- 193,207 ---- # connecting to the Peking server. def self.peking ! self.new(Remote.new(ServerURI[:Peking][:PSORT1])) end ! # Sets a cgi client (Bio::PSORT::PSORT1::Remote). ! # ! def initialize(driver, origin = 'yeast', title = 'MYSEQ') ! @serv = driver ! @origin = origin # Gram-positive bacterium, Gram-negative bacterium, ! # yeast, aminal, plant ! @title = title @sequence = '' end *************** *** 237,243 **** def exec(faa, parsing = true) if faa.class == Bio::FastaFormat ! @title = faa.entry_id if @title == 'MYSEQ' ! @sequence = faa.seq ! @serv.args = {'title' => @title, 'origin' => @origin} @serv.parsing = parsing return @serv.exec(sequence) --- 235,241 ---- def exec(faa, parsing = true) if faa.class == Bio::FastaFormat ! @title = faa.entry_id if @title == 'MYSEQ' ! @sequence = faa.seq ! @serv.args = {'title' => @title, 'origin' => @origin} @serv.parsing = parsing return @serv.exec(sequence) *************** *** 268,274 **** # Sets remote ``host'' and cgi ``path''. ! def initialize(host, path) ! @origin = 'yeast' ! @title = 'MYSEQ' @parsing = true super(host, path) --- 266,272 ---- # Sets remote ``host'' and cgi ``path''. ! def initialize(host, path = nil, title = 'MYSEQ', origin = 'yeast') ! @title = title ! @origin = origin @parsing = true super(host, path) *************** *** 327,331 **** # Okazaki psort.nibb.ac.jp /cgi-bin/runpsort.pl # Peking srs.pku.edu.cn:8088 /cgi-bin/runpsort.pl ! def self.remote(host, path) self.new(Remote.new(host, path)) end --- 325,329 ---- # Okazaki psort.nibb.ac.jp /cgi-bin/runpsort.pl # Peking srs.pku.edu.cn:8088 /cgi-bin/runpsort.pl ! def self.remote(host, path = nil) self.new(Remote.new(host, path)) end *************** *** 334,339 **** # connecting to the IMSUT server. def self.imsut ! self.remote(WWWServer['IMSUT']['host'], ! WWWServer['IMSUT']['PSORT2']) end --- 332,336 ---- # connecting to the IMSUT server. def self.imsut ! self.remote(ServerURI[:IMSUT][:PSORT2]) end *************** *** 341,346 **** # connecting to the NIBB server. def self.okazaki ! self.remote(WWWServer['Okazaki']['host'], ! WWWServer['Okazaki']['PSORT2']) end --- 338,342 ---- # connecting to the NIBB server. def self.okazaki ! self.remote(ServerURI[:Okazaki][:PSORT2]) end *************** *** 348,353 **** # connecting to the Peking server. def self.peking ! self.remote(WWWServer['Peking']['host'], ! WWWServer['Peking']['PSORT2']) end --- 344,348 ---- # connecting to the Peking server. def self.peking ! self.remote(ServerURI[:Peking][:PSORT2]) end *************** *** 374,380 **** def exec(faa, parsing = true) if faa.class == Bio::FastaFormat ! @title = faa.entry_id if @title == nil ! @sequence = faa.seq ! @serv.args = {'origin' => @origin, 'title' => @title} @serv.parsing = parsing return @serv.exec(@sequence) --- 369,375 ---- def exec(faa, parsing = true) if faa.class == Bio::FastaFormat ! @title = faa.entry_id if @title == nil ! @sequence = faa.seq ! @serv.args = {'origin' => @origin, 'title' => @title} @serv.parsing = parsing return @serv.exec(@sequence)