bio-gggenome 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/.travis.yml +12 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +20 -0
- data/README.md +57 -0
- data/README.rdoc +48 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/lib/bio-gggenome.rb +12 -0
- data/lib/bio-gggenome/gggenome.rb +85 -0
- data/test/helper.rb +17 -0
- data/test/test_bio-gggenome.rb +84 -0
- metadata +143 -0
    
        data/.document
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    | @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            language: ruby
         | 
| 2 | 
            +
            rvm:
         | 
| 3 | 
            +
              - 1.9.2
         | 
| 4 | 
            +
              - 1.9.3
         | 
| 5 | 
            +
              - jruby-19mode # JRuby in 1.9 mode
         | 
| 6 | 
            +
              - rbx-19mode
         | 
| 7 | 
            +
            #  - 1.8.7
         | 
| 8 | 
            +
            #  - jruby-18mode # JRuby in 1.8 mode
         | 
| 9 | 
            +
            #  - rbx-18mode
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            # uncomment this line if your project needs to run something other than `rake`:
         | 
| 12 | 
            +
            # script: bundle exec rspec spec
         | 
    
        data/Gemfile
    ADDED
    
    | @@ -0,0 +1,14 @@ | |
| 1 | 
            +
            source "http://rubygems.org"
         | 
| 2 | 
            +
            # Add dependencies required to use your gem here.
         | 
| 3 | 
            +
            # Example:
         | 
| 4 | 
            +
            #   gem "activesupport", ">= 2.3.5"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            # Add dependencies to develop your gem here.
         | 
| 7 | 
            +
            # Include everything needed to run rake, tests, features, etc.
         | 
| 8 | 
            +
            group :development do
         | 
| 9 | 
            +
              gem "rdoc", "~> 3.12"
         | 
| 10 | 
            +
              gem "bundler", ">= 1.0.0"
         | 
| 11 | 
            +
              gem "jeweler", "~> 1.8.4"
         | 
| 12 | 
            +
              gem "bio", ">= 1.4.2"
         | 
| 13 | 
            +
              gem "rdoc", "~> 3.12"
         | 
| 14 | 
            +
            end
         | 
    
        data/LICENSE.txt
    ADDED
    
    | @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            Copyright (c) 2013 Mitsuteru Nakao
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining
         | 
| 4 | 
            +
            a copy of this software and associated documentation files (the
         | 
| 5 | 
            +
            "Software"), to deal in the Software without restriction, including
         | 
| 6 | 
            +
            without limitation the rights to use, copy, modify, merge, publish,
         | 
| 7 | 
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         | 
| 8 | 
            +
            permit persons to whom the Software is furnished to do so, subject to
         | 
| 9 | 
            +
            the following conditions:
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            The above copyright notice and this permission notice shall be
         | 
| 12 | 
            +
            included in all copies or substantial portions of the Software.
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         | 
| 15 | 
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         | 
| 16 | 
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         | 
| 17 | 
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         | 
| 18 | 
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         | 
| 19 | 
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         | 
| 20 | 
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
    
        data/README.md
    ADDED
    
    | @@ -0,0 +1,57 @@ | |
