From nakao at dev.open-bio.org Tue May 2 06:29:21 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Tue, 02 May 2006 10:29:21 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/appl test_pts1.rb,NONE,1.1 Message-ID: <200605021029.k42ATLXP009741@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv9719/test/unit/bio/appl Added Files: test_pts1.rb Log Message: * pts1.rb: intial import. * test_pts1.rb: intial import. --- NEW FILE: test_pts1.rb --- # # = test/unit/bio/appl/test_pts1.rb - Unit test for Bio::PTS1 # # Copyright:: Copyright (C) 2006 # Mitsuteru Nakao # License:: Ruby's # # $Id: test_pts1.rb,v 1.1 2006/05/02 10:29:19 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/appl/pts1' module Bio class TestPTS1Constant < Test::Unit::TestCase def test_FUNCTION keys = ['METAZOA-specific','FUNGI-specific','GENERAL'].sort assert_equal(keys, Bio::PTS1::FUNCTION.keys.sort) end end class TestPTS1New < Test::Unit::TestCase def test_metazoa pts1 = Bio::PTS1.new_with_metazoa_function assert_equal('METAZOA-specific', pts1.function) end def test_fungi pts1 = Bio::PTS1.new_with_fungi_function assert_equal('FUNGI-specific', pts1.function) end def test_general pts1 = Bio::PTS1.new_with_general_function assert_equal('GENERAL', pts1.function) end end class TestPTS1 < Test::Unit::TestCase def setup @seq =<AB000464 MRTGGDNAGPSHSHIKRLPTSGLSTWLQGTQTCVLHLPTGTRPPAHHPLLGYSSRRSYRL LENPAAGCWARFSFCQGAAWDWDLEGVQWLRALAGGVSTAPSAPPGNLVFLSVSIFLCGS LLLETCPAYFSSLDPD* END @serv = Bio::PTS1.new end def test_function_set @serv.function("GENERAL") assert_equal("GENERAL", @serv.function) end def test_function_show assert_equal("METAZOA-specific", @serv.function) end def test_function_set_number_1 @serv.function(1) assert_equal("METAZOA-specific", @serv.function) end def test_function_set_number_2 @serv.function(2) assert_equal("FUNGI-specific", @serv.function) end def test_function_set_number_3 @serv.function(3) assert_equal("GENERAL", @serv.function) end def test_exec report = @serv.exec(@seq) assert_equal(Bio::PTS1::Report, report.class) end def test_exec_with_faa report = @serv.exec(Bio::FastaFormat.new(@seq)) assert_equal(Bio::PTS1::Report, report.class) end end class TestPTS1Report < Test::Unit::TestCase def setup serv = Bio::PTS1.new seq = ">hoge\nAVSFLSMRRARL\n" @report = serv.exec(seq) end def test_output_size assert_equal(1634, @report.output.size) end def test_prediction assert_equal("Targeted", @report.prediction) end def test_cterm assert_equal("AVSFLSMRRARL", @report.cterm) end def test_score assert_equal("7.559", @report.score) end def test_fp assert_equal("2.5e-04", @report.fp) end def test_sppta assert_equal("-5.833", @report.sppta) end def test_spptna assert_equal("-1.698", @report.spptna) end def test_profile assert_equal("15.091", @report.profile) end end end From nakao at dev.open-bio.org Tue May 2 06:29:21 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Tue, 02 May 2006 10:29:21 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl pts1.rb,NONE,1.1 Message-ID: <200605021029.k42ATLQu009746@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv9719/lib/bio/appl Added Files: pts1.rb Log Message: * pts1.rb: intial import. * test_pts1.rb: intial import. --- NEW FILE: pts1.rb --- module Bio # # = bio/appl/pts1.rb - A web service client of PTS1, predicting for the # peroxisomal targeting signal type 1. # # Copyright:: Copyright (C) 2006 # Mitsuteru C. Nakao # License:: Ruby's # # $Id: pts1.rb,v 1.1 2006/05/02 10:29:19 nakao Exp $ # require 'uri' require 'net/http' require 'bio/db/fasta' require 'bio/command' # = Bio::PTS1 - A web service client class for PTS1 predictor. # # == Peroxisomal targeting signal type 1 (PTS1) predictor # # Bio::PTS1 class is a client of the PTS1 predictor. # # == Examples # # require 'bio' # sp = Bio::SPTR.new(Bio::Fetch.query("sp", "p53_human")) # faa = sp.seq.to_fasta(sp.entry_id) # pts1 = Bio::PTS1.new # report = pts1.exec_remote(faa) # report.output #=> "\nPTS1 Prediction Server ..." # report.prediction #=> "Not targeted" # report.cterm #=> "KLMFKTEGPDSD" # report.score #=> "-79.881" # report.fp #=> "67.79%" # report.sppta #=> "-1.110" # report.spptna #=> "-41.937" # report.profile #=> "-36.834" # # == References # # * The PTS1 predictor # http://mendel.imp.ac.at/mendeljsp/sat/pts1/PTS1predictor.jsp # # * Neuberger G, Maurer-Stroh S, Eisenhaber B, Hartig A, Eisenhaber F. # Motif refinement of the peroxisomal targeting signal 1 and evaluation # of taxon-specific differences. # J Mol Biol. 2003 May 2;328(3):567-79. PMID: 12706717 # # * Neuberger G, Maurer-Stroh S, Eisenhaber B, Hartig A, Eisenhaber F. # Prediction of peroxisomal targeting signal 1 containing proteins from # amino acid sequence. # J Mol Biol. 2003 May 2;328(3):581-92. PMID: 12706718 # class PTS1 # Organism specific parameter value: function names. FUNCTION = { 'METAZOA-specific' => 1, 'FUNGI-specific' => 2, 'GENERAL' => 3, } # Output report. attr_reader :output # Used function name (Integer). # function_name = Bio::PTS1::FUNCTION.find_all {|k,v| v == pts1.function }[0][0] attr_reader :function # Short-cut for Bio::PTS1.new(Bio::PTS1::FUNCTION['METAZOA-specific']) def self.new_with_metazoa_function self.new('METAZOA-specific') end # Short-cut for Bio::PTS1.new(Bio::PTS1::FUNCTION['FUNGI-specific']) def self.new_with_fungi_function self.new('FUNGI-specific') end # Short-cut for Bio::PTS1.new(Bio::PTS1::FUNCTION['GENERAL']) def self.new_with_general_function self.new('GENERAL') end # Constructs Bio::PTS1 web service client. # # == Examples # # serv_default_metazoa_specific = Bio::PTS1.new # serv_general_function = Bio::PTS1.new('GENERAL') # serv_fungi_specific = Bio::PTS1.new(2) # See Bio::PTS1::FUNCTION. # def initialize(func = 'METAZOA-specific') @host = "mendel.imp.ac.at" @cgi_path = "/sat/pts1/cgi-bin/pts1.cgi" @output = nil @function = function(func) end # Sets and shows the function parameter. # # Organism specific parameter: function names (Bio::PTS1::FUNTION.keys). # # # == Examples # # # sets function name parameter. # serv = Bio::PTS1.new # serv.function('METAZOA-specific') # # # shows function name parameter. # serv.function #=> "METAZOA-specific" # def function(func = nil) return @function.keys.to_s if func == nil if FUNCTION.values.include?(func) @function = Hash[*FUNCTION.find {|x| x[1] == func}] elsif FUNCTION[func] @function = {func => FUNCTION[func]} else raise ArgumentError, "Invalid argument: #{func}", "Available function names: #{FUNCTION.keys.inspect}" end @function end # Executes the query request and returns result output in Bio::PTS1::Report. # The query argument is available both aSting in fasta format text and # aBio::FastaFormat. # # == Examples # # require 'bio' # pts1 = Bio::PTS1.new # pts1.exec(">title\nKLMFKTEGPDSD") # # pts1.exec(Bio::FastaFormat.new(">title\nKLMFKTEGPDSD")) # def exec(query) seq = set_sequence_in_fastaformat(query) @form_data = {'function' => @function.values, 'sequence' => seq.seq, 'name' => seq.definition } @uri = URI.parse(["http:/", @host, @cgi_path].join('/')) result = nil # The server cannot understand a POST request by folowing codes, but # request by the Net::HTTP.post_form method is OK. # # Bio::Command::NetTools.net_http_start(@uri.host) {|http| # result, = http.post(@uri.path, @form_data) # @output = Report.new(result.body) # } # result, = Net::HTTP.post_form(@uri, @form_data) @output = Report.new(result.body) return @output end private # Sets query sequence in Fasta Format if any. def set_sequence_in_fastaformat(query) if query.class == Bio::FastaFormat return query else return Bio::FastaFormat.new(query) end end # = Parser for the PTS1 prediction Report (in HTML). # # class Report # Amino acids subsequence at C-terminal region. attr_reader :cterm # Score attr_reader :score # Profile attr_reader :profile # S_ppt (non accessibility) attr_reader :spptna # S_ppt (accessibility) attr_reader :sppta # False positive probability attr_reader :fp # Prediction ("Targeted", "Twilight zone" and "Not targeted") attr_reader :prediction # Raw output attr_reader :output # Parsing PTS1 HTML report. # # == Example # # report = Bio::PTS1::Report.new(str) # report.cterm # def initialize(str) @cterm = '' @score = 0 @profile = 0 @spptna = 0 @sppta = 0 @fp = 0 @prediction = 0 if /PTS1 query prediction/m =~ str @output = str parse else raise end end private def parse @output.each do |line| case line when /C-terminus<\/td><td>(\w+)<\/td>/ @cterm = $1 when /Score<\/b><td><b>(-?\d.+?)<\/b><\/td><\/tr>/ @score = $1 when /Profile<\/i><\/td><td>(.+?)<\/td>/ @profile = $1 when /S_ppt \(non-accessibility\)<\/i><\/td><td>(.+?)<\/td>/ @spptna = $1 when /S_ppt \(accessibility\)<\/i><\/td><td>(.+?)<\/td>/ @sppta = $1 when /P\(false positive\)<\/i><\/td><td>(.+?)<\/td>/ @fp = $1 when /Prediction classification<\/i><\/td><td>(\w.+?)<\/td>/ @prediction = $1 else end end end end # class Report end # class PTS1 end # module Bio From nakao at dev.open-bio.org Tue May 2 20:08:01 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Wed, 03 May 2006 00:08:01 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.51,1.52 Message-ID: <200605030008.k43081Mh012644@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv12624 Modified Files: ChangeLog Log Message: * Added comment for lib/bio/appl/pts1.rb. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** ChangeLog 14 Apr 2006 06:33:19 -0000 1.51 --- ChangeLog 3 May 2006 00:07:58 -0000 1.52 *************** *** 1,2 **** --- 1,8 ---- + 2006-05-02 Mitsuteru Nakao <n at bioruby.org> + + * lib/bio/appl/pts1.rb + + Bio::PTS1 first commit. + 2006-04-14 Mitsuteru Nakao <n at bioruby.org> From aerts at dev.open-bio.org Thu May 4 09:13:00 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 13:13:00 +0000 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.67,1.68 Message-ID: <200605041313.k44DD0bj018980@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory dev.open-bio.org:/tmp/cvs-serv18960 Modified Files: bio.rb Log Message: Added autoload for bio/map.rb Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** bio.rb 27 Apr 2006 09:29:35 -0000 1.67 --- bio.rb 4 May 2006 13:12:57 -0000 1.68 *************** *** 44,47 **** --- 44,50 ---- + ## Map + autoload :Map, 'bio/map' + ### Constants From aerts at dev.open-bio.org Thu May 4 09:13:59 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 13:13:59 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio location.rb,0.23,0.24 Message-ID: <200605041313.k44DDx4G019008@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv18988 Modified Files: location.rb Log Message: Added method <=> and mixed in Comparable Index: location.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/location.rb,v retrieving revision 0.23 retrieving revision 0.24 diff -C2 -d -r0.23 -r0.24 *** location.rb 20 Apr 2006 15:58:34 -0000 0.23 --- location.rb 4 May 2006 13:13:57 -0000 0.24 *************** *** 45,49 **** # 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. --- 45,50 ---- # end class Location ! include Comparable ! # 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. *************** *** 130,133 **** --- 131,166 ---- end + # Check where a Bio::Location object is located compared to another + # Bio::Location object (mainly to facilitate the use of Comparable). + # A location A is upstream of location B if the start position of location A + # is smaller than the start position of location B. If they're the same, the + # end positions are checked. + # --- + # *Arguments*: + # * (required) _other location_: a Bio::Location object + # *Returns*:: + # * 1 if self < other location + # * -1 if self > other location + # * 0 if both location are the same + # * nil if the argument is not a Bio::Location object + def <=>(other) + if ! other.kind_of?(Bio::Location) + return nil + end + + if @from.to_f < other.from.to_f + return -1 + elsif @from.to_f > other.from.to_f + return 1 + end + + if @to.to_f < other.to.to_f + return -1 + elsif @to.to_f > other.to.to_f + return 1 + end + return 0 + end + end # class location From aerts at dev.open-bio.org Thu May 4 09:26:06 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 13:26:06 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio map.rb,NONE,1.1 Message-ID: <200605041326.k44DQ62t019080@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv19039 Added Files: map.rb Log Message: New module that can describe mapping information: maps, markers, and the links between them. It also describes the modules ActsLikeMap and ActsLikeMarker that can be mixed into other classes (e.g. to enable clones to act as maps for BAC end-sequences). --- NEW FILE: map.rb --- # # = bio/map.rb - biological mapping class # # Copyright:: Copyright (C) 2006 # Jan Aerts <jan.aerts at bbsrc.ac.uk> # License:: Ruby's module Bio # = DESCRIPTION # The Bio::Module contains classes that describe mapping information and can # be used to contain linkage maps, radiation-hybrid maps, etc. # As the same marker can be mapped to more than one map, and a single map # typically contains more than one marker, the link between the markers and # maps is handled by Bio::Map::Mapping objects. Therefore, to link a map to # a marker, a Bio::Mapping object is added to that Bio::Map. See usage below. # # Not only maps in the strict sense have map-like features (and similarly # not only markers in the strict sense have marker-like features). For example, # a microsatellite is something that can be mapped on a linkage map (and # hence becomes a 'marker'), but a clone can also be mapped to a cytogenetic # map. In that case, the clone acts as a marker and has marker-like properties. # That same clone can also be considered a 'map' when BAC-end sequences are # mapped to it. To reflect this flexibility, the modules Bio::Map::ActsLikeMap # and Bio::Map::ActsLikeMarker define methods that are typical for maps and # markers. # #-- # In a certain sense, a biological sequence also has map- and marker-like # properties: things can be mapped to it at certain locations, and the sequence # itself can be mapped to something else (e.g. the BAC-end sequence example # above, or a BLAST-result). #++ # # = USAGE # marker_a = Bio::Map::Marker.new('marker_a') # marker_b = Bio::Map::Marker.new('marker_b') # map_A = Bio::Map::SimpleMap.new('map_A', 'linkage', 'cM') # puts map_A.contains_marker?('marker_b') # method defined in Bio::Map::ActsLikeMap # # = TODO # Check if initialization of @mappings can be done in ActsLikeMap and # ActsLikeMarker, instead of in the classes that include these modules. module Map # = DESCRIPTION # The Bio::Map::ActsLikeMap module contains methods that are typical for # map-like things: # * add markers with their locations (through Bio::Map::Mappings) # * check if a given marker is mapped to it # , and can be mixed into other classes (e.g. Bio::Map::SimpleMap) module ActsLikeMap include Enumerable # = DESCRIPTION # Adds a Bio::Map::Mappings object to its array of mappings. # # = USAGE # # suppose we have a Bio::Map::SimpleMap object called my_map # my_map.add_mapping(Bio::Map::Marker.new('marker_a'), '5') # --- # *Arguments*: # * _marker_ (required): Bio::Map::Marker object # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself def add_mapping(marker, location = nil) unless marker.class.include?(Bio::Map::ActsLikeMarker) raise "[Error] marker is not object that implements Bio::Map::ActsLikeMarker" end my_mapping = Bio::Map::Mapping.new(self, marker, Bio::Location.new(location)) @mappings.push(my_mapping) unless marker.mapped_to?(self) marker.mappings.push(my_mapping) end return self end # Checks whether a Bio::Map::Marker is mapped to this Bio::Map::SimpleMap. # --- # *Arguments*: # * _marker_: a Bio::Map::Marker object # *Returns*:: true or false def contains_marker?(marker) unless marker.class.include?(Bio::Map::ActsLikeMarker) raise "[Error] marker is not object that implements Bio::Map::ActsLikeMarker" end contains = false @mappings.each do |mapping| if mapping.marker == marker contains = true return contains end end return contains end # Go through all Bio::Map::Mapping objects linked to this Bio::Map::SimpleMap. def each @mappings.each do |mapping| yield mapping end end end #ActsLikeMap # = DESCRIPTION # The Bio::Map::ActsLikeMarker module contains methods that are typical for # marker-like things: # * map it to one or more maps # * check if it's mapped to a given map # , and can be mixed into other classes (e.g. Bio::Map::Marker) module ActsLikeMarker include Enumerable # = DESCRIPTION # Adds a Bio::Map::Mappings object to its array of mappings. # # = USAGE # # suppose we have a Bio::Map::Marker object called marker_a # marker_a.add_mapping(Bio::Map::SimpleMap.new('my_map'), '5') # --- # *Arguments*: # * _map_ (required): Bio::Map::SimpleMap object # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself def add_mapping (map, location = nil) unless map.class.include?(Bio::Map::ActsLikeMap) raise "[Error] map is not object that implements Bio::Map::ActsLikeMap" end my_mapping = Bio::Map::Mapping.new(map, self, Bio::Location.new(location)) @mappings.push(my_mapping) unless map.contains_marker?(self) map.mappings.push(my_mapping) end end # Check whether this marker is mapped to a given Bio::Map::SimpleMap. # --- # *Arguments*: # * _map_: a Bio::Map::SimpleMap object # *Returns*:: true or false def mapped_to?(map) unless map.class.include?(Bio::Map::ActsLikeMap) raise "[Error] map is not object that implements Bio::Map::ActsLikeMap" end mapped = false @mappings.each do |mapping| if mapping.map == map mapped = true return mapped end end return mapped end # Go through all Mapping objects linked to this marker. def each @mappings.each do |mapping| yield mapping end end end #ActsLikeMarker # = DESCRIPTION # Creates a new Bio::Map::Mapping object, which links Bio::Map::ActsAsMap- # and Bio::Map::ActsAsMarker-like objects. This class is typically not # accessed directly, but through map- or marker-like objects. class Mapping include Comparable # Creates a new Bio::Map::Mapping object # --- # *Arguments*: # * _map_: a Bio::Map::SimpleMap object # * _marker_: a Bio::Map::Marker object # * _location_: a Bio::Location object def initialize (map, marker, location = nil) @map, @marker, @location = map, marker, location end attr_accessor :map, :marker, :location # Compares the location of this mapping to another mapping. # --- # *Arguments*: # * other_mapping: Bio::Map::Mapping object # *Returns*:: # * 1 if self < other location # * -1 if self > other location # * 0 if both location are the same # * nil if the argument is not a Bio::Location object def <=>(other) unless other.kind_of(Bio::Map::Mapping) raise "[Error] markers are not comparable" end return self.location.<=>(other.location) end end # Mapping # = DESCRIPTION # This class handles the essential storage of name, type and units of a map. # It includes Bio::Map::ActsLikeMap, and therefore supports the methods of # that module. # # = USAGE # my_map1 = Bio::Map::SimpleMap.new('RH_map_ABC (2006)', 'RH', 'cR') # my_map1.add_marker(Bio::Map::Marker.new('marker_a', '17') # my_map1.add_marker(Bio::Map::Marker.new('marker_b', '5') class SimpleMap include ActsLikeMap # Builds a new Bio::Map::SimpleMap object # --- # *Arguments*: # * name: name of the map # * type: type of the map (e.g. linkage, radiation_hybrid, cytogenetic, ...) # * units: unit of the map (e.g. cM, cR, ...) # *Returns*:: new Bio::Map::SimpleMap object def initialize (name = nil, type = nil, units = nil) @name, @type, @units = name, type, units @mappings = Array.new end # Name of the map attr_accessor :name # Type of the map attr_accessor :type # Units of the map attr_accessor :units # Array of mappings for the map attr_accessor :mappings end # SimpleMap # = DESCRIPTION # This class handles markers that are anchored to a Bio::Map::SimpleMap. It # includes Bio::Map::ActsLikeMarker, and therefore supports the methods of # that module. # # = USAGE # marker_a = Bio::Map::Marker.new('marker_a') # marker_b = Bio::Map::Marker.new('marker_b') class Marker include ActsLikeMarker # Builds a new Bio::Map::Marker object # --- # *Arguments*: # * name: name of the marker # *Returns*:: new Bio::Map::Marker object def initialize(name) @name = name @mappings = Array.new end # Name of the marker attr_accessor :name # Array of mappings for the marker :mappings end # Marker end # Map end # Bio if __FILE__ == $0 my_marker1 = Bio::Map::Marker.new('marker1') # my_marker2 = Bio::Map::Marker.new('marker2') my_marker3 = Bio::Map::Marker.new('marker3') my_map1 = Bio::Map::SimpleMap.new('RH_map_ABC (2006)', 'RH', 'cR') my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') my_map1.add_mapping(my_marker1, '17') my_map1.add_mapping(Bio::Map::Marker.new('marker2'), '5') my_marker3.add_mapping(my_map1, '9') puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s puts "Does my_map2 contain marker3? => " + my_map2.contains_marker?(my_marker3).to_s my_map1.sort.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s end puts my_map1.min.marker.name my_map2.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s end # p my_map1.between?(my_mappable2,my_mappable3) # p my_map1.between?(my_mappable,my_mappable2) end From aerts at dev.open-bio.org Thu May 4 09:36:18 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 13:36:18 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio map.rb,1.1,1.2 Message-ID: <200605041336.k44DaIJA019148@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv19128 Modified Files: map.rb Log Message: * require 'bio/location' * attr_accessor bug for @mappings in Bio::Map::Marker solved Index: map.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/map.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** map.rb 4 May 2006 13:26:04 -0000 1.1 --- map.rb 4 May 2006 13:36:16 -0000 1.2 *************** *** 5,8 **** --- 5,10 ---- # Jan Aerts <jan.aerts at bbsrc.ac.uk> # License:: Ruby's + require 'bio/location' + module Bio # = DESCRIPTION *************** *** 32,39 **** # # = USAGE ! # marker_a = Bio::Map::Marker.new('marker_a') ! # marker_b = Bio::Map::Marker.new('marker_b') ! # map_A = Bio::Map::SimpleMap.new('map_A', 'linkage', 'cM') ! # puts map_A.contains_marker?('marker_b') # method defined in Bio::Map::ActsLikeMap # # = TODO --- 34,58 ---- # # = USAGE ! # my_marker1 = Bio::Map::Marker.new('marker1') ! # my_marker2 = Bio::Map::Marker.new('marker2') ! # my_marker3 = Bio::Map::Marker.new('marker3') ! # ! # my_map1 = Bio::Map::SimpleMap.new('RH_map_ABC (2006)', 'RH', 'cR') ! # my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') ! # ! # my_map1.add_mapping(my_marker1, '17') ! # my_map1.add_mapping(Bio::Map::Marker.new('marker2'), '5') ! # my_marker3.add_mapping(my_map1, '9') ! # ! # puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s ! # puts "Does my_map2 contain marker3? => " + my_map2.contains_marker?(my_marker3).to_s ! # ! # my_map1.sort.each do |mapping| ! # puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s ! # end ! # puts my_map1.min.marker.name ! # my_map2.each do |mapping| ! # puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s ! # end # # = TODO *************** *** 187,191 **** # * nil if the argument is not a Bio::Location object def <=>(other) ! unless other.kind_of(Bio::Map::Mapping) raise "[Error] markers are not comparable" end --- 206,210 ---- # * nil if the argument is not a Bio::Location object def <=>(other) ! unless other.kind_of?(Bio::Map::Mapping) raise "[Error] markers are not comparable" end *************** *** 256,260 **** # Array of mappings for the marker ! :mappings end # Marker end # Map --- 275,279 ---- # Array of mappings for the marker ! attr_accessor :mappings end # Marker end # Map From aerts at dev.open-bio.org Thu May 4 09:59:20 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 13:59:20 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio map.rb,1.2,1.3 Message-ID: <200605041359.k44DxKdd019218@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv19198 Modified Files: map.rb Log Message: Changed names of add_mapping methods in Bio::Map::ActsLikeMap and Bio::Map::ActsLikeMarker to prevent naming conflicts for classes that would mix in both modules. Index: map.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/map.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** map.rb 4 May 2006 13:36:16 -0000 1.2 --- map.rb 4 May 2006 13:59:18 -0000 1.3 *************** *** 79,83 **** # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself ! def add_mapping(marker, location = nil) unless marker.class.include?(Bio::Map::ActsLikeMarker) raise "[Error] marker is not object that implements Bio::Map::ActsLikeMarker" --- 79,83 ---- # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself ! def add_mapping_to_marker(marker, location = nil) unless marker.class.include?(Bio::Map::ActsLikeMarker) raise "[Error] marker is not object that implements Bio::Map::ActsLikeMarker" *************** *** 139,143 **** # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself ! def add_mapping (map, location = nil) unless map.class.include?(Bio::Map::ActsLikeMap) raise "[Error] map is not object that implements Bio::Map::ActsLikeMap" --- 139,143 ---- # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself ! def add_mapping_to_map(map, location = nil) unless map.class.include?(Bio::Map::ActsLikeMap) raise "[Error] map is not object that implements Bio::Map::ActsLikeMap" *************** *** 288,294 **** my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') ! my_map1.add_mapping(my_marker1, '17') ! my_map1.add_mapping(Bio::Map::Marker.new('marker2'), '5') ! my_marker3.add_mapping(my_map1, '9') --- 288,294 ---- my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') ! my_map1.add_mapping_to_marker(my_marker1, '17') ! my_map1.add_mapping_to_marker(Bio::Map::Marker.new('marker2'), '5') ! my_marker3.add_mapping_to_map(my_map1, '9') From aerts at dev.open-bio.org Thu May 4 12:20:52 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 16:20:52 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio map.rb,1.3,1.4 Message-ID: <200605041620.k44GKqiM019742@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv19722 Modified Files: map.rb Log Message: Correction of documentation of add_mapping Index: map.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/map.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** map.rb 4 May 2006 13:59:18 -0000 1.3 --- map.rb 4 May 2006 16:20:50 -0000 1.4 *************** *** 41,47 **** # my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') # ! # my_map1.add_mapping(my_marker1, '17') ! # my_map1.add_mapping(Bio::Map::Marker.new('marker2'), '5') ! # my_marker3.add_mapping(my_map1, '9') # # puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s --- 41,47 ---- # my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') # ! # my_map1.add_mapping_to_marker(my_marker1, '17') ! # my_map1.add_mapping_to_marker(Bio::Map::Marker.new('marker2'), '5') ! # my_marker3.add_mapping_to_marker(my_map1, '9') # # puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s *************** *** 73,77 **** # = USAGE # # suppose we have a Bio::Map::SimpleMap object called my_map ! # my_map.add_mapping(Bio::Map::Marker.new('marker_a'), '5') # --- # *Arguments*: --- 73,77 ---- # = USAGE # # suppose we have a Bio::Map::SimpleMap object called my_map ! # my_map.add_mapping_to_marker(Bio::Map::Marker.new('marker_a'), '5') # --- # *Arguments*: *************** *** 133,137 **** # = USAGE # # suppose we have a Bio::Map::Marker object called marker_a ! # marker_a.add_mapping(Bio::Map::SimpleMap.new('my_map'), '5') # --- # *Arguments*: --- 133,137 ---- # = USAGE # # suppose we have a Bio::Map::Marker object called marker_a ! # marker_a.add_mapping_to_map(Bio::Map::SimpleMap.new('my_map'), '5') # --- # *Arguments*: From aerts at dev.open-bio.org Thu May 4 12:19:54 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 16:19:54 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_map.rb,NONE,1.1 Message-ID: <200605041619.k44GJsO0019694@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory dev.open-bio.org:/tmp/cvs-serv19674 Added Files: test_map.rb Log Message: Unit tests for bio/map.rb --- NEW FILE: test_map.rb --- # # = test/unit/bio/test_map.rb - Unit test for Bio::Map # # Copyright:: Copyright (C) 2006 # Jan Aerts <jan.aerts at bbsrc.ac.uk> # License:: Ruby's require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3, 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/map' module Bio class TestMapSimple < Test::Unit::TestCase def setup @marker1 = Bio::Map::Marker.new('marker1') @marker2 = Bio::Map::Marker.new('marker2') @map1 = Bio::Map::SimpleMap.new('map1', 'some_type', 'some_unit') end def test_attributes assert_equal("marker1", @marker1.name) assert_equal("marker2", @marker2.name) assert_equal([], @marker1.mappings) assert_equal([], @marker2.mappings) assert_equal("map1", @map1.name) assert_equal("some_unit", @map1.units) assert_equal("some_type", @map1.type) assert_equal([], @map1.mappings) end end class TestMapping < Test::Unit::TestCase def setup @marker1 = Bio::Map::Marker.new('marker1') @marker2 = Bio::Map::Marker.new('marker2') @map1 = Bio::Map::SimpleMap.new('map1', 'some_type', 'some_unit') end def test_add_mapping_to_marker @map1.add_mapping_to_marker(@marker2, '5') assert_equal(1, @map1.mappings.length) assert_equal(1, @marker2.mappings.length) assert_equal(0, @marker1.mappings.length) assert_kind_of(Bio::Location, @map1.mappings[0].location) assert_kind_of(Bio::Location, @marker2.mappings[0].location) end def test_add_mapping_to_map @marker1.add_mapping_to_map(@map1, '5') assert_equal(1, @map1.mappings.length) assert_equal(1, @marker1.mappings.length) assert_kind_of(Bio::Location, @map1.mappings[0].location) assert_kind_of(Bio::Location, @marker1.mappings[0].location) end end class CloneActsLikeMap include Bio::Map::ActsLikeMap end class TestActsLikeMap < Test::Unit::TestCase def test_mixin clone = CloneActsLikeMap.new assert_instance_of(CloneActsLikeMap, clone) assert_respond_to(clone, 'contains_marker?') assert_respond_to(clone, 'add_mapping_to_marker') end end class CloneActsLikeMarker include Bio::Map::ActsLikeMarker end class TestActsLikeMarker < Test::Unit::TestCase def test_mixin clone = CloneActsLikeMarker.new assert_instance_of(CloneActsLikeMarker, clone) assert_respond_to(clone, 'mapped_to?') assert_respond_to(clone, 'add_mapping_to_map') end end class CloneActsLikeMapAndMarker include Bio::Map::ActsLikeMap include Bio::Map::ActsLikeMarker end class TestActsLikeMapAndMarker < Test::Unit::TestCase def test_mixin clone = CloneActsLikeMapAndMarker.new assert_instance_of(CloneActsLikeMapAndMarker, clone) assert_respond_to(clone, 'contains_marker?') assert_respond_to(clone, 'add_mapping_to_marker') assert_respond_to(clone, 'mapped_to?') assert_respond_to(clone, 'add_mapping_to_map') end end end From aerts at dev.open-bio.org Thu May 4 14:40:28 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 18:40:28 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio location.rb,0.24,0.25 Message-ID: <200605041840.k44IeSIA021244@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv21224 Modified Files: location.rb Log Message: Line formatting Index: location.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/location.rb,v retrieving revision 0.24 retrieving revision 0.25 diff -C2 -d -r0.24 -r0.25 *** location.rb 4 May 2006 13:13:57 -0000 0.24 --- location.rb 4 May 2006 18:40:26 -0000 0.25 *************** *** 131,165 **** end ! # Check where a Bio::Location object is located compared to another ! # Bio::Location object (mainly to facilitate the use of Comparable). ! # A location A is upstream of location B if the start position of location A ! # is smaller than the start position of location B. If they're the same, the ! # end positions are checked. ! # --- ! # *Arguments*: ! # * (required) _other location_: a Bio::Location object ! # *Returns*:: ! # * 1 if self < other location ! # * -1 if self > other location ! # * 0 if both location are the same ! # * nil if the argument is not a Bio::Location object ! def <=>(other) ! if ! other.kind_of?(Bio::Location) ! return nil ! end ! ! if @from.to_f < other.from.to_f return -1 ! elsif @from.to_f > other.from.to_f ! return 1 ! end ! ! if @to.to_f < other.to.to_f return -1 ! elsif @to.to_f > other.to.to_f ! return 1 ! end return 0 ! end end # class location --- 131,165 ---- end ! # Check where a Bio::Location object is located compared to another ! # Bio::Location object (mainly to facilitate the use of Comparable). ! # A location A is upstream of location B if the start position of location A ! # is smaller than the start position of location B. If they're the same, the ! # end positions are checked. ! # --- ! # *Arguments*: ! # * (required) _other location_: a Bio::Location object ! # *Returns*:: ! # * 1 if self < other location ! # * -1 if self > other location ! # * 0 if both location are the same ! # * nil if the argument is not a Bio::Location object ! def <=>(other) ! if ! other.kind_of?(Bio::Location) ! return nil ! end ! ! if @from.to_f < other.from.to_f return -1 ! elsif @from.to_f > other.from.to_f ! return 1 ! end ! ! if @to.to_f < other.to.to_f return -1 ! elsif @to.to_f > other.to.to_f ! return 1 ! end return 0 ! end end # class location *************** *** 755,758 **** --- 755,760 ---- print "`- loc[1] : "; p loc[1] print " `- range : "; p loc[1].range + + puts Bio::Location.new('5').<=>(Bio::Location.new('3')) end From aerts at dev.open-bio.org Thu May 4 14:41:10 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 18:41:10 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio map.rb,1.4,1.5 Message-ID: <200605041841.k44IfA37021272@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv21252 Modified Files: map.rb Log Message: Only positions of markers /on the same map/ can be compared. Index: map.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/map.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** map.rb 4 May 2006 16:20:50 -0000 1.4 --- map.rb 4 May 2006 18:41:08 -0000 1.5 *************** *** 4,8 **** # Copyright:: Copyright (C) 2006 # Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # License:: Ruby's require 'bio/location' --- 4,9 ---- # Copyright:: Copyright (C) 2006 # Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # Licence:: Ruby's ! # require 'bio/location' *************** *** 209,212 **** --- 210,217 ---- raise "[Error] markers are not comparable" end + unless @map.equal?(other.map) + raise "[Error] maps have to be the same" + end + return self.location.<=>(other.location) end *************** *** 292,303 **** my_marker3.add_mapping_to_map(my_map1, '9') puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s puts "Does my_map2 contain marker3? => " + my_map2.contains_marker?(my_marker3).to_s ! my_map1.sort.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s end puts my_map1.min.marker.name my_map2.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s --- 297,310 ---- my_marker3.add_mapping_to_map(my_map1, '9') + my_map2.add_mapping_to_marker(my_marker1, '57') puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s puts "Does my_map2 contain marker3? => " + my_map2.contains_marker?(my_marker3).to_s ! my_map1.sort.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s end puts my_map1.min.marker.name + my_map2.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s From ngoto at dev.open-bio.org Mon May 8 10:37:57 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Mon, 08 May 2006 14:37:57 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blat report.rb,1.6,1.7 Message-ID: <200605081437.k48EbvjU017182@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blat In directory dev.open-bio.org:/tmp/cvs-serv17162/lib/bio/appl/blat Modified Files: report.rb Log Message: changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blat/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 8 May 2006 14:37:55 -0000 1.7 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2004 GOTO Naohisa <ng at bioruby.org> ! # 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 <ng at bioruby.org> ! # License:: Ruby's # # $Id$ From k at dev.open-bio.org Mon May 8 10:19:53 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:19:53 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/data aa.rb,0.16,0.17 Message-ID: <200605081419.k48EJrBM016395@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory dev.open-bio.org:/tmp/cvs-serv16391/data Modified Files: aa.rb Log Message: * license is changed to Ruby's Index: aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v retrieving revision 0.16 retrieving revision 0.17 diff -C2 -d -r0.16 -r0.17 *** aa.rb 15 Nov 2005 13:33:11 -0000 0.16 --- aa.rb 8 May 2006 14:19:51 -0000 0.17 *************** *** 4,29 **** # Copyright:: Copyright (C) 2001, 2005 # Toshiaki Katayama <k at bioruby.org> ! # 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 --- 4,11 ---- # Copyright:: Copyright (C) 2001, 2005 # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ # module Bio From k at dev.open-bio.org Mon May 8 10:32:00 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:32:00 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io das.rb,1.11,1.12 Message-ID: <200605081432.k48EW00i017091@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv17080/io Modified Files: das.rb Log Message: * license is changed to Ruby's Index: das.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/das.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** das.rb 14 Nov 2005 02:01:54 -0000 1.11 --- das.rb 8 May 2006 14:31:58 -0000 1.12 *************** *** 5,9 **** # Shuichi Kawashima <shuichi at hgc.jp>, # Toshiaki Katayama <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 5,9 ---- # Shuichi Kawashima <shuichi at hgc.jp>, # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 16,37 **** #++ # - #-- - # - # 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 - # - #++ - # begin --- 16,19 ---- From k at dev.open-bio.org Mon May 8 10:23:09 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:23:09 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db prosite.rb,0.13,0.14 Message-ID: <200605081423.k48EN9m8016622@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv16618/db Modified Files: prosite.rb Log Message: * license is changed to Ruby's Index: prosite.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/prosite.rb,v retrieving revision 0.13 retrieving revision 0.14 diff -C2 -d -r0.13 -r0.14 *** prosite.rb 18 Dec 2005 18:24:08 -0000 0.13 --- prosite.rb 8 May 2006 14:23:07 -0000 0.14 *************** *** 3,32 **** # # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki <k at bioruby.org> ! # Licence:: LGPL ! # ! # $Id$ ! # ! # == Description ! # ! # ! # == 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 # ! #++ # --- 3,9 ---- # # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki <k at bioruby.org> ! # Licence:: Ruby's # ! # $Id$ # From k at dev.open-bio.org Mon May 8 10:32:00 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:32:00 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db gff.rb,1.6,1.7 Message-ID: <200605081432.k48EW0xM017086@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv17080/db Modified Files: gff.rb Log Message: * license is changed to Ruby's Index: gff.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/gff.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gff.rb 28 Mar 2006 13:42:32 -0000 1.6 --- gff.rb 8 May 2006 14:31:58 -0000 1.7 *************** *** 5,30 **** # Toshiaki Katayama <k at bioruby.org> # 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # 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 --- 5,12 ---- # Toshiaki Katayama <k at bioruby.org> # 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # License:: Ruby's # # $Id$ # module Bio From k at dev.open-bio.org Mon May 8 10:22:15 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:22:15 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db litdb.rb,0.7,0.8 Message-ID: <200605081422.k48EMFHl016536@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv16532/db Modified Files: litdb.rb Log Message: * license is changed to Ruby's Index: litdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/litdb.rb,v retrieving revision 0.7 retrieving revision 0.8 diff -C2 -d -r0.7 -r0.8 *** litdb.rb 18 Dec 2005 15:58:41 -0000 0.7 --- litdb.rb 8 May 2006 14:22:12 -0000 0.8 *************** *** 3,34 **** # # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # $Id$ # - # == Description - # - # - # == 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 - # - #++ - # require 'bio/db' --- 3,10 ---- # # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ # require 'bio/db' From k at dev.open-bio.org Mon May 8 10:34:54 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:34:54 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db aaindex.rb,1.18,1.19 Message-ID: <200605081434.k48EYsDl017116@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv17112/db Modified Files: aaindex.rb Log Message: * license is changed to Ruby's Index: aaindex.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/aaindex.rb,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** aaindex.rb 22 Feb 2006 07:35:19 -0000 1.18 --- aaindex.rb 8 May 2006 14:34:52 -0000 1.19 *************** *** 6,10 **** # Copyright:: Copyright (C) 2006 # Mitsuteru C. Nakao <n at bioruby.org> ! # License:: LGPL # # $Id$ --- 6,10 ---- # Copyright:: Copyright (C) 2006 # Mitsuteru C. Nakao <n at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 35,56 **** # * http://www.genome.jp/aaindex/ # - #-- - # - # 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" --- 35,38 ---- From k at dev.open-bio.org Mon May 8 10:21:48 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:21:48 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/data codontable.rb,0.16,0.17 Message-ID: <200605081421.k48ELmPp016493@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory dev.open-bio.org:/tmp/cvs-serv16489 Modified Files: codontable.rb Log Message: * license is changed to Ruby's Index: codontable.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/codontable.rb,v retrieving revision 0.16 retrieving revision 0.17 diff -C2 -d -r0.16 -r0.17 *** codontable.rb 15 Nov 2005 12:43:37 -0000 0.16 --- codontable.rb 8 May 2006 14:21:46 -0000 0.17 *************** *** 4,8 **** # Copyright:: Copyright (C) 2001, 2004 # Toshiaki Katayama <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2001, 2004 # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 43,64 **** # table.revtrans("A") # => ["gcg", "gct", "gca", "gcc"] # - #-- - # - # 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 --- 43,46 ---- From k at dev.open-bio.org Mon May 8 10:23:53 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:23:53 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl swissprot.rb,1.4,1.5 Message-ID: <200605081423.k48ENrT3016683@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv16679/db/embl Modified Files: swissprot.rb Log Message: * license is changed to Ruby's Index: swissprot.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/swissprot.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** swissprot.rb 28 Jan 2006 06:40:38 -0000 1.4 --- swissprot.rb 8 May 2006 14:23:51 -0000 1.5 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2001, 2002 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2001, 2002 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 29,50 **** # http://au.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/embl/sptr' --- 29,32 ---- From k at dev.open-bio.org Mon May 8 10:22:43 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:22:43 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db medline.rb,1.13,1.14 Message-ID: <200605081422.k48EMhIV016579@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv16575/db Modified Files: medline.rb Log Message: * license is changed to Ruby's Index: medline.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/medline.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** medline.rb 18 Feb 2006 15:03:47 -0000 1.13 --- medline.rb 8 May 2006 14:22:41 -0000 1.14 *************** *** 4,8 **** # Copyright:: Copyright (C) 2001, 2005 # KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # == Description --- 4,8 ---- # Copyright:: Copyright (C) 2001, 2005 # KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # == Description *************** *** 17,42 **** # medilne.mesh # - # == References - # # $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 - # - #-- - # require 'bio/db' --- 17,22 ---- From k at dev.open-bio.org Mon May 8 10:25:27 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:25:27 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg expression.rb, 1.9, 1.10 kgml.rb, 1.2, 1.3 Message-ID: <200605081425.k48EPR7k016788@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory dev.open-bio.org:/tmp/cvs-serv16784/db/kegg Modified Files: expression.rb kgml.rb Log Message: * license is changed to Ruby's Index: kgml.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/kgml.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** kgml.rb 5 Nov 2005 08:29:53 -0000 1.2 --- kgml.rb 8 May 2006 14:25:25 -0000 1.3 *************** *** 4,8 **** # Copyright:: Copyright (C) 2005 # Toshiaki Katayama <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2005 # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 83,104 **** # end # - #-- - # - # 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 'rexml/document' --- 83,86 ---- Index: expression.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/expression.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** expression.rb 5 Nov 2005 08:27:26 -0000 1.9 --- expression.rb 8 May 2006 14:25:25 -0000 1.10 *************** *** 5,30 **** # Shuichi Kawashima <shuichi at hgc.jp>, # Toshiaki Katayama <k at bioruby.org> ! # 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 - # - #++ - # require "bio/db" --- 5,12 ---- # Shuichi Kawashima <shuichi at hgc.jp>, # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ # require "bio/db" From k at dev.open-bio.org Mon May 8 10:24:29 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:24:29 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl trembl.rb, 1.4, 1.5 uniprot.rb, 1.2, 1.3 Message-ID: <200605081424.k48EOTB1016726@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv16722/db/embl Modified Files: trembl.rb uniprot.rb Log Message: * license is changed to Ruby's Index: trembl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/trembl.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** trembl.rb 28 Jan 2006 06:40:38 -0000 1.4 --- trembl.rb 8 May 2006 14:24:27 -0000 1.5 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2001, 2002 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2001, 2002 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 29,50 **** # http://au.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/embl/sptr' --- 29,32 ---- Index: uniprot.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/uniprot.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** uniprot.rb 28 Jan 2006 06:40:39 -0000 1.2 --- uniprot.rb 8 May 2006 14:24:27 -0000 1.3 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2005 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2005 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 29,50 **** # 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/embl/sptr' --- 29,32 ---- From k at dev.open-bio.org Mon May 8 10:30:00 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:30:00 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io dbget.rb, 1.11, 1.12 ddbjxml.rb, 1.10, 1.11 fetch.rb, 1.7, 1.8 registry.rb, 1.16, 1.17 soapwsdl.rb, 1.3, 1.4 Message-ID: <200605081430.k48EU05g016983@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv16979/io Modified Files: dbget.rb ddbjxml.rb fetch.rb registry.rb soapwsdl.rb Log Message: * license is changed to Ruby's Index: soapwsdl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/soapwsdl.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** soapwsdl.rb 18 Dec 2005 16:51:18 -0000 1.3 --- soapwsdl.rb 8 May 2006 14:29:58 -0000 1.4 *************** *** 4,14 **** # Copyright:: Copyright (C) 2004 # KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # $Id$ # - # SOAP/WSDL - # - # # == Examples # --- 4,11 ---- # Copyright:: Copyright (C) 2004 # KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ # # == Examples # *************** *** 37,58 **** # % export http_proxy=http://localhost:8080 # - #-- - # - # 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 - # - #++ - # begin --- 34,37 ---- Index: ddbjxml.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/ddbjxml.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ddbjxml.rb 2 Feb 2006 16:30:29 -0000 1.10 --- ddbjxml.rb 8 May 2006 14:29:58 -0000 1.11 *************** *** 4,29 **** # Copyright:: Copyright (C) 2003, 2004 # KATAYAMA Toshiaki <k at bioruby.org> ! # 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 - # - #++ - # require 'bio/io/soapwsdl' --- 4,11 ---- # Copyright:: Copyright (C) 2003, 2004 # KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ # require 'bio/io/soapwsdl' Index: registry.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/registry.rb,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** registry.rb 18 Dec 2005 15:58:42 -0000 1.16 --- registry.rb 8 May 2006 14:29:58 -0000 1.17 *************** *** 4,8 **** # Copyright:: Copyright (C) 2002, 2003, 2004, 2005 # Toshiaki Katayama <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2002, 2003, 2004, 2005 # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 82,102 **** # * http://www.open-bio.org/registry/seqdatabase.ini # - #-- - # 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 'uri' --- 82,85 ---- Index: dbget.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/dbget.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dbget.rb 5 Nov 2005 08:32:26 -0000 1.11 --- dbget.rb 8 May 2006 14:29:58 -0000 1.12 *************** *** 5,9 **** # Mitsuteru C. Nakao <n at bioruby.org>, # Toshiaki Katayama <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 5,9 ---- # Mitsuteru C. Nakao <n at bioruby.org>, # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 14,35 **** # http://www.genome.jp/dbget/ within the intranet. # - #-- - # - # 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 'socket' --- 14,17 ---- Index: fetch.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/fetch.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** fetch.rb 27 Mar 2006 18:34:35 -0000 1.7 --- fetch.rb 8 May 2006 14:29:58 -0000 1.8 *************** *** 1,27 **** # ! # bio/io/biofetch.rb - BioFetch access module # ! # Copyright (C) 2002, 2005 Toshiaki Katayama <k at bioruby.org> ! # 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! ! # 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$ # require 'uri' --- 1,28 ---- # ! # = bio/io/biofetch.rb - BioFetch access module # ! # Copyright:: Copyright (C) 2002, 2005 Toshiaki Katayama <k at bioruby.org>, ! # Copyright (C) 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # License:: Ruby's # + # $Id$ # ! # == DESCRIPTION # ! # Using BioRuby BioFetch server # ! # br_server = Bio::Fetch.new() ! # puts br_server.databases ! # puts br_server.formats('embl') ! # puts br_server.maxids # ! # Using EBI BioFetch server # + # ebi_server = Bio::Fetch.new('http://www.ebi.ac.uk/cgi-bin/dbfetch') + # puts ebi_server.fetch('embl', 'J00231', 'raw') + # puts ebi_server.fetch('embl', 'J00231', 'html') + # puts Bio::Fetch.query('genbank', 'J00231') + # puts Bio::Fetch.query('genbank', 'J00231', 'raw', 'fasta') + # require 'uri' *************** *** 179,202 **** end # module Bio - - - if __FILE__ == $0 - - puts "# test 1" - br_server = Bio::Fetch.new() - puts br_server.databases - puts br_server.formats('embl') - puts br_server.maxids - ebi_server = Bio::Fetch.new('http://www.ebi.ac.uk/cgi-bin/dbfetch') - puts "# test 2" - puts ebi_server.fetch('embl', 'J00231', 'raw') - puts "# test 3" - puts ebi_server.fetch('embl', 'J00231', 'html') - puts "# test 4" - puts Bio::Fetch.query('genbank', 'J00231') - puts "# test 5" - puts Bio::Fetch.query('genbank', 'J00231', 'raw', 'fasta') - - end - - --- 180,181 ---- From k at dev.open-bio.org Mon May 8 10:26:37 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:26:37 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg keggtab.rb,1.7,1.8 Message-ID: <200605081426.k48EQb2j016850@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory dev.open-bio.org:/tmp/cvs-serv16846/db/kegg Modified Files: keggtab.rb Log Message: * license is changed to Ruby's Index: keggtab.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/keggtab.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** keggtab.rb 26 Sep 2005 13:00:07 -0000 1.7 --- keggtab.rb 8 May 2006 14:26:35 -0000 1.8 *************** *** 1,21 **** # ! # bio/db/kegg/keggtab.rb - KEGG keggtab class ! # ! # Copyright (C) 2001 Mitsuteru C. Nakao <n at bioruby.org> ! # Copyright (C) 2003 KATAYAMA Toshiaki <k at bioruby.org> ! # ! # 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,8 ---- # ! # = bio/db/kegg/keggtab.rb - KEGG keggtab class # ! # Copyright:: Copyright (C) 2001 Mitsuteru C. Nakao <n at bioruby.org> ! # Copyright (C) 2003, 2006 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 23,214 **** module Bio ! class KEGG ! class Keggtab ! def initialize(file_path, bioroot = nil) ! @bioroot = ENV['BIOROOT'] || bioroot ! @db_names = Hash.new ! @database = Hash.new ! @taxonomy = Hash.new ! parse_keggtab(File.open(file_path).read) ! end ! attr_reader :bioroot, :db_names ! # Bio::KEGG::Keggtab::DB ! class DB ! def initialize(db_name, db_type, db_path, db_abbrev) ! @name = db_name ! @type = db_type ! @path = db_path ! @abbrev = db_abbrev ! @aliases = Array.new ! end ! attr_reader :name, :type, :path, :abbrev, :aliases ! alias korg abbrev ! alias keggorg abbrev ! end ! # DB section ! def database(db_abbrev = nil) ! if db_abbrev ! @database[db_abbrev] ! else ! @database ! end ! end ! def aliases(db_abbrev) ! if @database[db_abbrev] ! @database[db_abbrev].aliases ! end ! end ! def name(db_abbrev) ! if @database[db_abbrev] ! @database[db_abbrev].name ! end ! end ! def path(db_abbrev) ! if @database[db_abbrev] ! file = @database[db_abbrev].name ! if @bioroot ! "#{@database[db_abbrev].path.sub(/\$BIOROOT/, at bioroot)}/#{file}" ! else ! "#{@database[db_abbrev].path}/#{file}" ! end ! end end ! def alias_list(db_name) ! if @db_names[db_name] ! @db_names[db_name].aliases ! end ! end ! def db_path(db_name) ! if @bioroot ! "#{@db_names[db_name].path.sub(/\$BIOROOT/, at bioroot)}/#{db_name}" ! else ! "#{@db_names[db_name].path}/#{db_name}" ! end ! end ! def db_by_abbrev(db_abbrev) ! @db_names.each do |k, db| ! return db if db.abbrev == db_abbrev ! end ! return nil ! end ! def name_by_abbrev(db_abbrev) ! db_by_abbrev(db_abbrev).name ! end ! def db_path_by_abbrev(db_abbrev) ! db_name = name_by_abbrev(db_abbrev) ! db_path(db_name) ! end ! # Taxonomy section ! def taxonomy(node = nil) ! if node ! @taxonomy[node] ! else ! @taxonomy ! end ! end ! def taxa_list ! @taxonomy.keys.sort ! end ! def child_nodes(node = 'genes') ! return @taxonomy[node] ! end ! def taxo2korgs(node = 'genes') ! if node.length == 3 ! return node ! else ! if @taxonomy[node] ! tmp = Array.new ! @taxonomy[node].each do |x| ! tmp.push(taxo2korgs(x)) ! end ! return tmp ! else ! return nil ! end end end ! alias taxo2keggorgs taxo2korgs ! alias taxon2korgs taxo2korgs ! alias taxon2keggorgs taxo2korgs ! def korg2taxo(keggorg) ! tmp = Array.new ! traverse = Proc.new {|keggorg| ! @taxonomy.each do |k,v| ! if v.include?(keggorg) ! tmp.push(k) ! traverse.call(k) ! break ! end ! end ! } ! traverse.call(keggorg) ! return tmp end ! alias keggorg2taxo korg2taxo ! alias korg2taxonomy korg2taxo ! alias keggorg2taxonomy korg2taxo ! private ! def parse_keggtab(keggtab) ! in_taxonomy = nil ! keggtab.each do |line| ! case line ! when /^# Taxonomy/ # beginning of the taxonomy section ! in_taxonomy = true ! when /^#|^$/ ! next ! when /(^\w\S+)\s+(\w+)\s+(\$\S+)\s+(\w+)/ # db ! db_name = $1 ! db_type = $2 ! db_path = $3 ! db_abbrev = $4 ! @db_names[db_name] = ! Bio::KEGG::Keggtab::DB.new(db_name, db_type, db_path, db_abbrev) ! when /(^\w\S+)\s+alias\s+(\w.+\w)/ # alias ! db_alias = $1 ! db_name = $2#.downcase ! if in_taxonomy ! @taxonomy.update(db_alias => db_name.split('+')) ! elsif @db_names[db_name] ! @db_names[db_name].aliases.push(db_alias) ! end ! end ! end ! # convert keys-by-names hash @db_names to keys-by-abbrev hash @database ! @db_names.each do |k,v| ! @database[v.abbrev] = v end end - end ! end ! end --- 10,209 ---- module Bio ! class KEGG ! # Parse 'keggtab' KEGG database definition file which also includes ! # Taxonomic category of the KEGG organisms. The 'keggtab' file can ! # be found in ! # ! # * ((<URL:ftp://ftp.genome.jp/pub/kegg/tarfiles/genes.tar.gz>)) ! # ! class Keggtab ! def initialize(file_path, bioroot = nil) ! @bioroot = ENV['BIOROOT'] || bioroot ! @db_names = Hash.new ! @database = Hash.new ! @taxonomy = Hash.new ! File.open(file_path) do |f| ! parse_keggtab(f.read) ! end ! end ! attr_reader :bioroot, :db_names ! # Bio::KEGG::Keggtab::DB ! class DB ! def initialize(db_name, db_type, db_path, db_abbrev) ! @name = db_name ! @type = db_type ! @path = db_path ! @abbrev = db_abbrev ! @aliases = Array.new ! end ! attr_reader :name, :type, :path, :abbrev, :aliases ! alias korg abbrev ! alias keggorg abbrev ! end ! # DB section ! def database(db_abbrev = nil) ! if db_abbrev ! @database[db_abbrev] ! else ! @database ! end ! end ! def aliases(db_abbrev) ! if @database[db_abbrev] ! @database[db_abbrev].aliases ! end ! end ! def name(db_abbrev) ! if @database[db_abbrev] ! @database[db_abbrev].name ! end ! end ! def path(db_abbrev) ! if @database[db_abbrev] ! file = @database[db_abbrev].name ! if @bioroot ! "#{@database[db_abbrev].path.sub(/\$BIOROOT/, at bioroot)}/#{file}" ! else ! "#{@database[db_abbrev].path}/#{file}" end + end + end ! def alias_list(db_name) ! if @db_names[db_name] ! @db_names[db_name].aliases ! end ! end ! def db_path(db_name) ! if @bioroot ! "#{@db_names[db_name].path.sub(/\$BIOROOT/, at bioroot)}/#{db_name}" ! else ! "#{@db_names[db_name].path}/#{db_name}" ! end ! end ! def db_by_abbrev(db_abbrev) ! @db_names.each do |k, db| ! return db if db.abbrev == db_abbrev ! end ! return nil ! end ! def name_by_abbrev(db_abbrev) ! db_by_abbrev(db_abbrev).name ! end ! def db_path_by_abbrev(db_abbrev) ! db_name = name_by_abbrev(db_abbrev) ! db_path(db_name) ! end ! # Taxonomy section ! def taxonomy(node = nil) ! if node ! @taxonomy[node] ! else ! @taxonomy ! end ! end ! def taxa_list ! @taxonomy.keys.sort ! end ! def child_nodes(node = 'genes') ! return @taxonomy[node] ! end ! def taxo2korgs(node = 'genes') ! if node.length == 3 ! return node ! else ! if @taxonomy[node] ! tmp = Array.new ! @taxonomy[node].each do |x| ! tmp.push(taxo2korgs(x)) end + return tmp + else + return nil end ! end ! end ! alias taxo2keggorgs taxo2korgs ! alias taxon2korgs taxo2korgs ! alias taxon2keggorgs taxo2korgs ! def korg2taxo(keggorg) ! tmp = Array.new ! traverse = Proc.new {|keggorg| ! @taxonomy.each do |k,v| ! if v.include?(keggorg) ! tmp.push(k) ! traverse.call(k) ! break ! end end ! } ! traverse.call(keggorg) ! return tmp ! end ! alias keggorg2taxo korg2taxo ! alias korg2taxonomy korg2taxo ! alias keggorg2taxonomy korg2taxo ! private ! def parse_keggtab(keggtab) ! in_taxonomy = nil ! keggtab.each do |line| ! case line ! when /^# Taxonomy/ # beginning of the taxonomy section ! in_taxonomy = true ! when /^#|^$/ ! next ! when /(^\w\S+)\s+(\w+)\s+(\$\S+)\s+(\w+)/ # db ! db_name = $1 ! db_type = $2 ! db_path = $3 ! db_abbrev = $4 ! @db_names[db_name] = ! Bio::KEGG::Keggtab::DB.new(db_name, db_type, db_path, db_abbrev) ! when /(^\w\S+)\s+alias\s+(\w.+\w)/ # alias ! db_alias = $1 ! db_name = $2#.downcase ! if in_taxonomy ! @taxonomy.update(db_alias => db_name.split('+')) ! elsif @db_names[db_name] ! @db_names[db_name].aliases.push(db_alias) end end end ! # convert keys-by-names hash @db_names to keys-by-abbrev hash @database ! @db_names.each do |k,v| ! @database[v.abbrev] = v ! end end ! ! end # Keggtab ! ! end # KEGG ! end # Bio From ngoto at dev.open-bio.org Tue May 9 03:13:56 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 09 May 2006 07:13:56 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.8,1.9 Message-ID: <200605090713.k497DuWX018440@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv18420/lib/bio Modified Files: command.rb Log Message: * new method Bio::Command::NetTools.post_form is added. Note that it is bioruby internal use only and users should not use it. * Bio::Command::NetTools.net_http_start is renamed to http_start. (net_http_start still remains as an alias.) Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** command.rb 27 Apr 2006 03:15:27 -0000 1.8 --- command.rb 9 May 2006 07:13:54 -0000 1.9 *************** *** 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. --- 171,175 ---- # is set. # ! def 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. *************** *** 183,188 **** --- 183,216 ---- http.start(address, port, &block) end + module_function :http_start + + alias net_http_start http_start module_function :net_http_start + # Same as: + # Net::HTTP.post_form(uri, params) + # and + # it uses proxy if an environment variable (same as OpenURI.open_uri) + # is set. + # In addition, +header+ can be set. + # (Note that Content-Type and Content-Length are automatically + # set by default.) + # +uri+ must be a URI object and +params+ must be a hash. + # + def post_form(uri, params, header = {}) + data = params.map do |key, val| + "#{URI.escape(key)}=#{URI.escape(val)}" + end.join('&') + h = { + 'Content-Type' => 'application/x-www-form-urlencoded', + 'Content-Length' => data.length.to_s + } + h.update(header) + net_http_start(uri.host, uri.port) do |http| + http.post(uri.path, data, h) + end + end + module_function :post_form + end #module NetTools From ngoto at dev.open-bio.org Tue May 9 03:17:14 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 09 May 2006 07:17:14 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.9,1.10 Message-ID: <200605090717.k497HEEt018470@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv18448/lib/bio Modified Files: command.rb Log Message: rename of net_http_start to http_start is canceled Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** command.rb 9 May 2006 07:13:54 -0000 1.9 --- command.rb 9 May 2006 07:17:11 -0000 1.10 *************** *** 171,175 **** # is set. # ! def 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. *************** *** 183,189 **** http.start(address, port, &block) end - module_function :http_start - - alias net_http_start http_start module_function :net_http_start --- 183,186 ---- From nakao at dev.open-bio.org Tue May 9 04:18:51 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Tue, 09 May 2006 08:18:51 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl pts1.rb,1.1,1.2 Message-ID: <200605090818.k498IpqM019200@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv19136/lib/bio/appl Modified Files: pts1.rb Log Message: * Uses Bio::Command::NetTools.post_form in PTS1#exec method instaed of Net::HTTP.post_form. Index: pts1.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/pts1.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pts1.rb 2 May 2006 10:29:19 -0000 1.1 --- pts1.rb 9 May 2006 08:18:49 -0000 1.2 *************** *** 147,167 **** seq = set_sequence_in_fastaformat(query) ! @form_data = {'function' => @function.values, 'sequence' => seq.seq, 'name' => seq.definition } @uri = URI.parse(["http:/", @host, @cgi_path].join('/')) ! result = nil ! ! # The server cannot understand a POST request by folowing codes, but ! # request by the Net::HTTP.post_form method is OK. ! # ! # Bio::Command::NetTools.net_http_start(@uri.host) {|http| ! # result, = http.post(@uri.path, @form_data) ! # @output = Report.new(result.body) ! # } ! # ! ! result, = Net::HTTP.post_form(@uri, @form_data) @output = Report.new(result.body) --- 147,156 ---- seq = set_sequence_in_fastaformat(query) ! @form_data = {'function' => @function.values.to_s, 'sequence' => seq.seq, 'name' => seq.definition } @uri = URI.parse(["http:/", @host, @cgi_path].join('/')) ! result, = Bio::Command::NetTools.post_form(@uri, @form_data) @output = Report.new(result.body) From aerts at dev.open-bio.org Tue May 9 07:52:32 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Tue, 09 May 2006 11:52:32 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio feature.rb,1.11,1.12 Message-ID: <200605091152.k49BqWge019612@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv19592 Modified Files: feature.rb Log Message: Reverted to previous behaviour: new takes array of Bio::Feature::Qualifiers instead of list of qualifier_key, qualifier_value pairs. Index: feature.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/feature.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** feature.rb 26 Apr 2006 11:05:50 -0000 1.11 --- feature.rb 9 May 2006 11:52:30 -0000 1.12 *************** *** 23,27 **** # # /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 --- 23,37 ---- # # /note="cytochrome P450 IID6; GOO-132-127" # # /number="1" ! # feature = Bio::Feature.new('exon','1532..1799') ! # feature.append(Bio::Feature::Qualifier.new('gene', 'CYP2D6')) ! # feature.append(Bio::Feature::Qualifier.new('note', 'cytochrome P450 IID6')) ! # feature.append(Bio::Feature::Qualifier.new('number', '1')) ! # ! # # or all in one go: ! # feature2 = Bio::Feature.new('exon','1532..1799', ! # [ Bio::Feature::Qualifier.new('gene', 'CYP2D6'), ! # Bio::Feature::Qualifier.new('note', 'cytochrome P450 IID6; GOO-132-127'), ! # Bio::Feature::Qualifier.new('number', '1') ! # ]) # # # Print the feature *************** *** 38,54 **** # * (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 --- 48,55 ---- # * (required) _feature_: type of feature (e.g. "exon") # * (required) _position_: position of feature (e.g. "complement(1532..1799)") ! # * (opt) _qualifiers_: list of Bio::Feature::Qualifier objects (default: []) # *Returns*:: Bio::Feature object def initialize(feature = '', position = '', qualifiers = []) ! @feature, @position, @qualifiers = feature, position, qualifiers end *************** *** 131,137 **** attr_reader :value ! end ! end --- 132,138 ---- attr_reader :value ! end #Qualifier ! end #Feature *************** *** 141,148 **** # = 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 --- 142,152 ---- # = USAGE # # First, create some Bio::Feature objects ! # feature1 = Bio::Feature.new('intron','3627..4059') ! # feature2 = Bio::Feature.new('exon','4060..4236') ! # feature3 = Bio::Feature.new('intron','4237..4426') ! # feature4 = Bio::Feature.new('CDS','join(2538..3626,4060..4236)', ! # [ Bio::Feature::Qualifier.new('gene', 'CYP2D6'), ! # Bio::Feature::Qualifier.new('translation','MGXXTVMHLL...') ! # ]) # # # And create a container for them *************** *** 217,257 **** end ! end 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 --- 221,226 ---- end ! end # Features end # Bio From aerts at dev.open-bio.org Thu May 11 06:53:27 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 11 May 2006 10:53:27 +0000 Subject: [BioRuby-cvs] bioruby README.DEV,1.9,1.10 Message-ID: <200605111053.k4BArRXb026729@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv26709 Modified Files: README.DEV Log Message: Added documentation on standard documentation of files and modules (as requested by Toshiaki). Index: README.DEV =================================================================== RCS file: /home/repository/bioruby/bioruby/README.DEV,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** README.DEV 8 Feb 2006 12:02:09 -0000 1.9 --- README.DEV 11 May 2006 10:53:25 -0000 1.10 *************** *** 1,9 **** ! =begin ! ! $Id$ ! Copyright (C) 2005, 2006 Toshiaki Katayama <k at bioruby.org> ! = How to contribute to the BioRuby project? There are many possible ways to contribute to the BioRuby project, --- 1,8 ---- ! $Id$ ! Copyright (C):: 2005, 2006 Toshiaki Katayama <k at bioruby.org> ! Copyright (C):: 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! = HOW TO CONTRIBUTE TO THE BIORUBY PROJECT? There are many possible ways to contribute to the BioRuby project, *************** *** 21,25 **** your module meets the field of bioinformatics. ! == License If you would like your module to be included in the BioRuby distribution, --- 20,24 ---- your module meets the field of bioinformatics. ! = LICENSE If you would like your module to be included in the BioRuby distribution, *************** *** 30,38 **** are changing the license to Ruby's. ! == Coding style You will need to follow the typical coding styles of the BioRuby modules: ! === Use the following naming conventions * CamelCase for module and class names --- 29,37 ---- are changing the license to Ruby's. ! = CODING STYLE You will need to follow the typical coding styles of the BioRuby modules: ! == Use the following naming conventions * CamelCase for module and class names *************** *** 41,101 **** * all UPPERCASE for constants ! === Indentation must not include tabs * Use 2 spaces for indentation. * Don't replace spaces to tabs. ! === Comments ! Don't use =begin and =end blocks for comments. If you need to add comments, include it in the RDoc documentation. ! === Each file must start with the following text # ! # = bio/db/hoge.rb - Hoge database parser # - # Copyright:: Copyright (C) 2001, 2005 - # Bio R. Hacker <brh at example.org>, - # Chem R. Hacker <crh at example.org> # License:: Ruby's # # $Id$ # ! # == Blah blah blah ! # ! # See http://hoge.db/ for more details on the Hoge database. ! # ... blah blah blah ... ! # ! # == Examples # ! # hoge = Bio::Hoge.new(entry) ! # puts hoge.entry_id ! # puts hoge.definition # ! # == References # # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. 123:100--123 (2030) - # # * http://hoge.db/ # ! === Documentation should be written in the RDoc format in the source code ! The RDoc format is becoming the popular standard for Ruby documentation. ! We are now in transition from the previously used RD format to the RDoc ! format in API documentation. ! Additional tutorial documentation and working examples are encouraged ! with your contribution. You may use the header part of the file for ! this purpose as demonstrated in the previous section. ! === Testing code should use 'test/unit' Unit tests should come with your modules by which you can assure what you meant to do with each method. The test code is useful to make ! maintenance easy and ensure stability. ! === Using autoload To quicken the initial load time we have replaced most of 'require' to --- 40,205 ---- * all UPPERCASE for constants ! == Indentation must not include tabs * Use 2 spaces for indentation. * Don't replace spaces to tabs. ! == Comments ! Don't use <tt>=begin</tt> and <tt>=end</tt> blocks for comments. If you need to add comments, include it in the RDoc documentation. ! == Documentation should be written in the RDoc format in the source code ! ! The RDoc format is becoming the popular standard for Ruby documentation. ! We are now in transition from the previously used RD format to the RDoc ! format in API documentation. ! ! Additional tutorial documentation and working examples are encouraged ! with your contribution. You may use the header part of the file for ! this purpose as demonstrated in the previous section. ! ! == Standard documentation ! ! === of files ! ! Each file should start with a header, which covers the following topics: ! * copyright ! * license ! * description of the file (_not_ the classes; see below) ! * any references, if appropriate + The header should be formatted as follows: # ! # = bio/db/hoge.rb - Hoge database parser classes ! # ! # Copyright (C):: 2001, 2003-2005 Bio R. Hacker <brh at example.org>, ! # Copyright (C):: 2006 Chem R. Hacker <crh at example.org> # # License:: Ruby's # # $Id$ # ! # = Description # ! # This file contains classes that implement an interface to the Hoge database. # ! # = References # # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. 123:100--123 (2030) # * http://hoge.db/ # ! In the above sample, the ! $Id$ ! will be automatically changed into something like ! $Id$ ! when commiting to the CVS repository for the first time. ! === of classes and methods within those files ! Classes and methods should be documented in a standardized format, as in the ! following example (from lib/bio/sequence.rb): ! # = DESCRIPTION ! # Bio::Sequence objects represent annotated sequences in bioruby. ! # A Bio::Sequence object is a wrapper around the actual sequence, ! # represented as either a Bio::Sequence::NA or a Bio::Sequence::AA object. ! # For most users, this encapsulation will be completely transparent. ! # Bio::Sequence responds to all methods defined for Bio::Sequence::NA/AA ! # objects using the same arguments and returning the same values (even though ! # these methods are not documented specifically for Bio::Sequence). ! # ! # = USAGE ! # require 'bio' ! # ! # # Create a nucleic or amino acid sequence ! # dna = Bio::Sequence.auto('atgcatgcATGCATGCAAAA') ! # rna = Bio::Sequence.auto('augcaugcaugcaugcaaaa') ! # aa = Bio::Sequence.auto('ACDEFGHIKLMNPQRSTVWYU') ! # ! # # Print in FASTA format ! # puts dna.output(:fasta) ! # ! # # Print all codons ! # dna.window_search(3,3) do |codon| ! # puts codon ! # end ! # ! class Sequence ! ! # Create a new Bio::Sequence object ! # ! # s = Bio::Sequence.new('atgc') ! # puts s #=> 'atgc' ! # ! # Note that this method does not intialize the contained sequence ! # as any kind of bioruby object, only as a simple string ! # ! # puts s.seq.class #=> String ! # ! # See Bio::Sequence#na, Bio::Sequence#aa, and Bio::Sequence#auto ! # for methods to transform the basic String of a just created ! # Bio::Sequence object to a proper bioruby object ! # --- ! # *Arguments*: ! # * (required) _str_: String or Bio::Sequence::NA/AA object ! # *Returns*:: Bio::Sequence object ! def initialize(str) ! @seq = str ! end ! ! # The sequence identifier. For example, for a sequence ! # of Genbank origin, this is the accession number. ! attr_accessor :entry_id ! ! # An Array of Bio::Feature objects ! attr_accessor :features ! end # Sequence ! ! Preceding the class definition (<tt>class Sequence</tt>), there is at least a ! description and a usage example. Please use the +Description+ and +Usage+ ! headings. If appropriate, refer to other classes that interact with or are ! related to the class. ! ! The code in the usage example should, if possible, be in a format that a user ! can copy-and-paste into a new script to run. It should illustrate the most ! important uses of the class. If possible and if it would not clutter up the ! example too much, try to provide any input data directly into the usage example, ! instead of refering to ARGV or ARGF for input. ! dna = Bio::Sequence.auto('atgcatgcATGCATGCAAAA') ! Otherwise, describe the input shortly, for example: ! # input should be string consisting of nucleotides ! dna = Bio::Sequence.auto(ARGF.read) ! ! Methods should be preceded by a comment that describes what the method does, ! including any relevant usage examples. (In contrast to the documentation for ! the class itself, headings are not required.) In addition, any arguments should ! be listed, as well as the type of thing that is returned by the method. The ! format of this information is as follows: ! # --- ! # *Arguments*: ! # * (required) _str_: String or Bio::Sequence::NA ! # * (optional) _nr_: a number that means something ! # *Returns*:: true or false ! ! Attribute accessors can be preceded by a short description. ! ! == Exception handling ! ! Don't use ! $stderr.puts "WARNING" ! in your code. Instead, try to avoid printing error messages. For fatal errors, ! use +raise+ with an appropriate message. ! ! == Testing code should use 'test/unit' Unit tests should come with your modules by which you can assure what you meant to do with each method. The test code is useful to make ! maintenance easy and ensure stability. The use of ! if __FILE__ == $0 ! is deprecated. ! == Using autoload To quicken the initial load time we have replaced most of 'require' to *************** *** 135,139 **** so autoload can be written in 1 line. ! == Name space Your module should be located under the top-level module Bio and put under --- 239,243 ---- so autoload can be written in 1 line. ! = NAMESPACE Your module should be located under the top-level module Bio and put under *************** *** 151,161 **** If your module doesn't match any of the above, please propose ! an appropriate directory name when you contribute. ! == Maintenance Finally, please maintain the code you've contributed. The BioRuby staff is willing to give you CVS privileges if needed. ! ! =end --- 255,267 ---- If your module doesn't match any of the above, please propose ! an appropriate directory name when you contribute. Please let the staff ! discuss on namespaces (class names), API (method names) before commiting ! a new module or making changes on existing modules. ! = MAINTENANCE Finally, please maintain the code you've contributed. The BioRuby staff is willing to give you CVS privileges if needed. ! Please let us know (on the bioruby list) before you commit, so that users ! can discuss on the change. From aerts at dev.open-bio.org Tue May 16 05:50:16 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Tue, 16 May 2006 09:50:16 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl blast.rb,1.28,1.29 Message-ID: <200605160950.k4G9oGh7025496@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv25476 Modified Files: blast.rb Log Message: Added/reformatted docs. Index: blast.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast.rb,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** blast.rb 18 Feb 2006 16:08:10 -0000 1.28 --- blast.rb 16 May 2006 09:50:13 -0000 1.29 *************** *** 2,29 **** # = bio/appl/blast.rb - BLAST wrapper # ! # Copyright:: Copyright (C) 2001 ! # Mitsuteru C. Nakao <n at bioruby.org> ! # Copyrigth:: Copyright (C) 2002,2003 ! # KATAYAMA Toshiaki <k at bioruby.org> # License:: Ruby's # # $Id$ # ! # = Description ! # ! # = Examples # ! # program = 'blastp' ! # database = 'SWISS' ! # options = '-e 0.0001' ! # serv = Bio::Blast.new(program, database, options) ! # server = 'genomenet' ! # genomenet = Bio::Blast.remote(program, database, options, server) ! # report = serv.query(sequence_text) # # = References # # * http://www.ncbi.nlm.nih.gov/blast/ - # # * http://blast.genome.jp/ideas/ideas.html#blast # --- 2,20 ---- # = bio/appl/blast.rb - BLAST wrapper # ! # Copyright (C):: 2001 Mitsuteru C. Nakao <n at bioruby.org> ! # Copyright (C):: 2002,2003 KATAYAMA Toshiaki <k at bioruby.org> ! # Copyright (C):: 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # # License:: Ruby's # # $Id$ # ! # = DESCRIPTION # ! # This file holds the Bio::Blast class, which creates BLAST factories. # # = References # # * http://www.ncbi.nlm.nih.gov/blast/ # * http://blast.genome.jp/ideas/ideas.html#blast # *************** *** 36,72 **** module Bio ! # BLAST wrapper # ! # == Description # ! # A blastall program wrapper. # ! # == Examples # ! # program = 'blastp' ! # database = 'SWISS' ! # options = '-e 0.0001' ! # serv = Bio::Blast.new(program, database, options) ! # ! # server = 'genomenet' ! # genomenet = Bio::Blast.remote(program, database, options, server) ! # ! # report = serv.query(sequence_text) # ! # == Available databases for Blast.remote(@program, @db, option, 'genomenet') # ! # ----------+-------+--------------------------------------------------- ! # @program | query | @db (supported in GenomeNet) ! # ----------+-------+--------------------------------------------------- ! # blastp | AA | nr-aa, genes, vgenes.pep, swissprot, swissprot-upd, ! # ----------+-------+ pir, prf, pdbstr ! # blastx | NA | ! # ----------+-------+--------------------------------------------------- ! # blastn | NA | nr-nt, genbank-nonst, gbnonst-upd, dbest, dbgss, ! # ----------+-------+ htgs, dbsts, embl-nonst, embnonst-upd, epd, ! # tblastn | AA | genes-nt, genome, vgenes.nuc ! # ----------+-------+--------------------------------------------------- # ! # * See http://blast.genome.jp/ideas/ideas.html#blast for more details. # class Blast --- 27,77 ---- module Bio ! # = DESCRIPTION ! # ! # The Bio::Blast class contains methods for running local or remote BLAST ! # searches, as well as for parsing of the output of such BLASTs (i.e. the ! # BLAST reports). For more information on similarity searches and the BLAST ! # program, see http://www.ncbi.nlm.nih.gov/Education/BLASTinfo/similarity.html. # ! # = USAGE # ! # require 'bio' ! # ! # # To run an actual BLAST analysis: ! # # 1. create a BLAST factory ! # remote_blast_factory = Bio::Blast.remote('blastp', 'SWISS', ! # '-e 0.0001', 'genomenet') ! # #or: ! # local_blast_factory = Bio::Blast.local('blastn','/path/to/db') # ! # # 2. run the actual BLAST by querying the factory ! # report = remote_blast_factory.query(sequence_text) # ! # # Then, to parse the report, see Bio::Blast::Report # ! # == Available databases for Bio::Blast.remote # ! # ----------+-------+--------------------------------------------------- ! # program | query | db (supported in GenomeNet) ! # ----------+-------+--------------------------------------------------- ! # blastp | AA | nr-aa, genes, vgenes.pep, swissprot, swissprot-upd, ! # ----------+-------+ pir, prf, pdbstr ! # blastx | NA | ! # ----------+-------+--------------------------------------------------- ! # blastn | NA | nr-nt, genbank-nonst, gbnonst-upd, dbest, dbgss, ! # ----------+-------+ htgs, dbsts, embl-nonst, embnonst-upd, epd, ! # tblastn | AA | genes-nt, genome, vgenes.nuc ! # ----------+-------+--------------------------------------------------- # ! # = SEE ALSO ! # ! # * Bio::Blast::Report ! # * Bio::Blast::Report::Hit ! # * Bio::Blast::Report::Hsp ! # ! # = REFERENCE ! # ! # * http://www.ncbi.nlm.nih.gov/Education/BLASTinfo/similarity.html ! # * http://blast.genome.jp/ideas/ideas.html#blast # class Blast *************** *** 80,89 **** include Bio::Command::Tools ! # Sets up the blast program at the localhost def self.local(program, db, option = '') self.new(program, db, option, 'local') end ! # Sets up the blast program at the remote host (server) def self.remote(program, db, option = '', server = 'genomenet') self.new(program, db, option, server) --- 85,113 ---- include Bio::Command::Tools ! # This is a shortcut for Bio::Blast.new: ! # Bio::Blast.local(program, database, options) ! # is equivalent to ! # Bio::Blast.new(program, database, options, 'local') ! # --- ! # *Arguments*: ! # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx' ! # * _db_ (required): name of the local database ! # * _options_: blastall options \ ! # (see http://www.genome.jp/dbget-bin/show_man?blast2) ! # *Returns*:: Bio::Blast factory object def self.local(program, db, option = '') self.new(program, db, option, 'local') end ! # Bio::Blast.remote does exactly the same as Bio::Blast.new, but sets ! # the remote server 'genomenet' as its default. ! # --- ! # *Arguments*: ! # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx' ! # * _db_ (required): name of the remote database ! # * _options_: blastall options \ ! # (see http://www.genome.jp/dbget-bin/show_man?blast2) ! # * _server_: server to use (DEFAULT = 'genomenet') ! # *Returns*:: Bio::Blast factory object def self.remote(program, db, option = '', server = 'genomenet') self.new(program, db, option, server) *************** *** 107,120 **** ! # Program name for blastall -p (blastp, blastn, blastx, tblastn or tblastx). attr_accessor :program ! # Database name for blastall -d attr_accessor :db ! # Options for blastall attr_accessor :options ! # attr_accessor :server --- 131,145 ---- ! # Program name (_-p_ option for blastall): blastp, blastn, blastx, tblastn ! # or tblastx attr_accessor :program ! # Database name (_-d_ option for blastall) attr_accessor :db ! # Options for blastall attr_accessor :options ! # Server to submit the BLASTs to attr_accessor :server *************** *** 141,153 **** ! # Returns a blast factory object (Bio::Blast). ! # ! # --- Bio::Blast.new(program, db, option = '', server = 'local') ! # --- Bio::Blast.local(program, db, option = '') ! # --- Bio::Blast.remote(program, db, option = '', server = 'genomenet') ! # ! # For the develpper, you can add server 'hoge' by adding ! # exec_hoge(query) method. ! # def initialize(program, db, opt = [], server = 'local') @program = program --- 166,185 ---- ! # Creates a Bio::Blast factory object. ! # ! # To run any BLAST searches, a factory has to be created that describes a ! # certain BLAST pipeline: the program to use, the database to search, any ! # options and the server to use. E.g. ! # ! # blast_factory = Bio::Blast.new('blastn','dbsts', '-e 0.0001 -r 4', 'genomenet') ! # ! # --- ! # *Arguments*: ! # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx' ! # * _db_ (required): name of the (local or remote) database ! # * _options_: blastall options \ ! # (see http://www.genome.jp/dbget-bin/show_man?blast2) ! # * _server_: server to use (e.g. 'genomenet'; DEFAULT = 'local') ! # *Returns*:: Bio::Blast factory object def initialize(program, db, opt = [], server = 'local') @program = program *************** *** 178,187 **** end ! # Execute blast search and returns Report object (Bio::Blast::Report). def query(query) return self.send("exec_#{@server}", query.to_s) end ! # option reader def option # backward compatibility --- 210,228 ---- end ! # This method submits a sequence to a BLAST factory, which performs the ! # actual BLAST. ! # ! # fasta_sequences = Bio::FlatFile.open(Bio::FastaFormat, 'my_sequences.fa') ! # report = blast_factory.query(fasta_sequences) ! # ! # --- ! # *Arguments*: ! # * _query_ (required): single- or multiple-FASTA formatted sequence(s) ! # *Returns*:: a Bio::Blast::Report object def query(query) return self.send("exec_#{@server}", query.to_s) end ! # Returns options of blastall def option # backward compatibility *************** *** 189,193 **** end ! # option setter def option=(str) # backward compatibility --- 230,234 ---- end ! # Set options for blastall def option=(str) # backward compatibility *************** *** 285,303 **** end # module Bio - - if __FILE__ == $0 - begin - require 'pp' - alias p pp - rescue - end - - # serv = Bio::Blast.local('blastn', 'hoge.nuc') - # serv = Bio::Blast.local('blastp', 'hoge.pep') - serv = Bio::Blast.remote('blastp', 'genes') - - query = ARGF.read - p serv.query(query) - end - - --- 326,327 ---- From aerts at dev.open-bio.org Wed May 17 10:24:35 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Wed, 17 May 2006 14:24:35 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl emboss.rb,1.4,1.5 Message-ID: <200605171424.k4HEOZeG028646@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv28626 Modified Files: emboss.rb Log Message: Added/reformatted documentation. Index: emboss.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/emboss.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** emboss.rb 27 Feb 2006 09:14:30 -0000 1.4 --- emboss.rb 17 May 2006 14:24:33 -0000 1.5 *************** *** 2,36 **** # = bio/appl/emboss.rb - EMBOSS wrapper # ! # Copyright:: Copyright (C) 2002, 2005 ! # KATAYAMA Toshiaki <k at bioruby.org> # License:: Ruby's # # $Id$ # ! # == References # ! # * http://www.emboss.org # ! module Bio autoload :Command, 'bio/command' class EMBOSS extend Bio::Command::Tools ! def self.seqret(arg) str = self.retrieve('seqret', arg) end def self.entret(arg) str = self.retrieve('entret', arg) end def initialize(cmd_line) @cmd_line = cmd_line + ' -stdout -auto' end def exec begin --- 2,141 ---- # = bio/appl/emboss.rb - EMBOSS wrapper # ! # Copyright (C):: 2002, 2005 KATAYAMA Toshiaki <k at bioruby.org> ! # Copyright (C):: 2006 Aerts Jan <jan.aerts at bbsrc.ac.uk> ! # # License:: Ruby's # # $Id$ # ! # = DESCRIPTION # ! # This file holds classes pertaining to the EMBOSS software suite. # ! # = REFERENCES ! # ! # * http://emboss.sourceforge.net ! # * Rice P, Longden I and Bleasby A. \ ! # EMBOSS: the European Molecular Biology Open Software Suite. \ ! # Trends Genet. 2000 Jun ; 16(6): 276-7 module Bio autoload :Command, 'bio/command' + # = DESCRIPTION + # + # This class provides a wrapper for the applications of the EMBOSS suite, which + # is a mature and stable collection of open-source applications that can handle + # a huge range of sequence formats. + # Applications include: + # * Sequence alignment + # * Rapid database searching with sequence patterns + # * Protein motif identification, including domain analysis + # * Nucleotide sequence pattern analysis---for example to identify CpG islands or repeats + # * Codon usage analysis for small genomes + # * Rapid identification of sequence patterns in large scale sequence sets + # * Presentation tools for publication + # + # See the emboss website for more information: http://emboss.sourceforge.net. + # + # + # = USAGE + # + # require 'bio' + # + # # Suppose that you could get the sequence for XLRHODOP by running + # # the EMBOSS command +seqret embl:xlrhodop+ on the command line. + # # Then you can get the output of that command in a Bio::EMBOSS object + # # by creating a new Bio::EMBOSS object and subsequently executing it. + # xlrhodop = Bio::EMBOSS.new('seqret embl:xlrhodop') + # puts xlrhodop.exec + # + # # Or all in one go: + # puts Bio::EMBOSS.new('seqret embl:xlrhodop').exec + # + # # Similarly: + # puts Bio::EMBOSS.new('transeq -sbegin 110 -send 1171 embl:xlrhodop') + # puts Bio::EMBOSS.new('showfeat embl:xlrhodop').exec + # puts Bio::EMBOSS.new('seqret embl:xlrhodop -osformat acedb').exec + # + # # A shortcut exists for this two-step process for +seqret+ and +entret+. + # puts Bio::EMBOSS.seqret('embl:xlrhodop') + # puts Bio::EMBOSS.entret('embl:xlrhodop') + # + # = PREREQUISITES + # + # You must have the EMBOSS suite installed locally. You can download from the + # project website (see References below). + # + # = REFERENCES + # + # * http://emboss.sourceforge.net + # * Rice P, Longden I and Bleasby A. \ + # EMBOSS: the European Molecular Biology Open Software Suite. \ + # Trends Genet. 2000 Jun ; 16(6): 276-7 class EMBOSS extend Bio::Command::Tools ! ! # Combines the initialization and execution for the emboss +seqret+ command. ! # ! # puts Bio::EMBOSS.seqret('embl:xlrhodop') ! # ! # is equivalent to: ! # ! # object = Bio::EMBOSS.new('seqret embl:xlrhodop') ! # puts object.exec ! # --- ! # *Arguments*: ! # * (required) _command_: emboss command ! # *Returns*:: Bio::EMBOSS object def self.seqret(arg) str = self.retrieve('seqret', arg) end + # Combines the initialization and execution for the emboss +entret+ command. + # + # puts Bio::EMBOSS.entret('embl:xlrhodop') + # + # is equivalent to: + # + # object = Bio::EMBOSS.new('entret embl:xlrhodop') + # puts object.exec + # --- + # *Arguments*: + # * (required) _command_: emboss command + # *Returns*:: Bio::EMBOSS object def self.entret(arg) str = self.retrieve('entret', arg) end + # Initializes a new Bio::EMBOSS object. This provides a holder that can + # subsequently be executed (see Bio::EMBOSS.exec). The object does _not_ + # hold any actual data when initialized. + # + # e = Bio::EMBOSS.new('seqret embl:xlrhodop') + # + # For e to actually hold data, it has to be executed: + # puts e.exec + # + # For an overview of commands that can be used with this method, see the + # emboss website. + # --- + # *Arguments*: + # * (required) _command_: emboss command + # *Returns*:: Bio::EMBOSS object def initialize(cmd_line) @cmd_line = cmd_line + ' -stdout -auto' end + # A Bio::EMBOSS object has to be executed before it can return any result. + # obj_A = Bio::EMBOSS.new('transeq -sbegin 110 -send 1171 embl:xlrhodop') + # puts obj_A.result #=> nil + # obj_A.exec + # puts obj_A.result #=> a FASTA-formatted sequence + # + # obj_B = Bio::EMBOSS.new('showfeat embl:xlrhodop') + # obj_B.exec + # puts obj_B.result def exec begin *************** *** 42,46 **** end end ! attr_reader :io, :result private --- 147,156 ---- end end ! ! # Pipe for the command ! attr_reader :io ! ! # Result of the executed command ! attr_reader :result private *************** *** 59,61 **** end # Bio - --- 169,170 ---- From k at dev.open-bio.org Mon May 29 11:28:20 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 29 May 2006 15:28:20 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io soapwsdl.rb,1.4,1.5 Message-ID: <200605291528.k4TFSKmI027085@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv27081 Modified Files: soapwsdl.rb Log Message: * added list_methods method to display methods defined in the WSDL file Index: soapwsdl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/soapwsdl.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** soapwsdl.rb 8 May 2006 14:29:58 -0000 1.4 --- soapwsdl.rb 29 May 2006 15:28:18 -0000 1.5 *************** *** 24,33 **** # # --- soap_use_proxy # Set the value of this variable to 'on'. # # --- http_proxy # Set the URL of your proxy server (http://myproxy.com:8080 etc.). # ! # === Example # # % export soap_use_proxy=on --- 24,35 ---- # # --- soap_use_proxy + # # Set the value of this variable to 'on'. # # --- http_proxy + # # Set the URL of your proxy server (http://myproxy.com:8080 etc.). # ! # === Example to use HTTP proxy # # % export soap_use_proxy=on *************** *** 83,86 **** --- 85,94 ---- + # List of methods defined by WSDL + def list_methods + @driver.methods(false) + end + + def method_missing(*arg) @driver.send(*arg) From ngoto at dev.open-bio.org Tue May 30 09:59:38 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 30 May 2006 13:59:38 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.10,1.11 Message-ID: <200605301359.k4UDxcCa029505@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv29485/lib/bio Modified Files: command.rb Log Message: Bio::Command::Tools#call_command_local_fork is added, and some messeage are added. This is a temporary change. Bio::Command will be drastically changed later. Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** command.rb 9 May 2006 07:17:11 -0000 1.10 --- command.rb 30 May 2006 13:59:36 -0000 1.11 *************** *** 30,35 **** UNESCAPABLE_CHARS = /[\x00-\x08\x10-\x1a\x1c-\x1f\x7f\xff]/n ! #module_function ! private # Escape special characters in command line string for cmd.exe on Windows. --- 30,34 ---- UNESCAPABLE_CHARS = /[\x00-\x08\x10-\x1a\x1c-\x1f\x7f\xff]/n ! module_function # Escape special characters in command line string for cmd.exe on Windows. *************** *** 94,98 **** call_command_local_popen(cmd, query, &block) else ! call_command_local_open3(cmd, query, &block) end end --- 93,97 ---- call_command_local_popen(cmd, query, &block) else ! call_command_local_fork(cmd, query, &block) end end *************** *** 116,119 **** --- 115,142 ---- end + # Executes the program via fork (by using IO.popen("-")) and exec. + # If block is given, yield the block with input and output IO objects. + # + # From the view point of security, this method is recommended + # rather than exec_local_popen. + def call_command_local_fork(cmd, query = nil) + IO.popen("-", "r+") do |io| + if io then + # parent + if block_given? + yield io, io + else + io.sync = true + io.print query if query + io.close_write + io.read + end + else + # child + Kernel.exec(*cmd) + end + end + end + # Executes the program via Open3.popen3 # If block is given, yield the block with input and output IO objects. *************** *** 193,197 **** # (Note that Content-Type and Content-Length are automatically # set by default.) ! # +uri+ must be a URI object and +params+ must be a hash. # def post_form(uri, params, header = {}) --- 216,221 ---- # (Note that Content-Type and Content-Length are automatically # set by default.) ! # +uri+ must be a URI object, +params+ must be a hash, and ! # +header+ must be a hash. # def post_form(uri, params, header = {}) From nakao at dev.open-bio.org Tue May 2 10:29:21 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Tue, 02 May 2006 10:29:21 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio/appl test_pts1.rb,NONE,1.1 Message-ID: <200605021029.k42ATLXP009741@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv9719/test/unit/bio/appl Added Files: test_pts1.rb Log Message: * pts1.rb: intial import. * test_pts1.rb: intial import. --- NEW FILE: test_pts1.rb --- # # = test/unit/bio/appl/test_pts1.rb - Unit test for Bio::PTS1 # # Copyright:: Copyright (C) 2006 # Mitsuteru Nakao <n at bioruby.org> # License:: Ruby's # # $Id: test_pts1.rb,v 1.1 2006/05/02 10:29:19 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/appl/pts1' module Bio class TestPTS1Constant < Test::Unit::TestCase def test_FUNCTION keys = ['METAZOA-specific','FUNGI-specific','GENERAL'].sort assert_equal(keys, Bio::PTS1::FUNCTION.keys.sort) end end class TestPTS1New < Test::Unit::TestCase def test_metazoa pts1 = Bio::PTS1.new_with_metazoa_function assert_equal('METAZOA-specific', pts1.function) end def test_fungi pts1 = Bio::PTS1.new_with_fungi_function assert_equal('FUNGI-specific', pts1.function) end def test_general pts1 = Bio::PTS1.new_with_general_function assert_equal('GENERAL', pts1.function) end end class TestPTS1 < Test::Unit::TestCase def setup @seq =<<END >AB000464 MRTGGDNAGPSHSHIKRLPTSGLSTWLQGTQTCVLHLPTGTRPPAHHPLLGYSSRRSYRL LENPAAGCWARFSFCQGAAWDWDLEGVQWLRALAGGVSTAPSAPPGNLVFLSVSIFLCGS LLLETCPAYFSSLDPD* END @serv = Bio::PTS1.new end def test_function_set @serv.function("GENERAL") assert_equal("GENERAL", @serv.function) end def test_function_show assert_equal("METAZOA-specific", @serv.function) end def test_function_set_number_1 @serv.function(1) assert_equal("METAZOA-specific", @serv.function) end def test_function_set_number_2 @serv.function(2) assert_equal("FUNGI-specific", @serv.function) end def test_function_set_number_3 @serv.function(3) assert_equal("GENERAL", @serv.function) end def test_exec report = @serv.exec(@seq) assert_equal(Bio::PTS1::Report, report.class) end def test_exec_with_faa report = @serv.exec(Bio::FastaFormat.new(@seq)) assert_equal(Bio::PTS1::Report, report.class) end end class TestPTS1Report < Test::Unit::TestCase def setup serv = Bio::PTS1.new seq = ">hoge\nAVSFLSMRRARL\n" @report = serv.exec(seq) end def test_output_size assert_equal(1634, @report.output.size) end def test_prediction assert_equal("Targeted", @report.prediction) end def test_cterm assert_equal("AVSFLSMRRARL", @report.cterm) end def test_score assert_equal("7.559", @report.score) end def test_fp assert_equal("2.5e-04", @report.fp) end def test_sppta assert_equal("-5.833", @report.sppta) end def test_spptna assert_equal("-1.698", @report.spptna) end def test_profile assert_equal("15.091", @report.profile) end end end From nakao at dev.open-bio.org Tue May 2 10:29:21 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Tue, 02 May 2006 10:29:21 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl pts1.rb,NONE,1.1 Message-ID: <200605021029.k42ATLQu009746@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv9719/lib/bio/appl Added Files: pts1.rb Log Message: * pts1.rb: intial import. * test_pts1.rb: intial import. --- NEW FILE: pts1.rb --- module Bio # # = bio/appl/pts1.rb - A web service client of PTS1, predicting for the # peroxisomal targeting signal type 1. # # Copyright:: Copyright (C) 2006 # Mitsuteru C. Nakao <n at bioruby.org> # License:: Ruby's # # $Id: pts1.rb,v 1.1 2006/05/02 10:29:19 nakao Exp $ # require 'uri' require 'net/http' require 'bio/db/fasta' require 'bio/command' # = Bio::PTS1 - A web service client class for PTS1 predictor. # # == Peroxisomal targeting signal type 1 (PTS1) predictor # # Bio::PTS1 class is a client of the PTS1 predictor. # # == Examples # # require 'bio' # sp = Bio::SPTR.new(Bio::Fetch.query("sp", "p53_human")) # faa = sp.seq.to_fasta(sp.entry_id) # pts1 = Bio::PTS1.new # report = pts1.exec_remote(faa) # report.output #=> "<HTML>\n<HEAD><TITLE>PTS1 Prediction Server ..." # report.prediction #=> "Not targeted" # report.cterm #=> "KLMFKTEGPDSD" # report.score #=> "-79.881" # report.fp #=> "67.79%" # report.sppta #=> "-1.110" # report.spptna #=> "-41.937" # report.profile #=> "-36.834" # # == References # # * The PTS1 predictor # http://mendel.imp.ac.at/mendeljsp/sat/pts1/PTS1predictor.jsp # # * Neuberger G, Maurer-Stroh S, Eisenhaber B, Hartig A, Eisenhaber F. # Motif refinement of the peroxisomal targeting signal 1 and evaluation # of taxon-specific differences. # J Mol Biol. 2003 May 2;328(3):567-79. PMID: 12706717 # # * Neuberger G, Maurer-Stroh S, Eisenhaber B, Hartig A, Eisenhaber F. # Prediction of peroxisomal targeting signal 1 containing proteins from # amino acid sequence. # J Mol Biol. 2003 May 2;328(3):581-92. PMID: 12706718 # class PTS1 # Organism specific parameter value: function names. FUNCTION = { 'METAZOA-specific' => 1, 'FUNGI-specific' => 2, 'GENERAL' => 3, } # Output report. attr_reader :output # Used function name (Integer). # function_name = Bio::PTS1::FUNCTION.find_all {|k,v| v == pts1.function }[0][0] attr_reader :function # Short-cut for Bio::PTS1.new(Bio::PTS1::FUNCTION['METAZOA-specific']) def self.new_with_metazoa_function self.new('METAZOA-specific') end # Short-cut for Bio::PTS1.new(Bio::PTS1::FUNCTION['FUNGI-specific']) def self.new_with_fungi_function self.new('FUNGI-specific') end # Short-cut for Bio::PTS1.new(Bio::PTS1::FUNCTION['GENERAL']) def self.new_with_general_function self.new('GENERAL') end # Constructs Bio::PTS1 web service client. # # == Examples # # serv_default_metazoa_specific = Bio::PTS1.new # serv_general_function = Bio::PTS1.new('GENERAL') # serv_fungi_specific = Bio::PTS1.new(2) # See Bio::PTS1::FUNCTION. # def initialize(func = 'METAZOA-specific') @host = "mendel.imp.ac.at" @cgi_path = "/sat/pts1/cgi-bin/pts1.cgi" @output = nil @function = function(func) end # Sets and shows the function parameter. # # Organism specific parameter: function names (Bio::PTS1::FUNTION.keys). # # # == Examples # # # sets function name parameter. # serv = Bio::PTS1.new # serv.function('METAZOA-specific') # # # shows function name parameter. # serv.function #=> "METAZOA-specific" # def function(func = nil) return @function.keys.to_s if func == nil if FUNCTION.values.include?(func) @function = Hash[*FUNCTION.find {|x| x[1] == func}] elsif FUNCTION[func] @function = {func => FUNCTION[func]} else raise ArgumentError, "Invalid argument: #{func}", "Available function names: #{FUNCTION.keys.inspect}" end @function end # Executes the query request and returns result output in Bio::PTS1::Report. # The query argument is available both aSting in fasta format text and # aBio::FastaFormat. # # == Examples # # require 'bio' # pts1 = Bio::PTS1.new # pts1.exec(">title\nKLMFKTEGPDSD") # # pts1.exec(Bio::FastaFormat.new(">title\nKLMFKTEGPDSD")) # def exec(query) seq = set_sequence_in_fastaformat(query) @form_data = {'function' => @function.values, 'sequence' => seq.seq, 'name' => seq.definition } @uri = URI.parse(["http:/", @host, @cgi_path].join('/')) result = nil # The server cannot understand a POST request by folowing codes, but # request by the Net::HTTP.post_form method is OK. # # Bio::Command::NetTools.net_http_start(@uri.host) {|http| # result, = http.post(@uri.path, @form_data) # @output = Report.new(result.body) # } # result, = Net::HTTP.post_form(@uri, @form_data) @output = Report.new(result.body) return @output end private # Sets query sequence in Fasta Format if any. def set_sequence_in_fastaformat(query) if query.class == Bio::FastaFormat return query else return Bio::FastaFormat.new(query) end end # = Parser for the PTS1 prediction Report (in HTML). # # class Report # Amino acids subsequence at C-terminal region. attr_reader :cterm # Score attr_reader :score # Profile attr_reader :profile # S_ppt (non accessibility) attr_reader :spptna # S_ppt (accessibility) attr_reader :sppta # False positive probability attr_reader :fp # Prediction ("Targeted", "Twilight zone" and "Not targeted") attr_reader :prediction # Raw output attr_reader :output # Parsing PTS1 HTML report. # # == Example # # report = Bio::PTS1::Report.new(str) # report.cterm # def initialize(str) @cterm = '' @score = 0 @profile = 0 @spptna = 0 @sppta = 0 @fp = 0 @prediction = 0 if /PTS1 query prediction/m =~ str @output = str parse else raise end end private def parse @output.each do |line| case line when /C-terminus<\/td><td>(\w+)<\/td>/ @cterm = $1 when /Score<\/b><td><b>(-?\d.+?)<\/b><\/td><\/tr>/ @score = $1 when /Profile<\/i><\/td><td>(.+?)<\/td>/ @profile = $1 when /S_ppt \(non-accessibility\)<\/i><\/td><td>(.+?)<\/td>/ @spptna = $1 when /S_ppt \(accessibility\)<\/i><\/td><td>(.+?)<\/td>/ @sppta = $1 when /P\(false positive\)<\/i><\/td><td>(.+?)<\/td>/ @fp = $1 when /Prediction classification<\/i><\/td><td>(\w.+?)<\/td>/ @prediction = $1 else end end end end # class Report end # class PTS1 end # module Bio From nakao at dev.open-bio.org Wed May 3 00:08:01 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Wed, 03 May 2006 00:08:01 +0000 Subject: [BioRuby-cvs] bioruby ChangeLog,1.51,1.52 Message-ID: <200605030008.k43081Mh012644@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv12624 Modified Files: ChangeLog Log Message: * Added comment for lib/bio/appl/pts1.rb. Index: ChangeLog =================================================================== RCS file: /home/repository/bioruby/bioruby/ChangeLog,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** ChangeLog 14 Apr 2006 06:33:19 -0000 1.51 --- ChangeLog 3 May 2006 00:07:58 -0000 1.52 *************** *** 1,2 **** --- 1,8 ---- + 2006-05-02 Mitsuteru Nakao <n at bioruby.org> + + * lib/bio/appl/pts1.rb + + Bio::PTS1 first commit. + 2006-04-14 Mitsuteru Nakao <n at bioruby.org> From aerts at dev.open-bio.org Thu May 4 13:13:00 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 13:13:00 +0000 Subject: [BioRuby-cvs] bioruby/lib bio.rb,1.67,1.68 Message-ID: <200605041313.k44DD0bj018980@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib In directory dev.open-bio.org:/tmp/cvs-serv18960 Modified Files: bio.rb Log Message: Added autoload for bio/map.rb Index: bio.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio.rb,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** bio.rb 27 Apr 2006 09:29:35 -0000 1.67 --- bio.rb 4 May 2006 13:12:57 -0000 1.68 *************** *** 44,47 **** --- 44,50 ---- + ## Map + autoload :Map, 'bio/map' + ### Constants From aerts at dev.open-bio.org Thu May 4 13:13:59 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 13:13:59 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio location.rb,0.23,0.24 Message-ID: <200605041313.k44DDx4G019008@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv18988 Modified Files: location.rb Log Message: Added method <=> and mixed in Comparable Index: location.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/location.rb,v retrieving revision 0.23 retrieving revision 0.24 diff -C2 -d -r0.23 -r0.24 *** location.rb 20 Apr 2006 15:58:34 -0000 0.23 --- location.rb 4 May 2006 13:13:57 -0000 0.24 *************** *** 45,49 **** # 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. --- 45,50 ---- # end class Location ! include Comparable ! # 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. *************** *** 130,133 **** --- 131,166 ---- end + # Check where a Bio::Location object is located compared to another + # Bio::Location object (mainly to facilitate the use of Comparable). + # A location A is upstream of location B if the start position of location A + # is smaller than the start position of location B. If they're the same, the + # end positions are checked. + # --- + # *Arguments*: + # * (required) _other location_: a Bio::Location object + # *Returns*:: + # * 1 if self < other location + # * -1 if self > other location + # * 0 if both location are the same + # * nil if the argument is not a Bio::Location object + def <=>(other) + if ! other.kind_of?(Bio::Location) + return nil + end + + if @from.to_f < other.from.to_f + return -1 + elsif @from.to_f > other.from.to_f + return 1 + end + + if @to.to_f < other.to.to_f + return -1 + elsif @to.to_f > other.to.to_f + return 1 + end + return 0 + end + end # class location From aerts at dev.open-bio.org Thu May 4 13:26:06 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 13:26:06 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio map.rb,NONE,1.1 Message-ID: <200605041326.k44DQ62t019080@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv19039 Added Files: map.rb Log Message: New module that can describe mapping information: maps, markers, and the links between them. It also describes the modules ActsLikeMap and ActsLikeMarker that can be mixed into other classes (e.g. to enable clones to act as maps for BAC end-sequences). --- NEW FILE: map.rb --- # # = bio/map.rb - biological mapping class # # Copyright:: Copyright (C) 2006 # Jan Aerts <jan.aerts at bbsrc.ac.uk> # License:: Ruby's module Bio # = DESCRIPTION # The Bio::Module contains classes that describe mapping information and can # be used to contain linkage maps, radiation-hybrid maps, etc. # As the same marker can be mapped to more than one map, and a single map # typically contains more than one marker, the link between the markers and # maps is handled by Bio::Map::Mapping objects. Therefore, to link a map to # a marker, a Bio::Mapping object is added to that Bio::Map. See usage below. # # Not only maps in the strict sense have map-like features (and similarly # not only markers in the strict sense have marker-like features). For example, # a microsatellite is something that can be mapped on a linkage map (and # hence becomes a 'marker'), but a clone can also be mapped to a cytogenetic # map. In that case, the clone acts as a marker and has marker-like properties. # That same clone can also be considered a 'map' when BAC-end sequences are # mapped to it. To reflect this flexibility, the modules Bio::Map::ActsLikeMap # and Bio::Map::ActsLikeMarker define methods that are typical for maps and # markers. # #-- # In a certain sense, a biological sequence also has map- and marker-like # properties: things can be mapped to it at certain locations, and the sequence # itself can be mapped to something else (e.g. the BAC-end sequence example # above, or a BLAST-result). #++ # # = USAGE # marker_a = Bio::Map::Marker.new('marker_a') # marker_b = Bio::Map::Marker.new('marker_b') # map_A = Bio::Map::SimpleMap.new('map_A', 'linkage', 'cM') # puts map_A.contains_marker?('marker_b') # method defined in Bio::Map::ActsLikeMap # # = TODO # Check if initialization of @mappings can be done in ActsLikeMap and # ActsLikeMarker, instead of in the classes that include these modules. module Map # = DESCRIPTION # The Bio::Map::ActsLikeMap module contains methods that are typical for # map-like things: # * add markers with their locations (through Bio::Map::Mappings) # * check if a given marker is mapped to it # , and can be mixed into other classes (e.g. Bio::Map::SimpleMap) module ActsLikeMap include Enumerable # = DESCRIPTION # Adds a Bio::Map::Mappings object to its array of mappings. # # = USAGE # # suppose we have a Bio::Map::SimpleMap object called my_map # my_map.add_mapping(Bio::Map::Marker.new('marker_a'), '5') # --- # *Arguments*: # * _marker_ (required): Bio::Map::Marker object # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself def add_mapping(marker, location = nil) unless marker.class.include?(Bio::Map::ActsLikeMarker) raise "[Error] marker is not object that implements Bio::Map::ActsLikeMarker" end my_mapping = Bio::Map::Mapping.new(self, marker, Bio::Location.new(location)) @mappings.push(my_mapping) unless marker.mapped_to?(self) marker.mappings.push(my_mapping) end return self end # Checks whether a Bio::Map::Marker is mapped to this Bio::Map::SimpleMap. # --- # *Arguments*: # * _marker_: a Bio::Map::Marker object # *Returns*:: true or false def contains_marker?(marker) unless marker.class.include?(Bio::Map::ActsLikeMarker) raise "[Error] marker is not object that implements Bio::Map::ActsLikeMarker" end contains = false @mappings.each do |mapping| if mapping.marker == marker contains = true return contains end end return contains end # Go through all Bio::Map::Mapping objects linked to this Bio::Map::SimpleMap. def each @mappings.each do |mapping| yield mapping end end end #ActsLikeMap # = DESCRIPTION # The Bio::Map::ActsLikeMarker module contains methods that are typical for # marker-like things: # * map it to one or more maps # * check if it's mapped to a given map # , and can be mixed into other classes (e.g. Bio::Map::Marker) module ActsLikeMarker include Enumerable # = DESCRIPTION # Adds a Bio::Map::Mappings object to its array of mappings. # # = USAGE # # suppose we have a Bio::Map::Marker object called marker_a # marker_a.add_mapping(Bio::Map::SimpleMap.new('my_map'), '5') # --- # *Arguments*: # * _map_ (required): Bio::Map::SimpleMap object # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself def add_mapping (map, location = nil) unless map.class.include?(Bio::Map::ActsLikeMap) raise "[Error] map is not object that implements Bio::Map::ActsLikeMap" end my_mapping = Bio::Map::Mapping.new(map, self, Bio::Location.new(location)) @mappings.push(my_mapping) unless map.contains_marker?(self) map.mappings.push(my_mapping) end end # Check whether this marker is mapped to a given Bio::Map::SimpleMap. # --- # *Arguments*: # * _map_: a Bio::Map::SimpleMap object # *Returns*:: true or false def mapped_to?(map) unless map.class.include?(Bio::Map::ActsLikeMap) raise "[Error] map is not object that implements Bio::Map::ActsLikeMap" end mapped = false @mappings.each do |mapping| if mapping.map == map mapped = true return mapped end end return mapped end # Go through all Mapping objects linked to this marker. def each @mappings.each do |mapping| yield mapping end end end #ActsLikeMarker # = DESCRIPTION # Creates a new Bio::Map::Mapping object, which links Bio::Map::ActsAsMap- # and Bio::Map::ActsAsMarker-like objects. This class is typically not # accessed directly, but through map- or marker-like objects. class Mapping include Comparable # Creates a new Bio::Map::Mapping object # --- # *Arguments*: # * _map_: a Bio::Map::SimpleMap object # * _marker_: a Bio::Map::Marker object # * _location_: a Bio::Location object def initialize (map, marker, location = nil) @map, @marker, @location = map, marker, location end attr_accessor :map, :marker, :location # Compares the location of this mapping to another mapping. # --- # *Arguments*: # * other_mapping: Bio::Map::Mapping object # *Returns*:: # * 1 if self < other location # * -1 if self > other location # * 0 if both location are the same # * nil if the argument is not a Bio::Location object def <=>(other) unless other.kind_of(Bio::Map::Mapping) raise "[Error] markers are not comparable" end return self.location.<=>(other.location) end end # Mapping # = DESCRIPTION # This class handles the essential storage of name, type and units of a map. # It includes Bio::Map::ActsLikeMap, and therefore supports the methods of # that module. # # = USAGE # my_map1 = Bio::Map::SimpleMap.new('RH_map_ABC (2006)', 'RH', 'cR') # my_map1.add_marker(Bio::Map::Marker.new('marker_a', '17') # my_map1.add_marker(Bio::Map::Marker.new('marker_b', '5') class SimpleMap include ActsLikeMap # Builds a new Bio::Map::SimpleMap object # --- # *Arguments*: # * name: name of the map # * type: type of the map (e.g. linkage, radiation_hybrid, cytogenetic, ...) # * units: unit of the map (e.g. cM, cR, ...) # *Returns*:: new Bio::Map::SimpleMap object def initialize (name = nil, type = nil, units = nil) @name, @type, @units = name, type, units @mappings = Array.new end # Name of the map attr_accessor :name # Type of the map attr_accessor :type # Units of the map attr_accessor :units # Array of mappings for the map attr_accessor :mappings end # SimpleMap # = DESCRIPTION # This class handles markers that are anchored to a Bio::Map::SimpleMap. It # includes Bio::Map::ActsLikeMarker, and therefore supports the methods of # that module. # # = USAGE # marker_a = Bio::Map::Marker.new('marker_a') # marker_b = Bio::Map::Marker.new('marker_b') class Marker include ActsLikeMarker # Builds a new Bio::Map::Marker object # --- # *Arguments*: # * name: name of the marker # *Returns*:: new Bio::Map::Marker object def initialize(name) @name = name @mappings = Array.new end # Name of the marker attr_accessor :name # Array of mappings for the marker :mappings end # Marker end # Map end # Bio if __FILE__ == $0 my_marker1 = Bio::Map::Marker.new('marker1') # my_marker2 = Bio::Map::Marker.new('marker2') my_marker3 = Bio::Map::Marker.new('marker3') my_map1 = Bio::Map::SimpleMap.new('RH_map_ABC (2006)', 'RH', 'cR') my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') my_map1.add_mapping(my_marker1, '17') my_map1.add_mapping(Bio::Map::Marker.new('marker2'), '5') my_marker3.add_mapping(my_map1, '9') puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s puts "Does my_map2 contain marker3? => " + my_map2.contains_marker?(my_marker3).to_s my_map1.sort.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s end puts my_map1.min.marker.name my_map2.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s end # p my_map1.between?(my_mappable2,my_mappable3) # p my_map1.between?(my_mappable,my_mappable2) end From aerts at dev.open-bio.org Thu May 4 13:36:18 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 13:36:18 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio map.rb,1.1,1.2 Message-ID: <200605041336.k44DaIJA019148@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv19128 Modified Files: map.rb Log Message: * require 'bio/location' * attr_accessor bug for @mappings in Bio::Map::Marker solved Index: map.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/map.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** map.rb 4 May 2006 13:26:04 -0000 1.1 --- map.rb 4 May 2006 13:36:16 -0000 1.2 *************** *** 5,8 **** --- 5,10 ---- # Jan Aerts <jan.aerts at bbsrc.ac.uk> # License:: Ruby's + require 'bio/location' + module Bio # = DESCRIPTION *************** *** 32,39 **** # # = USAGE ! # marker_a = Bio::Map::Marker.new('marker_a') ! # marker_b = Bio::Map::Marker.new('marker_b') ! # map_A = Bio::Map::SimpleMap.new('map_A', 'linkage', 'cM') ! # puts map_A.contains_marker?('marker_b') # method defined in Bio::Map::ActsLikeMap # # = TODO --- 34,58 ---- # # = USAGE ! # my_marker1 = Bio::Map::Marker.new('marker1') ! # my_marker2 = Bio::Map::Marker.new('marker2') ! # my_marker3 = Bio::Map::Marker.new('marker3') ! # ! # my_map1 = Bio::Map::SimpleMap.new('RH_map_ABC (2006)', 'RH', 'cR') ! # my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') ! # ! # my_map1.add_mapping(my_marker1, '17') ! # my_map1.add_mapping(Bio::Map::Marker.new('marker2'), '5') ! # my_marker3.add_mapping(my_map1, '9') ! # ! # puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s ! # puts "Does my_map2 contain marker3? => " + my_map2.contains_marker?(my_marker3).to_s ! # ! # my_map1.sort.each do |mapping| ! # puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s ! # end ! # puts my_map1.min.marker.name ! # my_map2.each do |mapping| ! # puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s ! # end # # = TODO *************** *** 187,191 **** # * nil if the argument is not a Bio::Location object def <=>(other) ! unless other.kind_of(Bio::Map::Mapping) raise "[Error] markers are not comparable" end --- 206,210 ---- # * nil if the argument is not a Bio::Location object def <=>(other) ! unless other.kind_of?(Bio::Map::Mapping) raise "[Error] markers are not comparable" end *************** *** 256,260 **** # Array of mappings for the marker ! :mappings end # Marker end # Map --- 275,279 ---- # Array of mappings for the marker ! attr_accessor :mappings end # Marker end # Map From aerts at dev.open-bio.org Thu May 4 13:59:20 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 13:59:20 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio map.rb,1.2,1.3 Message-ID: <200605041359.k44DxKdd019218@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv19198 Modified Files: map.rb Log Message: Changed names of add_mapping methods in Bio::Map::ActsLikeMap and Bio::Map::ActsLikeMarker to prevent naming conflicts for classes that would mix in both modules. Index: map.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/map.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** map.rb 4 May 2006 13:36:16 -0000 1.2 --- map.rb 4 May 2006 13:59:18 -0000 1.3 *************** *** 79,83 **** # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself ! def add_mapping(marker, location = nil) unless marker.class.include?(Bio::Map::ActsLikeMarker) raise "[Error] marker is not object that implements Bio::Map::ActsLikeMarker" --- 79,83 ---- # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself ! def add_mapping_to_marker(marker, location = nil) unless marker.class.include?(Bio::Map::ActsLikeMarker) raise "[Error] marker is not object that implements Bio::Map::ActsLikeMarker" *************** *** 139,143 **** # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself ! def add_mapping (map, location = nil) unless map.class.include?(Bio::Map::ActsLikeMap) raise "[Error] map is not object that implements Bio::Map::ActsLikeMap" --- 139,143 ---- # * _location_: location of mapping. Should be a _string_, not a _number_. # *Returns*:: itself ! def add_mapping_to_map(map, location = nil) unless map.class.include?(Bio::Map::ActsLikeMap) raise "[Error] map is not object that implements Bio::Map::ActsLikeMap" *************** *** 288,294 **** my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') ! my_map1.add_mapping(my_marker1, '17') ! my_map1.add_mapping(Bio::Map::Marker.new('marker2'), '5') ! my_marker3.add_mapping(my_map1, '9') --- 288,294 ---- my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') ! my_map1.add_mapping_to_marker(my_marker1, '17') ! my_map1.add_mapping_to_marker(Bio::Map::Marker.new('marker2'), '5') ! my_marker3.add_mapping_to_map(my_map1, '9') From aerts at dev.open-bio.org Thu May 4 16:20:52 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 16:20:52 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio map.rb,1.3,1.4 Message-ID: <200605041620.k44GKqiM019742@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv19722 Modified Files: map.rb Log Message: Correction of documentation of add_mapping Index: map.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/map.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** map.rb 4 May 2006 13:59:18 -0000 1.3 --- map.rb 4 May 2006 16:20:50 -0000 1.4 *************** *** 41,47 **** # my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') # ! # my_map1.add_mapping(my_marker1, '17') ! # my_map1.add_mapping(Bio::Map::Marker.new('marker2'), '5') ! # my_marker3.add_mapping(my_map1, '9') # # puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s --- 41,47 ---- # my_map2 = Bio::Map::SimpleMap.new('consensus', 'linkage', 'cM') # ! # my_map1.add_mapping_to_marker(my_marker1, '17') ! # my_map1.add_mapping_to_marker(Bio::Map::Marker.new('marker2'), '5') ! # my_marker3.add_mapping_to_marker(my_map1, '9') # # puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s *************** *** 73,77 **** # = USAGE # # suppose we have a Bio::Map::SimpleMap object called my_map ! # my_map.add_mapping(Bio::Map::Marker.new('marker_a'), '5') # --- # *Arguments*: --- 73,77 ---- # = USAGE # # suppose we have a Bio::Map::SimpleMap object called my_map ! # my_map.add_mapping_to_marker(Bio::Map::Marker.new('marker_a'), '5') # --- # *Arguments*: *************** *** 133,137 **** # = USAGE # # suppose we have a Bio::Map::Marker object called marker_a ! # marker_a.add_mapping(Bio::Map::SimpleMap.new('my_map'), '5') # --- # *Arguments*: --- 133,137 ---- # = USAGE # # suppose we have a Bio::Map::Marker object called marker_a ! # marker_a.add_mapping_to_map(Bio::Map::SimpleMap.new('my_map'), '5') # --- # *Arguments*: From aerts at dev.open-bio.org Thu May 4 16:19:54 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 16:19:54 +0000 Subject: [BioRuby-cvs] bioruby/test/unit/bio test_map.rb,NONE,1.1 Message-ID: <200605041619.k44GJsO0019694@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/test/unit/bio In directory dev.open-bio.org:/tmp/cvs-serv19674 Added Files: test_map.rb Log Message: Unit tests for bio/map.rb --- NEW FILE: test_map.rb --- # # = test/unit/bio/test_map.rb - Unit test for Bio::Map # # Copyright:: Copyright (C) 2006 # Jan Aerts <jan.aerts at bbsrc.ac.uk> # License:: Ruby's require 'pathname' libpath = Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3, 'lib')).cleanpath.to_s $:.unshift(libpath) unless $:.include?(libpath) require 'test/unit' require 'bio/map' module Bio class TestMapSimple < Test::Unit::TestCase def setup @marker1 = Bio::Map::Marker.new('marker1') @marker2 = Bio::Map::Marker.new('marker2') @map1 = Bio::Map::SimpleMap.new('map1', 'some_type', 'some_unit') end def test_attributes assert_equal("marker1", @marker1.name) assert_equal("marker2", @marker2.name) assert_equal([], @marker1.mappings) assert_equal([], @marker2.mappings) assert_equal("map1", @map1.name) assert_equal("some_unit", @map1.units) assert_equal("some_type", @map1.type) assert_equal([], @map1.mappings) end end class TestMapping < Test::Unit::TestCase def setup @marker1 = Bio::Map::Marker.new('marker1') @marker2 = Bio::Map::Marker.new('marker2') @map1 = Bio::Map::SimpleMap.new('map1', 'some_type', 'some_unit') end def test_add_mapping_to_marker @map1.add_mapping_to_marker(@marker2, '5') assert_equal(1, @map1.mappings.length) assert_equal(1, @marker2.mappings.length) assert_equal(0, @marker1.mappings.length) assert_kind_of(Bio::Location, @map1.mappings[0].location) assert_kind_of(Bio::Location, @marker2.mappings[0].location) end def test_add_mapping_to_map @marker1.add_mapping_to_map(@map1, '5') assert_equal(1, @map1.mappings.length) assert_equal(1, @marker1.mappings.length) assert_kind_of(Bio::Location, @map1.mappings[0].location) assert_kind_of(Bio::Location, @marker1.mappings[0].location) end end class CloneActsLikeMap include Bio::Map::ActsLikeMap end class TestActsLikeMap < Test::Unit::TestCase def test_mixin clone = CloneActsLikeMap.new assert_instance_of(CloneActsLikeMap, clone) assert_respond_to(clone, 'contains_marker?') assert_respond_to(clone, 'add_mapping_to_marker') end end class CloneActsLikeMarker include Bio::Map::ActsLikeMarker end class TestActsLikeMarker < Test::Unit::TestCase def test_mixin clone = CloneActsLikeMarker.new assert_instance_of(CloneActsLikeMarker, clone) assert_respond_to(clone, 'mapped_to?') assert_respond_to(clone, 'add_mapping_to_map') end end class CloneActsLikeMapAndMarker include Bio::Map::ActsLikeMap include Bio::Map::ActsLikeMarker end class TestActsLikeMapAndMarker < Test::Unit::TestCase def test_mixin clone = CloneActsLikeMapAndMarker.new assert_instance_of(CloneActsLikeMapAndMarker, clone) assert_respond_to(clone, 'contains_marker?') assert_respond_to(clone, 'add_mapping_to_marker') assert_respond_to(clone, 'mapped_to?') assert_respond_to(clone, 'add_mapping_to_map') end end end From aerts at dev.open-bio.org Thu May 4 18:40:28 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 18:40:28 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio location.rb,0.24,0.25 Message-ID: <200605041840.k44IeSIA021244@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv21224 Modified Files: location.rb Log Message: Line formatting Index: location.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/location.rb,v retrieving revision 0.24 retrieving revision 0.25 diff -C2 -d -r0.24 -r0.25 *** location.rb 4 May 2006 13:13:57 -0000 0.24 --- location.rb 4 May 2006 18:40:26 -0000 0.25 *************** *** 131,165 **** end ! # Check where a Bio::Location object is located compared to another ! # Bio::Location object (mainly to facilitate the use of Comparable). ! # A location A is upstream of location B if the start position of location A ! # is smaller than the start position of location B. If they're the same, the ! # end positions are checked. ! # --- ! # *Arguments*: ! # * (required) _other location_: a Bio::Location object ! # *Returns*:: ! # * 1 if self < other location ! # * -1 if self > other location ! # * 0 if both location are the same ! # * nil if the argument is not a Bio::Location object ! def <=>(other) ! if ! other.kind_of?(Bio::Location) ! return nil ! end ! ! if @from.to_f < other.from.to_f return -1 ! elsif @from.to_f > other.from.to_f ! return 1 ! end ! ! if @to.to_f < other.to.to_f return -1 ! elsif @to.to_f > other.to.to_f ! return 1 ! end return 0 ! end end # class location --- 131,165 ---- end ! # Check where a Bio::Location object is located compared to another ! # Bio::Location object (mainly to facilitate the use of Comparable). ! # A location A is upstream of location B if the start position of location A ! # is smaller than the start position of location B. If they're the same, the ! # end positions are checked. ! # --- ! # *Arguments*: ! # * (required) _other location_: a Bio::Location object ! # *Returns*:: ! # * 1 if self < other location ! # * -1 if self > other location ! # * 0 if both location are the same ! # * nil if the argument is not a Bio::Location object ! def <=>(other) ! if ! other.kind_of?(Bio::Location) ! return nil ! end ! ! if @from.to_f < other.from.to_f return -1 ! elsif @from.to_f > other.from.to_f ! return 1 ! end ! ! if @to.to_f < other.to.to_f return -1 ! elsif @to.to_f > other.to.to_f ! return 1 ! end return 0 ! end end # class location *************** *** 755,758 **** --- 755,760 ---- print "`- loc[1] : "; p loc[1] print " `- range : "; p loc[1].range + + puts Bio::Location.new('5').<=>(Bio::Location.new('3')) end From aerts at dev.open-bio.org Thu May 4 18:41:10 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 04 May 2006 18:41:10 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio map.rb,1.4,1.5 Message-ID: <200605041841.k44IfA37021272@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv21252 Modified Files: map.rb Log Message: Only positions of markers /on the same map/ can be compared. Index: map.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/map.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** map.rb 4 May 2006 16:20:50 -0000 1.4 --- map.rb 4 May 2006 18:41:08 -0000 1.5 *************** *** 4,8 **** # Copyright:: Copyright (C) 2006 # Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # License:: Ruby's require 'bio/location' --- 4,9 ---- # Copyright:: Copyright (C) 2006 # Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # Licence:: Ruby's ! # require 'bio/location' *************** *** 209,212 **** --- 210,217 ---- raise "[Error] markers are not comparable" end + unless @map.equal?(other.map) + raise "[Error] maps have to be the same" + end + return self.location.<=>(other.location) end *************** *** 292,303 **** my_marker3.add_mapping_to_map(my_map1, '9') puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s puts "Does my_map2 contain marker3? => " + my_map2.contains_marker?(my_marker3).to_s ! my_map1.sort.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s end puts my_map1.min.marker.name my_map2.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s --- 297,310 ---- my_marker3.add_mapping_to_map(my_map1, '9') + my_map2.add_mapping_to_marker(my_marker1, '57') puts "Does my_map1 contain marker3? => " + my_map1.contains_marker?(my_marker3).to_s puts "Does my_map2 contain marker3? => " + my_map2.contains_marker?(my_marker3).to_s ! my_map1.sort.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s end puts my_map1.min.marker.name + my_map2.each do |mapping| puts mapping.map.name + "\t" + mapping.marker.name + "\t" + mapping.location.from.to_s + ".." + mapping.location.to.to_s From ngoto at dev.open-bio.org Mon May 8 14:37:57 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Mon, 08 May 2006 14:37:57 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl/blat report.rb,1.6,1.7 Message-ID: <200605081437.k48EbvjU017182@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl/blat In directory dev.open-bio.org:/tmp/cvs-serv17162/lib/bio/appl/blat Modified Files: report.rb Log Message: changed license to Ruby's Index: report.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blat/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 8 May 2006 14:37:55 -0000 1.7 *************** *** 3,23 **** # # Copyright:: Copyright (C) 2004 GOTO Naohisa <ng at bioruby.org> ! # 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 <ng at bioruby.org> ! # License:: Ruby's # # $Id$ From k at dev.open-bio.org Mon May 8 14:19:53 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:19:53 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/data aa.rb,0.16,0.17 Message-ID: <200605081419.k48EJrBM016395@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory dev.open-bio.org:/tmp/cvs-serv16391/data Modified Files: aa.rb Log Message: * license is changed to Ruby's Index: aa.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/aa.rb,v retrieving revision 0.16 retrieving revision 0.17 diff -C2 -d -r0.16 -r0.17 *** aa.rb 15 Nov 2005 13:33:11 -0000 0.16 --- aa.rb 8 May 2006 14:19:51 -0000 0.17 *************** *** 4,29 **** # Copyright:: Copyright (C) 2001, 2005 # Toshiaki Katayama <k at bioruby.org> ! # 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 --- 4,11 ---- # Copyright:: Copyright (C) 2001, 2005 # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ # module Bio From k at dev.open-bio.org Mon May 8 14:32:00 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:32:00 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io das.rb,1.11,1.12 Message-ID: <200605081432.k48EW00i017091@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv17080/io Modified Files: das.rb Log Message: * license is changed to Ruby's Index: das.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/das.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** das.rb 14 Nov 2005 02:01:54 -0000 1.11 --- das.rb 8 May 2006 14:31:58 -0000 1.12 *************** *** 5,9 **** # Shuichi Kawashima <shuichi at hgc.jp>, # Toshiaki Katayama <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 5,9 ---- # Shuichi Kawashima <shuichi at hgc.jp>, # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 16,37 **** #++ # - #-- - # - # 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 - # - #++ - # begin --- 16,19 ---- From k at dev.open-bio.org Mon May 8 14:23:09 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:23:09 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db prosite.rb,0.13,0.14 Message-ID: <200605081423.k48EN9m8016622@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv16618/db Modified Files: prosite.rb Log Message: * license is changed to Ruby's Index: prosite.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/prosite.rb,v retrieving revision 0.13 retrieving revision 0.14 diff -C2 -d -r0.13 -r0.14 *** prosite.rb 18 Dec 2005 18:24:08 -0000 0.13 --- prosite.rb 8 May 2006 14:23:07 -0000 0.14 *************** *** 3,32 **** # # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki <k at bioruby.org> ! # Licence:: LGPL ! # ! # $Id$ ! # ! # == Description ! # ! # ! # == 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 # ! #++ # --- 3,9 ---- # # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki <k at bioruby.org> ! # Licence:: Ruby's # ! # $Id$ # From k at dev.open-bio.org Mon May 8 14:32:00 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:32:00 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db gff.rb,1.6,1.7 Message-ID: <200605081432.k48EW0xM017086@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv17080/db Modified Files: gff.rb Log Message: * license is changed to Ruby's Index: gff.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/gff.rb,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gff.rb 28 Mar 2006 13:42:32 -0000 1.6 --- gff.rb 8 May 2006 14:31:58 -0000 1.7 *************** *** 5,30 **** # Toshiaki Katayama <k at bioruby.org> # 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # 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 --- 5,12 ---- # Toshiaki Katayama <k at bioruby.org> # 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # License:: Ruby's # # $Id$ # module Bio From k at dev.open-bio.org Mon May 8 14:22:15 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:22:15 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db litdb.rb,0.7,0.8 Message-ID: <200605081422.k48EMFHl016536@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv16532/db Modified Files: litdb.rb Log Message: * license is changed to Ruby's Index: litdb.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/litdb.rb,v retrieving revision 0.7 retrieving revision 0.8 diff -C2 -d -r0.7 -r0.8 *** litdb.rb 18 Dec 2005 15:58:41 -0000 0.7 --- litdb.rb 8 May 2006 14:22:12 -0000 0.8 *************** *** 3,34 **** # # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # $Id$ # - # == Description - # - # - # == 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 - # - #++ - # require 'bio/db' --- 3,10 ---- # # Copyright:: Copyright (C) 2001 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ # require 'bio/db' From k at dev.open-bio.org Mon May 8 14:34:54 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:34:54 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db aaindex.rb,1.18,1.19 Message-ID: <200605081434.k48EYsDl017116@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv17112/db Modified Files: aaindex.rb Log Message: * license is changed to Ruby's Index: aaindex.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/aaindex.rb,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** aaindex.rb 22 Feb 2006 07:35:19 -0000 1.18 --- aaindex.rb 8 May 2006 14:34:52 -0000 1.19 *************** *** 6,10 **** # Copyright:: Copyright (C) 2006 # Mitsuteru C. Nakao <n at bioruby.org> ! # License:: LGPL # # $Id$ --- 6,10 ---- # Copyright:: Copyright (C) 2006 # Mitsuteru C. Nakao <n at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 35,56 **** # * http://www.genome.jp/aaindex/ # - #-- - # - # 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" --- 35,38 ---- From k at dev.open-bio.org Mon May 8 14:21:48 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:21:48 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/data codontable.rb,0.16,0.17 Message-ID: <200605081421.k48ELmPp016493@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/data In directory dev.open-bio.org:/tmp/cvs-serv16489 Modified Files: codontable.rb Log Message: * license is changed to Ruby's Index: codontable.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/data/codontable.rb,v retrieving revision 0.16 retrieving revision 0.17 diff -C2 -d -r0.16 -r0.17 *** codontable.rb 15 Nov 2005 12:43:37 -0000 0.16 --- codontable.rb 8 May 2006 14:21:46 -0000 0.17 *************** *** 4,8 **** # Copyright:: Copyright (C) 2001, 2004 # Toshiaki Katayama <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2001, 2004 # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 43,64 **** # table.revtrans("A") # => ["gcg", "gct", "gca", "gcc"] # - #-- - # - # 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 --- 43,46 ---- From k at dev.open-bio.org Mon May 8 14:23:53 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:23:53 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl swissprot.rb,1.4,1.5 Message-ID: <200605081423.k48ENrT3016683@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv16679/db/embl Modified Files: swissprot.rb Log Message: * license is changed to Ruby's Index: swissprot.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/swissprot.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** swissprot.rb 28 Jan 2006 06:40:38 -0000 1.4 --- swissprot.rb 8 May 2006 14:23:51 -0000 1.5 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2001, 2002 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2001, 2002 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 29,50 **** # http://au.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/embl/sptr' --- 29,32 ---- From k at dev.open-bio.org Mon May 8 14:22:43 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:22:43 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db medline.rb,1.13,1.14 Message-ID: <200605081422.k48EMhIV016579@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db In directory dev.open-bio.org:/tmp/cvs-serv16575/db Modified Files: medline.rb Log Message: * license is changed to Ruby's Index: medline.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/medline.rb,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** medline.rb 18 Feb 2006 15:03:47 -0000 1.13 --- medline.rb 8 May 2006 14:22:41 -0000 1.14 *************** *** 4,8 **** # Copyright:: Copyright (C) 2001, 2005 # KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # == Description --- 4,8 ---- # Copyright:: Copyright (C) 2001, 2005 # KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # == Description *************** *** 17,42 **** # medilne.mesh # - # == References - # # $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 - # - #-- - # require 'bio/db' --- 17,22 ---- From k at dev.open-bio.org Mon May 8 14:25:27 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:25:27 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg expression.rb, 1.9, 1.10 kgml.rb, 1.2, 1.3 Message-ID: <200605081425.k48EPR7k016788@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory dev.open-bio.org:/tmp/cvs-serv16784/db/kegg Modified Files: expression.rb kgml.rb Log Message: * license is changed to Ruby's Index: kgml.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/kgml.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** kgml.rb 5 Nov 2005 08:29:53 -0000 1.2 --- kgml.rb 8 May 2006 14:25:25 -0000 1.3 *************** *** 4,8 **** # Copyright:: Copyright (C) 2005 # Toshiaki Katayama <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2005 # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 83,104 **** # end # - #-- - # - # 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 'rexml/document' --- 83,86 ---- Index: expression.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/expression.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** expression.rb 5 Nov 2005 08:27:26 -0000 1.9 --- expression.rb 8 May 2006 14:25:25 -0000 1.10 *************** *** 5,30 **** # Shuichi Kawashima <shuichi at hgc.jp>, # Toshiaki Katayama <k at bioruby.org> ! # 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 - # - #++ - # require "bio/db" --- 5,12 ---- # Shuichi Kawashima <shuichi at hgc.jp>, # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ # require "bio/db" From k at dev.open-bio.org Mon May 8 14:24:29 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:24:29 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/embl trembl.rb, 1.4, 1.5 uniprot.rb, 1.2, 1.3 Message-ID: <200605081424.k48EOTB1016726@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/embl In directory dev.open-bio.org:/tmp/cvs-serv16722/db/embl Modified Files: trembl.rb uniprot.rb Log Message: * license is changed to Ruby's Index: trembl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/trembl.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** trembl.rb 28 Jan 2006 06:40:38 -0000 1.4 --- trembl.rb 8 May 2006 14:24:27 -0000 1.5 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2001, 2002 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2001, 2002 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 29,50 **** # http://au.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/embl/sptr' --- 29,32 ---- Index: uniprot.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/embl/uniprot.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** uniprot.rb 28 Jan 2006 06:40:39 -0000 1.2 --- uniprot.rb 8 May 2006 14:24:27 -0000 1.3 *************** *** 3,7 **** # # Copyright:: Copyright (C) 2005 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 3,7 ---- # # Copyright:: Copyright (C) 2005 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 29,50 **** # 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/embl/sptr' --- 29,32 ---- From k at dev.open-bio.org Mon May 8 14:30:00 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:30:00 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io dbget.rb, 1.11, 1.12 ddbjxml.rb, 1.10, 1.11 fetch.rb, 1.7, 1.8 registry.rb, 1.16, 1.17 soapwsdl.rb, 1.3, 1.4 Message-ID: <200605081430.k48EU05g016983@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv16979/io Modified Files: dbget.rb ddbjxml.rb fetch.rb registry.rb soapwsdl.rb Log Message: * license is changed to Ruby's Index: soapwsdl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/soapwsdl.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** soapwsdl.rb 18 Dec 2005 16:51:18 -0000 1.3 --- soapwsdl.rb 8 May 2006 14:29:58 -0000 1.4 *************** *** 4,14 **** # Copyright:: Copyright (C) 2004 # KATAYAMA Toshiaki <k at bioruby.org> ! # License:: LGPL # # $Id$ # - # SOAP/WSDL - # - # # == Examples # --- 4,11 ---- # Copyright:: Copyright (C) 2004 # KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ # # == Examples # *************** *** 37,58 **** # % export http_proxy=http://localhost:8080 # - #-- - # - # 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 - # - #++ - # begin --- 34,37 ---- Index: ddbjxml.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/ddbjxml.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ddbjxml.rb 2 Feb 2006 16:30:29 -0000 1.10 --- ddbjxml.rb 8 May 2006 14:29:58 -0000 1.11 *************** *** 4,29 **** # Copyright:: Copyright (C) 2003, 2004 # KATAYAMA Toshiaki <k at bioruby.org> ! # 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 - # - #++ - # require 'bio/io/soapwsdl' --- 4,11 ---- # Copyright:: Copyright (C) 2003, 2004 # KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ # require 'bio/io/soapwsdl' Index: registry.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/registry.rb,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** registry.rb 18 Dec 2005 15:58:42 -0000 1.16 --- registry.rb 8 May 2006 14:29:58 -0000 1.17 *************** *** 4,8 **** # Copyright:: Copyright (C) 2002, 2003, 2004, 2005 # Toshiaki Katayama <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 4,8 ---- # Copyright:: Copyright (C) 2002, 2003, 2004, 2005 # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 82,102 **** # * http://www.open-bio.org/registry/seqdatabase.ini # - #-- - # 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 'uri' --- 82,85 ---- Index: dbget.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/dbget.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dbget.rb 5 Nov 2005 08:32:26 -0000 1.11 --- dbget.rb 8 May 2006 14:29:58 -0000 1.12 *************** *** 5,9 **** # Mitsuteru C. Nakao <n at bioruby.org>, # Toshiaki Katayama <k at bioruby.org> ! # License:: LGPL # # $Id$ --- 5,9 ---- # Mitsuteru C. Nakao <n at bioruby.org>, # Toshiaki Katayama <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 14,35 **** # http://www.genome.jp/dbget/ within the intranet. # - #-- - # - # 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 'socket' --- 14,17 ---- Index: fetch.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/fetch.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** fetch.rb 27 Mar 2006 18:34:35 -0000 1.7 --- fetch.rb 8 May 2006 14:29:58 -0000 1.8 *************** *** 1,27 **** # ! # bio/io/biofetch.rb - BioFetch access module # ! # Copyright (C) 2002, 2005 Toshiaki Katayama <k at bioruby.org> ! # 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! ! # 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$ # require 'uri' --- 1,28 ---- # ! # = bio/io/biofetch.rb - BioFetch access module # ! # Copyright:: Copyright (C) 2002, 2005 Toshiaki Katayama <k at bioruby.org>, ! # Copyright (C) 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # License:: Ruby's # + # $Id$ # ! # == DESCRIPTION # ! # Using BioRuby BioFetch server # ! # br_server = Bio::Fetch.new() ! # puts br_server.databases ! # puts br_server.formats('embl') ! # puts br_server.maxids # ! # Using EBI BioFetch server # + # ebi_server = Bio::Fetch.new('http://www.ebi.ac.uk/cgi-bin/dbfetch') + # puts ebi_server.fetch('embl', 'J00231', 'raw') + # puts ebi_server.fetch('embl', 'J00231', 'html') + # puts Bio::Fetch.query('genbank', 'J00231') + # puts Bio::Fetch.query('genbank', 'J00231', 'raw', 'fasta') + # require 'uri' *************** *** 179,202 **** end # module Bio - - - if __FILE__ == $0 - - puts "# test 1" - br_server = Bio::Fetch.new() - puts br_server.databases - puts br_server.formats('embl') - puts br_server.maxids - ebi_server = Bio::Fetch.new('http://www.ebi.ac.uk/cgi-bin/dbfetch') - puts "# test 2" - puts ebi_server.fetch('embl', 'J00231', 'raw') - puts "# test 3" - puts ebi_server.fetch('embl', 'J00231', 'html') - puts "# test 4" - puts Bio::Fetch.query('genbank', 'J00231') - puts "# test 5" - puts Bio::Fetch.query('genbank', 'J00231', 'raw', 'fasta') - - end - - --- 180,181 ---- From k at dev.open-bio.org Mon May 8 14:26:37 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 08 May 2006 14:26:37 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/db/kegg keggtab.rb,1.7,1.8 Message-ID: <200605081426.k48EQb2j016850@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/db/kegg In directory dev.open-bio.org:/tmp/cvs-serv16846/db/kegg Modified Files: keggtab.rb Log Message: * license is changed to Ruby's Index: keggtab.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/db/kegg/keggtab.rb,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** keggtab.rb 26 Sep 2005 13:00:07 -0000 1.7 --- keggtab.rb 8 May 2006 14:26:35 -0000 1.8 *************** *** 1,21 **** # ! # bio/db/kegg/keggtab.rb - KEGG keggtab class ! # ! # Copyright (C) 2001 Mitsuteru C. Nakao <n at bioruby.org> ! # Copyright (C) 2003 KATAYAMA Toshiaki <k at bioruby.org> ! # ! # 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,8 ---- # ! # = bio/db/kegg/keggtab.rb - KEGG keggtab class # ! # Copyright:: Copyright (C) 2001 Mitsuteru C. Nakao <n at bioruby.org> ! # Copyright (C) 2003, 2006 KATAYAMA Toshiaki <k at bioruby.org> ! # License:: Ruby's # # $Id$ *************** *** 23,214 **** module Bio ! class KEGG ! class Keggtab ! def initialize(file_path, bioroot = nil) ! @bioroot = ENV['BIOROOT'] || bioroot ! @db_names = Hash.new ! @database = Hash.new ! @taxonomy = Hash.new ! parse_keggtab(File.open(file_path).read) ! end ! attr_reader :bioroot, :db_names ! # Bio::KEGG::Keggtab::DB ! class DB ! def initialize(db_name, db_type, db_path, db_abbrev) ! @name = db_name ! @type = db_type ! @path = db_path ! @abbrev = db_abbrev ! @aliases = Array.new ! end ! attr_reader :name, :type, :path, :abbrev, :aliases ! alias korg abbrev ! alias keggorg abbrev ! end ! # DB section ! def database(db_abbrev = nil) ! if db_abbrev ! @database[db_abbrev] ! else ! @database ! end ! end ! def aliases(db_abbrev) ! if @database[db_abbrev] ! @database[db_abbrev].aliases ! end ! end ! def name(db_abbrev) ! if @database[db_abbrev] ! @database[db_abbrev].name ! end ! end ! def path(db_abbrev) ! if @database[db_abbrev] ! file = @database[db_abbrev].name ! if @bioroot ! "#{@database[db_abbrev].path.sub(/\$BIOROOT/, at bioroot)}/#{file}" ! else ! "#{@database[db_abbrev].path}/#{file}" ! end ! end end ! def alias_list(db_name) ! if @db_names[db_name] ! @db_names[db_name].aliases ! end ! end ! def db_path(db_name) ! if @bioroot ! "#{@db_names[db_name].path.sub(/\$BIOROOT/, at bioroot)}/#{db_name}" ! else ! "#{@db_names[db_name].path}/#{db_name}" ! end ! end ! def db_by_abbrev(db_abbrev) ! @db_names.each do |k, db| ! return db if db.abbrev == db_abbrev ! end ! return nil ! end ! def name_by_abbrev(db_abbrev) ! db_by_abbrev(db_abbrev).name ! end ! def db_path_by_abbrev(db_abbrev) ! db_name = name_by_abbrev(db_abbrev) ! db_path(db_name) ! end ! # Taxonomy section ! def taxonomy(node = nil) ! if node ! @taxonomy[node] ! else ! @taxonomy ! end ! end ! def taxa_list ! @taxonomy.keys.sort ! end ! def child_nodes(node = 'genes') ! return @taxonomy[node] ! end ! def taxo2korgs(node = 'genes') ! if node.length == 3 ! return node ! else ! if @taxonomy[node] ! tmp = Array.new ! @taxonomy[node].each do |x| ! tmp.push(taxo2korgs(x)) ! end ! return tmp ! else ! return nil ! end end end ! alias taxo2keggorgs taxo2korgs ! alias taxon2korgs taxo2korgs ! alias taxon2keggorgs taxo2korgs ! def korg2taxo(keggorg) ! tmp = Array.new ! traverse = Proc.new {|keggorg| ! @taxonomy.each do |k,v| ! if v.include?(keggorg) ! tmp.push(k) ! traverse.call(k) ! break ! end ! end ! } ! traverse.call(keggorg) ! return tmp end ! alias keggorg2taxo korg2taxo ! alias korg2taxonomy korg2taxo ! alias keggorg2taxonomy korg2taxo ! private ! def parse_keggtab(keggtab) ! in_taxonomy = nil ! keggtab.each do |line| ! case line ! when /^# Taxonomy/ # beginning of the taxonomy section ! in_taxonomy = true ! when /^#|^$/ ! next ! when /(^\w\S+)\s+(\w+)\s+(\$\S+)\s+(\w+)/ # db ! db_name = $1 ! db_type = $2 ! db_path = $3 ! db_abbrev = $4 ! @db_names[db_name] = ! Bio::KEGG::Keggtab::DB.new(db_name, db_type, db_path, db_abbrev) ! when /(^\w\S+)\s+alias\s+(\w.+\w)/ # alias ! db_alias = $1 ! db_name = $2#.downcase ! if in_taxonomy ! @taxonomy.update(db_alias => db_name.split('+')) ! elsif @db_names[db_name] ! @db_names[db_name].aliases.push(db_alias) ! end ! end ! end ! # convert keys-by-names hash @db_names to keys-by-abbrev hash @database ! @db_names.each do |k,v| ! @database[v.abbrev] = v end end - end ! end ! end --- 10,209 ---- module Bio ! class KEGG ! # Parse 'keggtab' KEGG database definition file which also includes ! # Taxonomic category of the KEGG organisms. The 'keggtab' file can ! # be found in ! # ! # * ((<URL:ftp://ftp.genome.jp/pub/kegg/tarfiles/genes.tar.gz>)) ! # ! class Keggtab ! def initialize(file_path, bioroot = nil) ! @bioroot = ENV['BIOROOT'] || bioroot ! @db_names = Hash.new ! @database = Hash.new ! @taxonomy = Hash.new ! File.open(file_path) do |f| ! parse_keggtab(f.read) ! end ! end ! attr_reader :bioroot, :db_names ! # Bio::KEGG::Keggtab::DB ! class DB ! def initialize(db_name, db_type, db_path, db_abbrev) ! @name = db_name ! @type = db_type ! @path = db_path ! @abbrev = db_abbrev ! @aliases = Array.new ! end ! attr_reader :name, :type, :path, :abbrev, :aliases ! alias korg abbrev ! alias keggorg abbrev ! end ! # DB section ! def database(db_abbrev = nil) ! if db_abbrev ! @database[db_abbrev] ! else ! @database ! end ! end ! def aliases(db_abbrev) ! if @database[db_abbrev] ! @database[db_abbrev].aliases ! end ! end ! def name(db_abbrev) ! if @database[db_abbrev] ! @database[db_abbrev].name ! end ! end ! def path(db_abbrev) ! if @database[db_abbrev] ! file = @database[db_abbrev].name ! if @bioroot ! "#{@database[db_abbrev].path.sub(/\$BIOROOT/, at bioroot)}/#{file}" ! else ! "#{@database[db_abbrev].path}/#{file}" end + end + end ! def alias_list(db_name) ! if @db_names[db_name] ! @db_names[db_name].aliases ! end ! end ! def db_path(db_name) ! if @bioroot ! "#{@db_names[db_name].path.sub(/\$BIOROOT/, at bioroot)}/#{db_name}" ! else ! "#{@db_names[db_name].path}/#{db_name}" ! end ! end ! def db_by_abbrev(db_abbrev) ! @db_names.each do |k, db| ! return db if db.abbrev == db_abbrev ! end ! return nil ! end ! def name_by_abbrev(db_abbrev) ! db_by_abbrev(db_abbrev).name ! end ! def db_path_by_abbrev(db_abbrev) ! db_name = name_by_abbrev(db_abbrev) ! db_path(db_name) ! end ! # Taxonomy section ! def taxonomy(node = nil) ! if node ! @taxonomy[node] ! else ! @taxonomy ! end ! end ! def taxa_list ! @taxonomy.keys.sort ! end ! def child_nodes(node = 'genes') ! return @taxonomy[node] ! end ! def taxo2korgs(node = 'genes') ! if node.length == 3 ! return node ! else ! if @taxonomy[node] ! tmp = Array.new ! @taxonomy[node].each do |x| ! tmp.push(taxo2korgs(x)) end + return tmp + else + return nil end ! end ! end ! alias taxo2keggorgs taxo2korgs ! alias taxon2korgs taxo2korgs ! alias taxon2keggorgs taxo2korgs ! def korg2taxo(keggorg) ! tmp = Array.new ! traverse = Proc.new {|keggorg| ! @taxonomy.each do |k,v| ! if v.include?(keggorg) ! tmp.push(k) ! traverse.call(k) ! break ! end end ! } ! traverse.call(keggorg) ! return tmp ! end ! alias keggorg2taxo korg2taxo ! alias korg2taxonomy korg2taxo ! alias keggorg2taxonomy korg2taxo ! private ! def parse_keggtab(keggtab) ! in_taxonomy = nil ! keggtab.each do |line| ! case line ! when /^# Taxonomy/ # beginning of the taxonomy section ! in_taxonomy = true ! when /^#|^$/ ! next ! when /(^\w\S+)\s+(\w+)\s+(\$\S+)\s+(\w+)/ # db ! db_name = $1 ! db_type = $2 ! db_path = $3 ! db_abbrev = $4 ! @db_names[db_name] = ! Bio::KEGG::Keggtab::DB.new(db_name, db_type, db_path, db_abbrev) ! when /(^\w\S+)\s+alias\s+(\w.+\w)/ # alias ! db_alias = $1 ! db_name = $2#.downcase ! if in_taxonomy ! @taxonomy.update(db_alias => db_name.split('+')) ! elsif @db_names[db_name] ! @db_names[db_name].aliases.push(db_alias) end end end ! # convert keys-by-names hash @db_names to keys-by-abbrev hash @database ! @db_names.each do |k,v| ! @database[v.abbrev] = v ! end end ! ! end # Keggtab ! ! end # KEGG ! end # Bio From ngoto at dev.open-bio.org Tue May 9 07:13:56 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 09 May 2006 07:13:56 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.8,1.9 Message-ID: <200605090713.k497DuWX018440@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv18420/lib/bio Modified Files: command.rb Log Message: * new method Bio::Command::NetTools.post_form is added. Note that it is bioruby internal use only and users should not use it. * Bio::Command::NetTools.net_http_start is renamed to http_start. (net_http_start still remains as an alias.) Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** command.rb 27 Apr 2006 03:15:27 -0000 1.8 --- command.rb 9 May 2006 07:13:54 -0000 1.9 *************** *** 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. --- 171,175 ---- # is set. # ! def 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. *************** *** 183,188 **** --- 183,216 ---- http.start(address, port, &block) end + module_function :http_start + + alias net_http_start http_start module_function :net_http_start + # Same as: + # Net::HTTP.post_form(uri, params) + # and + # it uses proxy if an environment variable (same as OpenURI.open_uri) + # is set. + # In addition, +header+ can be set. + # (Note that Content-Type and Content-Length are automatically + # set by default.) + # +uri+ must be a URI object and +params+ must be a hash. + # + def post_form(uri, params, header = {}) + data = params.map do |key, val| + "#{URI.escape(key)}=#{URI.escape(val)}" + end.join('&') + h = { + 'Content-Type' => 'application/x-www-form-urlencoded', + 'Content-Length' => data.length.to_s + } + h.update(header) + net_http_start(uri.host, uri.port) do |http| + http.post(uri.path, data, h) + end + end + module_function :post_form + end #module NetTools From ngoto at dev.open-bio.org Tue May 9 07:17:14 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 09 May 2006 07:17:14 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.9,1.10 Message-ID: <200605090717.k497HEEt018470@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv18448/lib/bio Modified Files: command.rb Log Message: rename of net_http_start to http_start is canceled Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** command.rb 9 May 2006 07:13:54 -0000 1.9 --- command.rb 9 May 2006 07:17:11 -0000 1.10 *************** *** 171,175 **** # is set. # ! def 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. *************** *** 183,189 **** http.start(address, port, &block) end - module_function :http_start - - alias net_http_start http_start module_function :net_http_start --- 183,186 ---- From nakao at dev.open-bio.org Tue May 9 08:18:51 2006 From: nakao at dev.open-bio.org (Mitsuteru C. Nakao) Date: Tue, 09 May 2006 08:18:51 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl pts1.rb,1.1,1.2 Message-ID: <200605090818.k498IpqM019200@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv19136/lib/bio/appl Modified Files: pts1.rb Log Message: * Uses Bio::Command::NetTools.post_form in PTS1#exec method instaed of Net::HTTP.post_form. Index: pts1.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/pts1.rb,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pts1.rb 2 May 2006 10:29:19 -0000 1.1 --- pts1.rb 9 May 2006 08:18:49 -0000 1.2 *************** *** 147,167 **** seq = set_sequence_in_fastaformat(query) ! @form_data = {'function' => @function.values, 'sequence' => seq.seq, 'name' => seq.definition } @uri = URI.parse(["http:/", @host, @cgi_path].join('/')) ! result = nil ! ! # The server cannot understand a POST request by folowing codes, but ! # request by the Net::HTTP.post_form method is OK. ! # ! # Bio::Command::NetTools.net_http_start(@uri.host) {|http| ! # result, = http.post(@uri.path, @form_data) ! # @output = Report.new(result.body) ! # } ! # ! ! result, = Net::HTTP.post_form(@uri, @form_data) @output = Report.new(result.body) --- 147,156 ---- seq = set_sequence_in_fastaformat(query) ! @form_data = {'function' => @function.values.to_s, 'sequence' => seq.seq, 'name' => seq.definition } @uri = URI.parse(["http:/", @host, @cgi_path].join('/')) ! result, = Bio::Command::NetTools.post_form(@uri, @form_data) @output = Report.new(result.body) From aerts at dev.open-bio.org Tue May 9 11:52:32 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Tue, 09 May 2006 11:52:32 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio feature.rb,1.11,1.12 Message-ID: <200605091152.k49BqWge019612@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv19592 Modified Files: feature.rb Log Message: Reverted to previous behaviour: new takes array of Bio::Feature::Qualifiers instead of list of qualifier_key, qualifier_value pairs. Index: feature.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/feature.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** feature.rb 26 Apr 2006 11:05:50 -0000 1.11 --- feature.rb 9 May 2006 11:52:30 -0000 1.12 *************** *** 23,27 **** # # /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 --- 23,37 ---- # # /note="cytochrome P450 IID6; GOO-132-127" # # /number="1" ! # feature = Bio::Feature.new('exon','1532..1799') ! # feature.append(Bio::Feature::Qualifier.new('gene', 'CYP2D6')) ! # feature.append(Bio::Feature::Qualifier.new('note', 'cytochrome P450 IID6')) ! # feature.append(Bio::Feature::Qualifier.new('number', '1')) ! # ! # # or all in one go: ! # feature2 = Bio::Feature.new('exon','1532..1799', ! # [ Bio::Feature::Qualifier.new('gene', 'CYP2D6'), ! # Bio::Feature::Qualifier.new('note', 'cytochrome P450 IID6; GOO-132-127'), ! # Bio::Feature::Qualifier.new('number', '1') ! # ]) # # # Print the feature *************** *** 38,54 **** # * (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 --- 48,55 ---- # * (required) _feature_: type of feature (e.g. "exon") # * (required) _position_: position of feature (e.g. "complement(1532..1799)") ! # * (opt) _qualifiers_: list of Bio::Feature::Qualifier objects (default: []) # *Returns*:: Bio::Feature object def initialize(feature = '', position = '', qualifiers = []) ! @feature, @position, @qualifiers = feature, position, qualifiers end *************** *** 131,137 **** attr_reader :value ! end ! end --- 132,138 ---- attr_reader :value ! end #Qualifier ! end #Feature *************** *** 141,148 **** # = 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 --- 142,152 ---- # = USAGE # # First, create some Bio::Feature objects ! # feature1 = Bio::Feature.new('intron','3627..4059') ! # feature2 = Bio::Feature.new('exon','4060..4236') ! # feature3 = Bio::Feature.new('intron','4237..4426') ! # feature4 = Bio::Feature.new('CDS','join(2538..3626,4060..4236)', ! # [ Bio::Feature::Qualifier.new('gene', 'CYP2D6'), ! # Bio::Feature::Qualifier.new('translation','MGXXTVMHLL...') ! # ]) # # # And create a container for them *************** *** 217,257 **** end ! end 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 --- 221,226 ---- end ! end # Features end # Bio From aerts at dev.open-bio.org Thu May 11 10:53:27 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Thu, 11 May 2006 10:53:27 +0000 Subject: [BioRuby-cvs] bioruby README.DEV,1.9,1.10 Message-ID: <200605111053.k4BArRXb026729@dev.open-bio.org> Update of /home/repository/bioruby/bioruby In directory dev.open-bio.org:/tmp/cvs-serv26709 Modified Files: README.DEV Log Message: Added documentation on standard documentation of files and modules (as requested by Toshiaki). Index: README.DEV =================================================================== RCS file: /home/repository/bioruby/bioruby/README.DEV,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** README.DEV 8 Feb 2006 12:02:09 -0000 1.9 --- README.DEV 11 May 2006 10:53:25 -0000 1.10 *************** *** 1,9 **** ! =begin ! ! $Id$ ! Copyright (C) 2005, 2006 Toshiaki Katayama <k at bioruby.org> ! = How to contribute to the BioRuby project? There are many possible ways to contribute to the BioRuby project, --- 1,8 ---- ! $Id$ ! Copyright (C):: 2005, 2006 Toshiaki Katayama <k at bioruby.org> ! Copyright (C):: 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! = HOW TO CONTRIBUTE TO THE BIORUBY PROJECT? There are many possible ways to contribute to the BioRuby project, *************** *** 21,25 **** your module meets the field of bioinformatics. ! == License If you would like your module to be included in the BioRuby distribution, --- 20,24 ---- your module meets the field of bioinformatics. ! = LICENSE If you would like your module to be included in the BioRuby distribution, *************** *** 30,38 **** are changing the license to Ruby's. ! == Coding style You will need to follow the typical coding styles of the BioRuby modules: ! === Use the following naming conventions * CamelCase for module and class names --- 29,37 ---- are changing the license to Ruby's. ! = CODING STYLE You will need to follow the typical coding styles of the BioRuby modules: ! == Use the following naming conventions * CamelCase for module and class names *************** *** 41,101 **** * all UPPERCASE for constants ! === Indentation must not include tabs * Use 2 spaces for indentation. * Don't replace spaces to tabs. ! === Comments ! Don't use =begin and =end blocks for comments. If you need to add comments, include it in the RDoc documentation. ! === Each file must start with the following text # ! # = bio/db/hoge.rb - Hoge database parser # - # Copyright:: Copyright (C) 2001, 2005 - # Bio R. Hacker <brh at example.org>, - # Chem R. Hacker <crh at example.org> # License:: Ruby's # # $Id$ # ! # == Blah blah blah ! # ! # See http://hoge.db/ for more details on the Hoge database. ! # ... blah blah blah ... ! # ! # == Examples # ! # hoge = Bio::Hoge.new(entry) ! # puts hoge.entry_id ! # puts hoge.definition # ! # == References # # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. 123:100--123 (2030) - # # * http://hoge.db/ # ! === Documentation should be written in the RDoc format in the source code ! The RDoc format is becoming the popular standard for Ruby documentation. ! We are now in transition from the previously used RD format to the RDoc ! format in API documentation. ! Additional tutorial documentation and working examples are encouraged ! with your contribution. You may use the header part of the file for ! this purpose as demonstrated in the previous section. ! === Testing code should use 'test/unit' Unit tests should come with your modules by which you can assure what you meant to do with each method. The test code is useful to make ! maintenance easy and ensure stability. ! === Using autoload To quicken the initial load time we have replaced most of 'require' to --- 40,205 ---- * all UPPERCASE for constants ! == Indentation must not include tabs * Use 2 spaces for indentation. * Don't replace spaces to tabs. ! == Comments ! Don't use <tt>=begin</tt> and <tt>=end</tt> blocks for comments. If you need to add comments, include it in the RDoc documentation. ! == Documentation should be written in the RDoc format in the source code ! ! The RDoc format is becoming the popular standard for Ruby documentation. ! We are now in transition from the previously used RD format to the RDoc ! format in API documentation. ! ! Additional tutorial documentation and working examples are encouraged ! with your contribution. You may use the header part of the file for ! this purpose as demonstrated in the previous section. ! ! == Standard documentation ! ! === of files ! ! Each file should start with a header, which covers the following topics: ! * copyright ! * license ! * description of the file (_not_ the classes; see below) ! * any references, if appropriate + The header should be formatted as follows: # ! # = bio/db/hoge.rb - Hoge database parser classes ! # ! # Copyright (C):: 2001, 2003-2005 Bio R. Hacker <brh at example.org>, ! # Copyright (C):: 2006 Chem R. Hacker <crh at example.org> # # License:: Ruby's # # $Id$ # ! # = Description # ! # This file contains classes that implement an interface to the Hoge database. # ! # = References # # * Hoge F. et al., The Hoge database, Nucleic. Acid. Res. 123:100--123 (2030) # * http://hoge.db/ # ! In the above sample, the ! $Id$ ! will be automatically changed into something like ! $Id$ ! when commiting to the CVS repository for the first time. ! === of classes and methods within those files ! Classes and methods should be documented in a standardized format, as in the ! following example (from lib/bio/sequence.rb): ! # = DESCRIPTION ! # Bio::Sequence objects represent annotated sequences in bioruby. ! # A Bio::Sequence object is a wrapper around the actual sequence, ! # represented as either a Bio::Sequence::NA or a Bio::Sequence::AA object. ! # For most users, this encapsulation will be completely transparent. ! # Bio::Sequence responds to all methods defined for Bio::Sequence::NA/AA ! # objects using the same arguments and returning the same values (even though ! # these methods are not documented specifically for Bio::Sequence). ! # ! # = USAGE ! # require 'bio' ! # ! # # Create a nucleic or amino acid sequence ! # dna = Bio::Sequence.auto('atgcatgcATGCATGCAAAA') ! # rna = Bio::Sequence.auto('augcaugcaugcaugcaaaa') ! # aa = Bio::Sequence.auto('ACDEFGHIKLMNPQRSTVWYU') ! # ! # # Print in FASTA format ! # puts dna.output(:fasta) ! # ! # # Print all codons ! # dna.window_search(3,3) do |codon| ! # puts codon ! # end ! # ! class Sequence ! ! # Create a new Bio::Sequence object ! # ! # s = Bio::Sequence.new('atgc') ! # puts s #=> 'atgc' ! # ! # Note that this method does not intialize the contained sequence ! # as any kind of bioruby object, only as a simple string ! # ! # puts s.seq.class #=> String ! # ! # See Bio::Sequence#na, Bio::Sequence#aa, and Bio::Sequence#auto ! # for methods to transform the basic String of a just created ! # Bio::Sequence object to a proper bioruby object ! # --- ! # *Arguments*: ! # * (required) _str_: String or Bio::Sequence::NA/AA object ! # *Returns*:: Bio::Sequence object ! def initialize(str) ! @seq = str ! end ! ! # The sequence identifier. For example, for a sequence ! # of Genbank origin, this is the accession number. ! attr_accessor :entry_id ! ! # An Array of Bio::Feature objects ! attr_accessor :features ! end # Sequence ! ! Preceding the class definition (<tt>class Sequence</tt>), there is at least a ! description and a usage example. Please use the +Description+ and +Usage+ ! headings. If appropriate, refer to other classes that interact with or are ! related to the class. ! ! The code in the usage example should, if possible, be in a format that a user ! can copy-and-paste into a new script to run. It should illustrate the most ! important uses of the class. If possible and if it would not clutter up the ! example too much, try to provide any input data directly into the usage example, ! instead of refering to ARGV or ARGF for input. ! dna = Bio::Sequence.auto('atgcatgcATGCATGCAAAA') ! Otherwise, describe the input shortly, for example: ! # input should be string consisting of nucleotides ! dna = Bio::Sequence.auto(ARGF.read) ! ! Methods should be preceded by a comment that describes what the method does, ! including any relevant usage examples. (In contrast to the documentation for ! the class itself, headings are not required.) In addition, any arguments should ! be listed, as well as the type of thing that is returned by the method. The ! format of this information is as follows: ! # --- ! # *Arguments*: ! # * (required) _str_: String or Bio::Sequence::NA ! # * (optional) _nr_: a number that means something ! # *Returns*:: true or false ! ! Attribute accessors can be preceded by a short description. ! ! == Exception handling ! ! Don't use ! $stderr.puts "WARNING" ! in your code. Instead, try to avoid printing error messages. For fatal errors, ! use +raise+ with an appropriate message. ! ! == Testing code should use 'test/unit' Unit tests should come with your modules by which you can assure what you meant to do with each method. The test code is useful to make ! maintenance easy and ensure stability. The use of ! if __FILE__ == $0 ! is deprecated. ! == Using autoload To quicken the initial load time we have replaced most of 'require' to *************** *** 135,139 **** so autoload can be written in 1 line. ! == Name space Your module should be located under the top-level module Bio and put under --- 239,243 ---- so autoload can be written in 1 line. ! = NAMESPACE Your module should be located under the top-level module Bio and put under *************** *** 151,161 **** If your module doesn't match any of the above, please propose ! an appropriate directory name when you contribute. ! == Maintenance Finally, please maintain the code you've contributed. The BioRuby staff is willing to give you CVS privileges if needed. ! ! =end --- 255,267 ---- If your module doesn't match any of the above, please propose ! an appropriate directory name when you contribute. Please let the staff ! discuss on namespaces (class names), API (method names) before commiting ! a new module or making changes on existing modules. ! = MAINTENANCE Finally, please maintain the code you've contributed. The BioRuby staff is willing to give you CVS privileges if needed. ! Please let us know (on the bioruby list) before you commit, so that users ! can discuss on the change. From aerts at dev.open-bio.org Tue May 16 09:50:16 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Tue, 16 May 2006 09:50:16 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl blast.rb,1.28,1.29 Message-ID: <200605160950.k4G9oGh7025496@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv25476 Modified Files: blast.rb Log Message: Added/reformatted docs. Index: blast.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast.rb,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** blast.rb 18 Feb 2006 16:08:10 -0000 1.28 --- blast.rb 16 May 2006 09:50:13 -0000 1.29 *************** *** 2,29 **** # = bio/appl/blast.rb - BLAST wrapper # ! # Copyright:: Copyright (C) 2001 ! # Mitsuteru C. Nakao <n at bioruby.org> ! # Copyrigth:: Copyright (C) 2002,2003 ! # KATAYAMA Toshiaki <k at bioruby.org> # License:: Ruby's # # $Id$ # ! # = Description ! # ! # = Examples # ! # program = 'blastp' ! # database = 'SWISS' ! # options = '-e 0.0001' ! # serv = Bio::Blast.new(program, database, options) ! # server = 'genomenet' ! # genomenet = Bio::Blast.remote(program, database, options, server) ! # report = serv.query(sequence_text) # # = References # # * http://www.ncbi.nlm.nih.gov/blast/ - # # * http://blast.genome.jp/ideas/ideas.html#blast # --- 2,20 ---- # = bio/appl/blast.rb - BLAST wrapper # ! # Copyright (C):: 2001 Mitsuteru C. Nakao <n at bioruby.org> ! # Copyright (C):: 2002,2003 KATAYAMA Toshiaki <k at bioruby.org> ! # Copyright (C):: 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk> ! # # License:: Ruby's # # $Id$ # ! # = DESCRIPTION # ! # This file holds the Bio::Blast class, which creates BLAST factories. # # = References # # * http://www.ncbi.nlm.nih.gov/blast/ # * http://blast.genome.jp/ideas/ideas.html#blast # *************** *** 36,72 **** module Bio ! # BLAST wrapper # ! # == Description # ! # A blastall program wrapper. # ! # == Examples # ! # program = 'blastp' ! # database = 'SWISS' ! # options = '-e 0.0001' ! # serv = Bio::Blast.new(program, database, options) ! # ! # server = 'genomenet' ! # genomenet = Bio::Blast.remote(program, database, options, server) ! # ! # report = serv.query(sequence_text) # ! # == Available databases for Blast.remote(@program, @db, option, 'genomenet') # ! # ----------+-------+--------------------------------------------------- ! # @program | query | @db (supported in GenomeNet) ! # ----------+-------+--------------------------------------------------- ! # blastp | AA | nr-aa, genes, vgenes.pep, swissprot, swissprot-upd, ! # ----------+-------+ pir, prf, pdbstr ! # blastx | NA | ! # ----------+-------+--------------------------------------------------- ! # blastn | NA | nr-nt, genbank-nonst, gbnonst-upd, dbest, dbgss, ! # ----------+-------+ htgs, dbsts, embl-nonst, embnonst-upd, epd, ! # tblastn | AA | genes-nt, genome, vgenes.nuc ! # ----------+-------+--------------------------------------------------- # ! # * See http://blast.genome.jp/ideas/ideas.html#blast for more details. # class Blast --- 27,77 ---- module Bio ! # = DESCRIPTION ! # ! # The Bio::Blast class contains methods for running local or remote BLAST ! # searches, as well as for parsing of the output of such BLASTs (i.e. the ! # BLAST reports). For more information on similarity searches and the BLAST ! # program, see http://www.ncbi.nlm.nih.gov/Education/BLASTinfo/similarity.html. # ! # = USAGE # ! # require 'bio' ! # ! # # To run an actual BLAST analysis: ! # # 1. create a BLAST factory ! # remote_blast_factory = Bio::Blast.remote('blastp', 'SWISS', ! # '-e 0.0001', 'genomenet') ! # #or: ! # local_blast_factory = Bio::Blast.local('blastn','/path/to/db') # ! # # 2. run the actual BLAST by querying the factory ! # report = remote_blast_factory.query(sequence_text) # ! # # Then, to parse the report, see Bio::Blast::Report # ! # == Available databases for Bio::Blast.remote # ! # ----------+-------+--------------------------------------------------- ! # program | query | db (supported in GenomeNet) ! # ----------+-------+--------------------------------------------------- ! # blastp | AA | nr-aa, genes, vgenes.pep, swissprot, swissprot-upd, ! # ----------+-------+ pir, prf, pdbstr ! # blastx | NA | ! # ----------+-------+--------------------------------------------------- ! # blastn | NA | nr-nt, genbank-nonst, gbnonst-upd, dbest, dbgss, ! # ----------+-------+ htgs, dbsts, embl-nonst, embnonst-upd, epd, ! # tblastn | AA | genes-nt, genome, vgenes.nuc ! # ----------+-------+--------------------------------------------------- # ! # = SEE ALSO ! # ! # * Bio::Blast::Report ! # * Bio::Blast::Report::Hit ! # * Bio::Blast::Report::Hsp ! # ! # = REFERENCE ! # ! # * http://www.ncbi.nlm.nih.gov/Education/BLASTinfo/similarity.html ! # * http://blast.genome.jp/ideas/ideas.html#blast # class Blast *************** *** 80,89 **** include Bio::Command::Tools ! # Sets up the blast program at the localhost def self.local(program, db, option = '') self.new(program, db, option, 'local') end ! # Sets up the blast program at the remote host (server) def self.remote(program, db, option = '', server = 'genomenet') self.new(program, db, option, server) --- 85,113 ---- include Bio::Command::Tools ! # This is a shortcut for Bio::Blast.new: ! # Bio::Blast.local(program, database, options) ! # is equivalent to ! # Bio::Blast.new(program, database, options, 'local') ! # --- ! # *Arguments*: ! # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx' ! # * _db_ (required): name of the local database ! # * _options_: blastall options \ ! # (see http://www.genome.jp/dbget-bin/show_man?blast2) ! # *Returns*:: Bio::Blast factory object def self.local(program, db, option = '') self.new(program, db, option, 'local') end ! # Bio::Blast.remote does exactly the same as Bio::Blast.new, but sets ! # the remote server 'genomenet' as its default. ! # --- ! # *Arguments*: ! # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx' ! # * _db_ (required): name of the remote database ! # * _options_: blastall options \ ! # (see http://www.genome.jp/dbget-bin/show_man?blast2) ! # * _server_: server to use (DEFAULT = 'genomenet') ! # *Returns*:: Bio::Blast factory object def self.remote(program, db, option = '', server = 'genomenet') self.new(program, db, option, server) *************** *** 107,120 **** ! # Program name for blastall -p (blastp, blastn, blastx, tblastn or tblastx). attr_accessor :program ! # Database name for blastall -d attr_accessor :db ! # Options for blastall attr_accessor :options ! # attr_accessor :server --- 131,145 ---- ! # Program name (_-p_ option for blastall): blastp, blastn, blastx, tblastn ! # or tblastx attr_accessor :program ! # Database name (_-d_ option for blastall) attr_accessor :db ! # Options for blastall attr_accessor :options ! # Server to submit the BLASTs to attr_accessor :server *************** *** 141,153 **** ! # Returns a blast factory object (Bio::Blast). ! # ! # --- Bio::Blast.new(program, db, option = '', server = 'local') ! # --- Bio::Blast.local(program, db, option = '') ! # --- Bio::Blast.remote(program, db, option = '', server = 'genomenet') ! # ! # For the develpper, you can add server 'hoge' by adding ! # exec_hoge(query) method. ! # def initialize(program, db, opt = [], server = 'local') @program = program --- 166,185 ---- ! # Creates a Bio::Blast factory object. ! # ! # To run any BLAST searches, a factory has to be created that describes a ! # certain BLAST pipeline: the program to use, the database to search, any ! # options and the server to use. E.g. ! # ! # blast_factory = Bio::Blast.new('blastn','dbsts', '-e 0.0001 -r 4', 'genomenet') ! # ! # --- ! # *Arguments*: ! # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx' ! # * _db_ (required): name of the (local or remote) database ! # * _options_: blastall options \ ! # (see http://www.genome.jp/dbget-bin/show_man?blast2) ! # * _server_: server to use (e.g. 'genomenet'; DEFAULT = 'local') ! # *Returns*:: Bio::Blast factory object def initialize(program, db, opt = [], server = 'local') @program = program *************** *** 178,187 **** end ! # Execute blast search and returns Report object (Bio::Blast::Report). def query(query) return self.send("exec_#{@server}", query.to_s) end ! # option reader def option # backward compatibility --- 210,228 ---- end ! # This method submits a sequence to a BLAST factory, which performs the ! # actual BLAST. ! # ! # fasta_sequences = Bio::FlatFile.open(Bio::FastaFormat, 'my_sequences.fa') ! # report = blast_factory.query(fasta_sequences) ! # ! # --- ! # *Arguments*: ! # * _query_ (required): single- or multiple-FASTA formatted sequence(s) ! # *Returns*:: a Bio::Blast::Report object def query(query) return self.send("exec_#{@server}", query.to_s) end ! # Returns options of blastall def option # backward compatibility *************** *** 189,193 **** end ! # option setter def option=(str) # backward compatibility --- 230,234 ---- end ! # Set options for blastall def option=(str) # backward compatibility *************** *** 285,303 **** end # module Bio - - if __FILE__ == $0 - begin - require 'pp' - alias p pp - rescue - end - - # serv = Bio::Blast.local('blastn', 'hoge.nuc') - # serv = Bio::Blast.local('blastp', 'hoge.pep') - serv = Bio::Blast.remote('blastp', 'genes') - - query = ARGF.read - p serv.query(query) - end - - --- 326,327 ---- From aerts at dev.open-bio.org Wed May 17 14:24:35 2006 From: aerts at dev.open-bio.org (Jan Aerts) Date: Wed, 17 May 2006 14:24:35 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/appl emboss.rb,1.4,1.5 Message-ID: <200605171424.k4HEOZeG028646@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/appl In directory dev.open-bio.org:/tmp/cvs-serv28626 Modified Files: emboss.rb Log Message: Added/reformatted documentation. Index: emboss.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/emboss.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** emboss.rb 27 Feb 2006 09:14:30 -0000 1.4 --- emboss.rb 17 May 2006 14:24:33 -0000 1.5 *************** *** 2,36 **** # = bio/appl/emboss.rb - EMBOSS wrapper # ! # Copyright:: Copyright (C) 2002, 2005 ! # KATAYAMA Toshiaki <k at bioruby.org> # License:: Ruby's # # $Id$ # ! # == References # ! # * http://www.emboss.org # ! module Bio autoload :Command, 'bio/command' class EMBOSS extend Bio::Command::Tools ! def self.seqret(arg) str = self.retrieve('seqret', arg) end def self.entret(arg) str = self.retrieve('entret', arg) end def initialize(cmd_line) @cmd_line = cmd_line + ' -stdout -auto' end def exec begin --- 2,141 ---- # = bio/appl/emboss.rb - EMBOSS wrapper # ! # Copyright (C):: 2002, 2005 KATAYAMA Toshiaki <k at bioruby.org> ! # Copyright (C):: 2006 Aerts Jan <jan.aerts at bbsrc.ac.uk> ! # # License:: Ruby's # # $Id$ # ! # = DESCRIPTION # ! # This file holds classes pertaining to the EMBOSS software suite. # ! # = REFERENCES ! # ! # * http://emboss.sourceforge.net ! # * Rice P, Longden I and Bleasby A. \ ! # EMBOSS: the European Molecular Biology Open Software Suite. \ ! # Trends Genet. 2000 Jun ; 16(6): 276-7 module Bio autoload :Command, 'bio/command' + # = DESCRIPTION + # + # This class provides a wrapper for the applications of the EMBOSS suite, which + # is a mature and stable collection of open-source applications that can handle + # a huge range of sequence formats. + # Applications include: + # * Sequence alignment + # * Rapid database searching with sequence patterns + # * Protein motif identification, including domain analysis + # * Nucleotide sequence pattern analysis---for example to identify CpG islands or repeats + # * Codon usage analysis for small genomes + # * Rapid identification of sequence patterns in large scale sequence sets + # * Presentation tools for publication + # + # See the emboss website for more information: http://emboss.sourceforge.net. + # + # + # = USAGE + # + # require 'bio' + # + # # Suppose that you could get the sequence for XLRHODOP by running + # # the EMBOSS command +seqret embl:xlrhodop+ on the command line. + # # Then you can get the output of that command in a Bio::EMBOSS object + # # by creating a new Bio::EMBOSS object and subsequently executing it. + # xlrhodop = Bio::EMBOSS.new('seqret embl:xlrhodop') + # puts xlrhodop.exec + # + # # Or all in one go: + # puts Bio::EMBOSS.new('seqret embl:xlrhodop').exec + # + # # Similarly: + # puts Bio::EMBOSS.new('transeq -sbegin 110 -send 1171 embl:xlrhodop') + # puts Bio::EMBOSS.new('showfeat embl:xlrhodop').exec + # puts Bio::EMBOSS.new('seqret embl:xlrhodop -osformat acedb').exec + # + # # A shortcut exists for this two-step process for +seqret+ and +entret+. + # puts Bio::EMBOSS.seqret('embl:xlrhodop') + # puts Bio::EMBOSS.entret('embl:xlrhodop') + # + # = PREREQUISITES + # + # You must have the EMBOSS suite installed locally. You can download from the + # project website (see References below). + # + # = REFERENCES + # + # * http://emboss.sourceforge.net + # * Rice P, Longden I and Bleasby A. \ + # EMBOSS: the European Molecular Biology Open Software Suite. \ + # Trends Genet. 2000 Jun ; 16(6): 276-7 class EMBOSS extend Bio::Command::Tools ! ! # Combines the initialization and execution for the emboss +seqret+ command. ! # ! # puts Bio::EMBOSS.seqret('embl:xlrhodop') ! # ! # is equivalent to: ! # ! # object = Bio::EMBOSS.new('seqret embl:xlrhodop') ! # puts object.exec ! # --- ! # *Arguments*: ! # * (required) _command_: emboss command ! # *Returns*:: Bio::EMBOSS object def self.seqret(arg) str = self.retrieve('seqret', arg) end + # Combines the initialization and execution for the emboss +entret+ command. + # + # puts Bio::EMBOSS.entret('embl:xlrhodop') + # + # is equivalent to: + # + # object = Bio::EMBOSS.new('entret embl:xlrhodop') + # puts object.exec + # --- + # *Arguments*: + # * (required) _command_: emboss command + # *Returns*:: Bio::EMBOSS object def self.entret(arg) str = self.retrieve('entret', arg) end + # Initializes a new Bio::EMBOSS object. This provides a holder that can + # subsequently be executed (see Bio::EMBOSS.exec). The object does _not_ + # hold any actual data when initialized. + # + # e = Bio::EMBOSS.new('seqret embl:xlrhodop') + # + # For e to actually hold data, it has to be executed: + # puts e.exec + # + # For an overview of commands that can be used with this method, see the + # emboss website. + # --- + # *Arguments*: + # * (required) _command_: emboss command + # *Returns*:: Bio::EMBOSS object def initialize(cmd_line) @cmd_line = cmd_line + ' -stdout -auto' end + # A Bio::EMBOSS object has to be executed before it can return any result. + # obj_A = Bio::EMBOSS.new('transeq -sbegin 110 -send 1171 embl:xlrhodop') + # puts obj_A.result #=> nil + # obj_A.exec + # puts obj_A.result #=> a FASTA-formatted sequence + # + # obj_B = Bio::EMBOSS.new('showfeat embl:xlrhodop') + # obj_B.exec + # puts obj_B.result def exec begin *************** *** 42,46 **** end end ! attr_reader :io, :result private --- 147,156 ---- end end ! ! # Pipe for the command ! attr_reader :io ! ! # Result of the executed command ! attr_reader :result private *************** *** 59,61 **** end # Bio - --- 169,170 ---- From k at dev.open-bio.org Mon May 29 15:28:20 2006 From: k at dev.open-bio.org (Katayama Toshiaki) Date: Mon, 29 May 2006 15:28:20 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio/io soapwsdl.rb,1.4,1.5 Message-ID: <200605291528.k4TFSKmI027085@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio/io In directory dev.open-bio.org:/tmp/cvs-serv27081 Modified Files: soapwsdl.rb Log Message: * added list_methods method to display methods defined in the WSDL file Index: soapwsdl.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/io/soapwsdl.rb,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** soapwsdl.rb 8 May 2006 14:29:58 -0000 1.4 --- soapwsdl.rb 29 May 2006 15:28:18 -0000 1.5 *************** *** 24,33 **** # # --- soap_use_proxy # Set the value of this variable to 'on'. # # --- http_proxy # Set the URL of your proxy server (http://myproxy.com:8080 etc.). # ! # === Example # # % export soap_use_proxy=on --- 24,35 ---- # # --- soap_use_proxy + # # Set the value of this variable to 'on'. # # --- http_proxy + # # Set the URL of your proxy server (http://myproxy.com:8080 etc.). # ! # === Example to use HTTP proxy # # % export soap_use_proxy=on *************** *** 83,86 **** --- 85,94 ---- + # List of methods defined by WSDL + def list_methods + @driver.methods(false) + end + + def method_missing(*arg) @driver.send(*arg) From ngoto at dev.open-bio.org Tue May 30 13:59:38 2006 From: ngoto at dev.open-bio.org (Naohisa Goto) Date: Tue, 30 May 2006 13:59:38 +0000 Subject: [BioRuby-cvs] bioruby/lib/bio command.rb,1.10,1.11 Message-ID: <200605301359.k4UDxcCa029505@dev.open-bio.org> Update of /home/repository/bioruby/bioruby/lib/bio In directory dev.open-bio.org:/tmp/cvs-serv29485/lib/bio Modified Files: command.rb Log Message: Bio::Command::Tools#call_command_local_fork is added, and some messeage are added. This is a temporary change. Bio::Command will be drastically changed later. Index: command.rb =================================================================== RCS file: /home/repository/bioruby/bioruby/lib/bio/command.rb,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** command.rb 9 May 2006 07:17:11 -0000 1.10 --- command.rb 30 May 2006 13:59:36 -0000 1.11 *************** *** 30,35 **** UNESCAPABLE_CHARS = /[\x00-\x08\x10-\x1a\x1c-\x1f\x7f\xff]/n ! #module_function ! private # Escape special characters in command line string for cmd.exe on Windows. --- 30,34 ---- UNESCAPABLE_CHARS = /[\x00-\x08\x10-\x1a\x1c-\x1f\x7f\xff]/n ! module_function # Escape special characters in command line string for cmd.exe on Windows. *************** *** 94,98 **** call_command_local_popen(cmd, query, &block) else ! call_command_local_open3(cmd, query, &block) end end --- 93,97 ---- call_command_local_popen(cmd, query, &block) else ! call_command_local_fork(cmd, query, &block) end end *************** *** 116,119 **** --- 115,142 ---- end + # Executes the program via fork (by using IO.popen("-")) and exec. + # If block is given, yield the block with input and output IO objects. + # + # From the view point of security, this method is recommended + # rather than exec_local_popen. + def call_command_local_fork(cmd, query = nil) + IO.popen("-", "r+") do |io| + if io then + # parent + if block_given? + yield io, io + else + io.sync = true + io.print query if query + io.close_write + io.read + end + else + # child + Kernel.exec(*cmd) + end + end + end + # Executes the program via Open3.popen3 # If block is given, yield the block with input and output IO objects. *************** *** 193,197 **** # (Note that Content-Type and Content-Length are automatically # set by default.) ! # +uri+ must be a URI object and +params+ must be a hash. # def post_form(uri, params, header = {}) --- 216,221 ---- # (Note that Content-Type and Content-Length are automatically # set by default.) ! # +uri+ must be a URI object, +params+ must be a hash, and ! # +header+ must be a hash. # def post_form(uri, params, header = {})