| 1 | 
            +
            # bio-gggenome
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            [](http://travis-ci.org/nakao/bioruby-gggenome)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Ruby client for GGGenome the Ultrafast sequence search, http://gggenome.dbcls.jp/en/
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            Note: this software is under active development!
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ## Installation
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            ```sh
         | 
| 12 | 
            +
                gem install bio-gggenome
         | 
| 13 | 
            +
            ```
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            ## Usage
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            ```ruby
         | 
| 18 | 
            +
                require 'bio-gggenome'
         | 
| 19 | 
            +
                db = "hg19"
         | 
| 20 | 
            +
                missmatch = 1
         | 
| 21 | 
            +
                query = "TTCATTGACAACATT"
         | 
| 22 | 
            +
                hits = Bio::GGGenome.search(db, missmatch, query)
         | 
| 23 | 
            +
                
         | 
| 24 | 
            +
                hits['results'].each do |hit|
         | 
| 25 | 
            +
                  hit['name']     #=> 'chr1'
         | 
| 26 | 
            +
                  hit['position'] #=> 83462476
         | 
| 27 | 
            +
                  hit['strand']   #=> "+"
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
            ```
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            The API doc is online. For more code examples see the test files in
         | 
| 32 | 
            +
            the source tree.
         | 
| 33 | 
            +
                    
         | 
| 34 | 
            +
            ## Project home page
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            Information on the source tree, documentation, examples, issues and
         | 
| 37 | 
            +
            how to contribute, see
         | 
| 38 | 
            +
             | 
| 39 | 
            +
              http://github.com/nakao/bio-gggenome
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            The BioRuby community is on IRC server: irc.freenode.org, channel: #bioruby.
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            ## Cite
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            If you use this software, please cite one of
         | 
| 46 | 
            +
              
         | 
| 47 | 
            +
            * [BioRuby: bioinformatics software for the Ruby programming language](http://dx.doi.org/10.1093/bioinformatics/btq475)
         | 
| 48 | 
            +
            * [Biogem: an effective tool-based approach for scaling up open source software development in bioinformatics](http://dx.doi.org/10.1093/bioinformatics/bts080)
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            ## Biogems.info
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            This Biogem is published at [#bio-gggenome](http://biogems.info/index.html)
         | 
| 53 | 
            +
             | 
| 54 | 
            +
            ## Copyright
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            Copyright (c) 2013 Mitsuteru Nakao. See LICENSE.txt for further details.
         | 
| 57 | 
            +
             | 
    
        data/README.rdoc
    ADDED
    
    | @@ -0,0 +1,48 @@ | |
| 1 | 
            +
            = bio-gggenome
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            {<img
         | 
| 4 | 
            +
            src="https://secure.travis-ci.org/nakao/bioruby-gggenome.png"
         | 
| 5 | 
            +
            />}[http://travis-ci.org/#!/nakao/bioruby-gggenome]
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            Full description goes here
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            Note: this software is under active development!
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            == Installation
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                    gem install bio-gggenome
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            == Usage
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            == Developers
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            To use the library 
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                    require 'bio-gggenome'
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            The API doc is online. For more code examples see also the test files in
         | 
| 24 | 
            +
            the source tree.
         | 
| 25 | 
            +
                    
         | 
| 26 | 
            +
            == Project home page
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            Information on the source tree, documentation, issues and how to contribute, see
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              http://github.com/nakao/bioruby-gggenome
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            The BioRuby community is on IRC server: irc.freenode.org, channel: #bioruby.
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            == Cite
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              If you use this software, please cite one of
         | 
| 37 | 
            +
             
         | 
| 38 | 
            +
            * [BioRuby: bioinformatics software for the Ruby programming language](http://dx.doi.org/10.1093/bioinformatics/btq475)
         | 
| 39 | 
            +
            * [Biogem: an effective tool-based approach for scaling up open source software development in bioinformatics](http://dx.doi.org/10.1093/bioinformatics/bts080)
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            == Biogems.info
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            This Biogem is published at http://biogems.info/index.html#bio-gggenome
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            == Copyright
         | 
| 46 | 
            +
             | 
| 47 | 
            +
            Copyright (c) 2013 Mitsuteru Nakao. See LICENSE.txt for further details.
         | 
| 48 | 
            +
             | 
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1,45 @@ | |
| 1 | 
            +
            # encoding: utf-8
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'rubygems'
         | 
| 4 | 
            +
            require 'bundler'
         | 
| 5 | 
            +
            begin
         | 
| 6 | 
            +
              Bundler.setup(:default, :development)
         | 
| 7 | 
            +
            rescue Bundler::BundlerError => e
         | 
| 8 | 
            +
              $stderr.puts e.message
         | 
| 9 | 
            +
              $stderr.puts "Run `bundle install` to install missing gems"
         | 
| 10 | 
            +
              exit e.status_code
         | 
| 11 | 
            +
            end
         | 
| 12 | 
            +
            require 'rake'
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            require 'jeweler'
         | 
| 15 | 
            +
            Jeweler::Tasks.new do |gem|
         | 
| 16 | 
            +
              # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
         | 
| 17 | 
            +
              gem.name = "bio-gggenome"
         | 
| 18 | 
            +
              gem.homepage = "http://github.com/nakao/bio-gggenome"
         | 
| 19 | 
            +
              gem.license = "MIT"
         | 
| 20 | 
            +
              gem.summary = %Q{GGGenome ruby client}
         | 
| 21 | 
            +
              gem.description = %Q{A Ruby client for GGGenome the Ultrafast sequence search}
         | 
| 22 | 
            +
              gem.email = "mitsuteru.nakao@gmail.com"
         | 
| 23 | 
            +
              gem.authors = ["Mitsuteru Nakao"]
         | 
| 24 | 
            +
              # dependencies defined in Gemfile
         | 
| 25 | 
            +
            end
         | 
| 26 | 
            +
            Jeweler::RubygemsDotOrgTasks.new
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            require 'rake/testtask'
         | 
| 29 | 
            +
            Rake::TestTask.new(:test) do |test|
         | 
| 30 | 
            +
              test.libs << 'lib' << 'test'
         | 
| 31 | 
            +
              test.pattern = 'test/**/test_*.rb'
         | 
| 32 | 
            +
              test.verbose = true
         | 
| 33 | 
            +
            end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            task :default => :test
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            require 'rdoc/task'
         | 
| 38 | 
            +
            Rake::RDocTask.new do |rdoc|
         | 
| 39 | 
            +
              version = File.exist?('VERSION') ? File.read('VERSION') : ""
         | 
| 40 | 
            +
             | 
| 41 | 
            +
              rdoc.rdoc_dir = 'rdoc'
         | 
| 42 | 
            +
              rdoc.title = "bio-gggenome #{version}"
         | 
| 43 | 
            +
              rdoc.rdoc_files.include('README*')
         | 
| 44 | 
            +
              rdoc.rdoc_files.include('lib/**/*.rb')
         | 
| 45 | 
            +
            end
         | 
    
        data/VERSION
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            0.1.0
         | 
    
        data/lib/bio-gggenome.rb
    ADDED
    
    | @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            # Please require your code below, respecting the naming conventions in the
         | 
| 2 | 
            +
            # bioruby directory tree.
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # For example, say you have a plugin named bio-plugin, the only uncommented
         | 
| 5 | 
            +
            # line in this file would be 
         | 
| 6 | 
            +
            #
         | 
| 7 | 
            +
            #   require 'bio/bio-plugin/plugin'
         | 
| 8 | 
            +
            #
         | 
| 9 | 
            +
            # In this file only require other files. Avoid other source code.
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            require 'bio-gggenome/gggenome.rb'
         | 
| 12 | 
            +
             | 
| @@ -0,0 +1,85 @@ | |
| 1 | 
            +
            require 'rubygems'
         | 
| 2 | 
            +
            require 'json'
         | 
| 3 | 
            +
            require 'uri'
         | 
| 4 | 
            +
            require 'bio'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module Bio
         | 
| 7 | 
            +
              
         | 
| 8 | 
            +
              # Bio::GGGenome
         | 
| 9 | 
            +
              #
         | 
| 10 | 
            +
              # gggenome = Bio::GGGenome.new
         | 
| 11 | 
            +
              # hits = gggenome.search("hg19", 1, "TTCATTGACAACATT")
         | 
| 12 | 
            +
              # hits = gggenome.search("hg19", "TTCATTGACAACATT")
         | 
| 13 | 
            +
              # hits = gggenome.search("TTCATTGACAACATT")
         | 
| 14 | 
            +
              #
         | 
| 15 | 
            +
              # hits = Bio::GGGenome.search("hg19", "TTCATTGACAACATT")
         | 
| 16 | 
            +
              #
         | 
| 17 | 
            +
              class GGGenome
         | 
| 18 | 
            +
                BASE_URL = "http://gggenome.dbcls.jp"    
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                def self.search(*args)
         | 
| 21 | 
            +
                  new.search(args)
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
                    
         | 
| 24 | 
            +
                def initialize(uri = BASE_URL)
         | 
| 25 | 
            +
                  uri = URI.parse(uri) unless uri.kind_of?(URI)
         | 
| 26 | 
            +
                  @pathbase = uri.path
         | 
| 27 | 
            +
                  @pathbase = '/' + @pathbase unless /\A\// =~ @pathbase
         | 
| 28 | 
            +
                  @pathbase = @pathbase + '/' unless /\/\z/ =~ @pathbase
         | 
| 29 | 
            +
                  @http = Bio::Command.new_http(uri.host, uri.port)
         | 
| 30 | 
            +
                  @header = {
         | 
| 31 | 
            +
                    'User-Agent' => "BioRuby/#{Bio::BIORUBY_VERSION_ID}"
         | 
| 32 | 
            +
                  }
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
                
         | 
| 35 | 
            +
                # Search, returns a result hash.
         | 
| 36 | 
            +
                # Bio::GGGenome#search("hg19", 1, "TTCATTGACAACATT")
         | 
| 37 | 
            +
                # Bio::GGGenome#search("hg19", "TTCATTGACAACATT")
         | 
| 38 | 
            +
                # Bio::GGGenome#search(1, "TTCATTGACAACATT")
         | 
| 39 | 
            +
                # Bio::GGGenome#search("TTCATTGACAACATT")
         | 
| 40 | 
            +
                # Bio::GGGenome#search("http://gggenome.dbcls.jp/hg19/TTCATTGACAACATTGCGT.json")
         | 
| 41 | 
            +
                def search(*args)
         | 
| 42 | 
            +
                  db        = nil
         | 
| 43 | 
            +
                  missmatch = nil
         | 
| 44 | 
            +
                  
         | 
| 45 | 
            +
                  if args[0] =~ /^http/
         | 
| 46 | 
            +
                    args[0].sub!(BASE_URL, '')
         | 
| 47 | 
            +
                    args[0].sub!(/^\//,'')
         | 
| 48 | 
            +
                    args[0].sub!(".json", '')
         | 
| 49 | 
            +
                    args = args[0].split("/")        
         | 
| 50 | 
            +
                  end
         | 
| 51 | 
            +
                  
         | 
| 52 | 
            +
                  case args.size
         | 
| 53 | 
            +
                  when 1
         | 
| 54 | 
            +
                    seq = args.shift
         | 
| 55 | 
            +
                  when 2
         | 
| 56 | 
            +
                    if args[0].to_s.strip =~ /^[0-9]+$/
         | 
| 57 | 
            +
                      missmatch,seq = args
         | 
| 58 | 
            +
                    else
         | 
| 59 | 
            +
                      db,seq = args
         | 
| 60 | 
            +
                    end  
         | 
| 61 | 
            +
                  when 3
         | 
| 62 | 
            +
                    db,missmatch,seq = args
         | 
| 63 | 
            +
                  else
         | 
| 64 | 
            +
                    raise ArgumentError
         | 
| 65 | 
            +
                  end     
         | 
| 66 | 
            +
                  query = ['', db, missmatch, seq].compact.join("/")
         | 
| 67 | 
            +
                  path =  query + ".json"
         | 
| 68 | 
            +
                  begin
         | 
| 69 | 
            +
                    response = @http.get(path, @header)
         | 
| 70 | 
            +
                  rescue
         | 
| 71 | 
            +
                  end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                  case response.code
         | 
| 74 | 
            +
                  when "200"
         | 
| 75 | 
            +
                    JSON.parse(response.body)
         | 
| 76 | 
            +
                  when "302"
         | 
| 77 | 
            +
                    location = response.header['Location']
         | 
| 78 | 
            +
                    search(location)
         | 
| 79 | 
            +
                  else
         | 
| 80 | 
            +
                    nil
         | 
| 81 | 
            +
                  end
         | 
| 82 | 
            +
                end
         | 
| 83 | 
            +
              end
         | 
| 84 | 
            +
              
         | 
| 85 | 
            +
            end
         | 
    
        data/test/helper.rb
    ADDED
    
    | @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            require 'rubygems'
         | 
| 2 | 
            +
            require 'bundler'
         | 
| 3 | 
            +
            begin
         | 
| 4 | 
            +
              Bundler.setup(:default, :development)
         | 
| 5 | 
            +
            rescue Bundler::BundlerError => e
         | 
| 6 | 
            +
              $stderr.puts e.message
         | 
| 7 | 
            +
              $stderr.puts "Run `bundle install` to install missing gems"
         | 
| 8 | 
            +
              exit e.status_code
         | 
| 9 | 
            +
            end
         | 
| 10 | 
            +
            require 'test/unit'
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            $LOAD_PATH.unshift(File.dirname(__FILE__))
         | 
| 13 | 
            +
            $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
         | 
| 14 | 
            +
            require 'bio-gggenome'
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            class Test::Unit::TestCase
         | 
| 17 | 
            +
            end
         | 
| @@ -0,0 +1,84 @@ | |
| 1 | 
            +
            require 'helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class TestBioGggenome < Test::Unit::TestCase
         | 
| 4 | 
            +
              
         | 
| 5 | 
            +
              def test_new
         | 
| 6 | 
            +
                assert(Bio::GGGenome.new)
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
              
         | 
| 9 | 
            +
              def test_search_result_is_a_hash
         | 
| 10 | 
            +
                g = Bio::GGGenome.new
         | 
| 11 | 
            +
                hits = g.search('hg19', '1', 'TTCATTGACAACATT')
         | 
| 12 | 
            +
                assert_equal(Hash, hits.class)
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              def test_search_arguments_3_and_2
         | 
| 16 | 
            +
                g = Bio::GGGenome.new
         | 
| 17 | 
            +
                hits = g.search('hg19', '0', 'TTCATTGACAACATT')
         | 
| 18 | 
            +
                hits1 = g.search('hg19',  'TTCATTGACAACATT')
         | 
| 19 | 
            +
                assert_equal(hits['summary'][0]['count'],           hits1['summary'][0]['count'])
         | 
| 20 | 
            +
                assert_equal(hits['summary'][1]['count'],           hits1['summary'][1]['count'])
         | 
| 21 | 
            +
                assert_equal(hits['summary'][0]['count_is_approx'], hits1['summary'][0]['count_is_approx'])
         | 
| 22 | 
            +
                assert_equal(hits['summary'][0]['query'],           hits1['summary'][0]['query'])
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              def test_class_method_search
         | 
| 26 | 
            +
                hits = Bio::GGGenome.search('hg19', '0', 'TTCATTGACAACATT')
         | 
| 27 | 
            +
                assert_equal(Hash, hits.class)
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
              
         | 
| 30 | 
            +
              def test_hits_hash_keys
         | 
| 31 | 
            +
                hits = Bio::GGGenome.search('hg19', '0', 'TTCATTGACAACATT')
         | 
| 32 | 
            +
                assert_equal(['database', 'error', 'results', 'summary', 'time'].sort, 
         | 
| 33 | 
            +
                             hits.keys.sort)
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
              
         | 
| 36 | 
            +
              def test_hits_database
         | 
| 37 | 
            +
                hits = Bio::GGGenome.search('hg19', '0', 'TTCATTGACAACATT')
         | 
| 38 | 
            +
                assert_equal("Human genome, GRCh37/hg19 (Feb, 2009)", hits["database"])
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
              
         | 
| 41 | 
            +
              def test_hits_error
         | 
| 42 | 
            +
                hits = Bio::GGGenome.search('hg19', '1', 'TTCATTGACAACATT')
         | 
| 43 | 
            +
                assert_equal("none", hits["error"])
         | 
| 44 | 
            +
              end
         | 
| 45 | 
            +
              
         | 
| 46 | 
            +
              def test_hits_summary
         | 
| 47 | 
            +
                hits = Bio::GGGenome.search('hg19', '0', 'TTCATTGACAACATT')
         | 
| 48 | 
            +
                assert_equal(Array, hits["summary"].class)
         | 
| 49 | 
            +
                assert_equal(2, hits["summary"].size)
         | 
| 50 | 
            +
                assert_equal(['count', 'count_is_approx', 'query'].sort, hits["summary"][0].keys.sort)
         | 
| 51 | 
            +
                assert_equal(15,                hits["summary"][0]['count'])
         | 
| 52 | 
            +
                assert_equal(false,             hits["summary"][0]['count_is_approx'])
         | 
| 53 | 
            +
                assert_equal('TTCATTGACAACATT', hits["summary"][0]['query'])
         | 
| 54 | 
            +
               end
         | 
| 55 | 
            +
              
         | 
| 56 | 
            +
              def test_hits_time
         | 
| 57 | 
            +
                hits = Bio::GGGenome.search('hg19', '0', 'TTCATTGACAACATT')
         | 
| 58 | 
            +
                assert_equal(Date.today, Date.parse(hits["time"]))    
         | 
| 59 | 
            +
              end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
              def test_hits_results_size
         | 
| 62 | 
            +
                hits = Bio::GGGenome.search('hg19', '0', 'TTCATTGACAACATT')
         | 
| 63 | 
            +
                assert_equal(23, hits["results"].size)    
         | 
| 64 | 
            +
              end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
              def test_hits_results_keys
         | 
| 67 | 
            +
                hits = Bio::GGGenome.search('hg19', '0', 'TTCATTGACAACATT')
         | 
| 68 | 
            +
                assert_equal(['name', 'position', 'position_end', 'snippet', 'snippet_pos', 'snippet_end', 'strand'].sort, 
         | 
| 69 | 
            +
                             hits["results"][0].keys.sort)    
         | 
| 70 | 
            +
              end
         | 
| 71 | 
            +
                
         | 
| 72 | 
            +
              def test_hits_results_0
         | 
| 73 | 
            +
                hits = Bio::GGGenome.search('hg19', '0', 'TTCATTGACAACATT')
         | 
| 74 | 
            +
                assert_equal("chr1",   hits["results"][0]['name'])    
         | 
| 75 | 
            +
                assert_equal(83462476, hits["results"][0]['position'])    
         | 
| 76 | 
            +
                assert_equal(83462490, hits["results"][0]['position_end'])    
         | 
| 77 | 
            +
                assert_equal("TTCTCTTCCTCCTCCTCCTCAGCCTCAACATGAAGATGATGAAAATGGAGACCTTCATCGTGATCCACTTCTAATTAATGAATAGTAAGTATATTTTCTCTTCATTGACAACATTTTTCCTCTTACTTTATTGTAAGAATACAATATACGATATATATTGCCATGCAAAATATGTGTTAATTGACTATATTATATTATTGATAGGACTTCTTGAG",
         | 
| 78 | 
            +
                                       hits["results"][0]['snippet'])    
         | 
| 79 | 
            +
                assert_equal(83462376, hits["results"][0]['snippet_pos'])    
         | 
| 80 | 
            +
                assert_equal(83462590, hits["results"][0]['snippet_end'])    
         | 
| 81 | 
            +
                assert_equal("+",      hits["results"][0]['strand'])    
         | 
| 82 | 
            +
              end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,143 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: bio-gggenome
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.1.0
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 | 
            +
            platform: ruby
         | 
| 7 | 
            +
            authors:
         | 
| 8 | 
            +
            - Mitsuteru Nakao
         | 
| 9 | 
            +
            autorequire: 
         | 
| 10 | 
            +
            bindir: bin
         | 
| 11 | 
            +
            cert_chain: []
         | 
| 12 | 
            +
            date: 2013-08-12 00:00:00.000000000 Z
         | 
| 13 | 
            +
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            +
              name: rdoc
         | 
| 16 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
                none: false
         | 
| 18 | 
            +
                requirements:
         | 
| 19 | 
            +
                - - ~>
         | 
| 20 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            +
                    version: '3.12'
         | 
| 22 | 
            +
              type: :development
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            +
                none: false
         | 
| 26 | 
            +
                requirements:
         | 
| 27 | 
            +
                - - ~>
         | 
| 28 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            +
                    version: '3.12'
         | 
| 30 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 31 | 
            +
              name: bundler
         | 
| 32 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            +
                none: false
         | 
| 34 | 
            +
                requirements:
         | 
| 35 | 
            +
                - - ! '>='
         | 
| 36 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 37 | 
            +
                    version: 1.0.0
         | 
| 38 | 
            +
              type: :development
         | 
| 39 | 
            +
              prerelease: false
         | 
| 40 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            +
                none: false
         | 
| 42 | 
            +
                requirements:
         | 
| 43 | 
            +
                - - ! '>='
         | 
| 44 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            +
                    version: 1.0.0
         | 
| 46 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 47 | 
            +
              name: jeweler
         | 
| 48 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 | 
            +
                none: false
         | 
| 50 | 
            +
                requirements:
         | 
| 51 | 
            +
                - - ~>
         | 
| 52 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 53 | 
            +
                    version: 1.8.4
         | 
| 54 | 
            +
              type: :development
         | 
| 55 | 
            +
              prerelease: false
         | 
| 56 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 | 
            +
                none: false
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - ~>
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: 1.8.4
         | 
| 62 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 63 | 
            +
              name: bio
         | 
| 64 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                none: false
         | 
| 66 | 
            +
                requirements:
         | 
| 67 | 
            +
                - - ! '>='
         | 
| 68 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 69 | 
            +
                    version: 1.4.2
         | 
| 70 | 
            +
              type: :development
         | 
| 71 | 
            +
              prerelease: false
         | 
| 72 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 | 
            +
                none: false
         | 
| 74 | 
            +
                requirements:
         | 
| 75 | 
            +
                - - ! '>='
         | 
| 76 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 77 | 
            +
                    version: 1.4.2
         | 
| 78 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 79 | 
            +
              name: rdoc
         | 
| 80 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 81 | 
            +
                none: false
         | 
| 82 | 
            +
                requirements:
         | 
| 83 | 
            +
                - - ~>
         | 
| 84 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 85 | 
            +
                    version: '3.12'
         | 
| 86 | 
            +
              type: :development
         | 
| 87 | 
            +
              prerelease: false
         | 
| 88 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 89 | 
            +
                none: false
         | 
| 90 | 
            +
                requirements:
         | 
| 91 | 
            +
                - - ~>
         | 
| 92 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 93 | 
            +
                    version: '3.12'
         | 
| 94 | 
            +
            description: A Ruby client for GGGenome the Ultrafast sequence search
         | 
| 95 | 
            +
            email: mitsuteru.nakao@gmail.com
         | 
| 96 | 
            +
            executables: []
         | 
| 97 | 
            +
            extensions: []
         | 
| 98 | 
            +
            extra_rdoc_files:
         | 
| 99 | 
            +
            - LICENSE.txt
         | 
| 100 | 
            +
            - README.md
         | 
| 101 | 
            +
            - README.rdoc
         | 
| 102 | 
            +
            files:
         | 
| 103 | 
            +
            - .document
         | 
| 104 | 
            +
            - .travis.yml
         | 
| 105 | 
            +
            - Gemfile
         | 
| 106 | 
            +
            - LICENSE.txt
         | 
| 107 | 
            +
            - README.md
         | 
| 108 | 
            +
            - README.rdoc
         | 
| 109 | 
            +
            - Rakefile
         | 
| 110 | 
            +
            - VERSION
         | 
| 111 | 
            +
            - lib/bio-gggenome.rb
         | 
| 112 | 
            +
            - lib/bio-gggenome/gggenome.rb
         | 
| 113 | 
            +
            - test/helper.rb
         | 
| 114 | 
            +
            - test/test_bio-gggenome.rb
         | 
| 115 | 
            +
            homepage: http://github.com/nakao/bio-gggenome
         | 
| 116 | 
            +
            licenses:
         | 
| 117 | 
            +
            - MIT
         | 
| 118 | 
            +
            post_install_message: 
         | 
| 119 | 
            +
            rdoc_options: []
         | 
| 120 | 
            +
            require_paths:
         | 
| 121 | 
            +
            - lib
         | 
| 122 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 123 | 
            +
              none: false
         | 
| 124 | 
            +
              requirements:
         | 
| 125 | 
            +
              - - ! '>='
         | 
| 126 | 
            +
                - !ruby/object:Gem::Version
         | 
| 127 | 
            +
                  version: '0'
         | 
| 128 | 
            +
                  segments:
         | 
| 129 | 
            +
                  - 0
         | 
| 130 | 
            +
                  hash: 1277551901848741236
         | 
| 131 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 132 | 
            +
              none: false
         | 
| 133 | 
            +
              requirements:
         | 
| 134 | 
            +
              - - ! '>='
         | 
| 135 | 
            +
                - !ruby/object:Gem::Version
         | 
| 136 | 
            +
                  version: '0'
         | 
| 137 | 
            +
            requirements: []
         | 
| 138 | 
            +
            rubyforge_project: 
         | 
| 139 | 
            +
            rubygems_version: 1.8.23
         | 
| 140 | 
            +
            signing_key: 
         | 
| 141 | 
            +
            specification_version: 3
         | 
| 142 | 
            +
            summary: GGGenome ruby client
         | 
| 143 | 
            +
            test_files: []
         |