bio-samtools-server 0.1.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e23edcddef2395d0d46cb0d405c9931280af98ee
4
+ data.tar.gz: e2887c08e5853df572e72f32008c4e3266a46849
5
+ SHA512:
6
+ metadata.gz: 590478424e3e6613786cfd4c3b114bc3b904bfd90440c6783e4f9d36c9c8595d6c30432986591d853639ec3ef24d9b1c1702036ac815e232438191afcea44519
7
+ data.tar.gz: 4cc09d1c5ca6c921730b0e8626cc7ade786afb1705f84a10f1e05bb5b12aa160ea2f03fbd2438e658c1cbca3464a06c45e97f3a0a92e86f5d74a92065225aa4d
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+
7
+ # - rbx-19mode
8
+ # - 1.8.7
9
+ # - jruby-18mode # JRuby in 1.8 mode
10
+ # - rbx-18mode
11
+
12
+ # uncomment this line if your project needs to run something other than `rake`:
13
+ # script: bundle exec rspec spec
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+ gem "bio-samtools", ">=2.0.3"
6
+ gem "sinatra", ">=1.4.5"
7
+ # Add dependencies to develop your gem here.
8
+ # Include everything needed to run rake, tests, features, etc.
9
+ group :development do
10
+ gem "shoulda", ">= 0"
11
+ gem "rdoc", "~> 3.12"
12
+ gem "simplecov", ">= 0"
13
+ gem "jeweler", "~> 2", :git => "https://github.com/technicalpickles/jeweler.git"
14
+ gem "bundler", ">= 1.0.21"
15
+ gem "bio", ">= 1.4.2"
16
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 homonecloco
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.
@@ -0,0 +1,47 @@
1
+ # bio-samtools-server
2
+
3
+ [![Build Status](https://secure.travis-ci.org/homonecloco/bioruby-samtools-server.png)](http://travis-ci.org/homonecloco/bioruby-samtools-server)
4
+
5
+ Full description goes here
6
+
7
+ Note: this software is under active development!
8
+
9
+ ## Installation
10
+
11
+ ```sh
12
+ gem install bio-samtools-server
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```ruby
18
+ require 'bio-samtools-server'
19
+ ```
20
+
21
+ The API doc is online. For more code examples see the test files in
22
+ the source tree.
23
+
24
+ ## Project home page
25
+
26
+ Information on the source tree, documentation, examples, issues and
27
+ how to contribute, see
28
+
29
+ http://github.com/homonecloco/bioruby-samtools-server
30
+
31
+ The BioRuby community is on IRC server: irc.freenode.org, channel: #bioruby.
32
+
33
+ ## Cite
34
+
35
+ If you use this software, please cite one of
36
+
37
+ * [BioRuby: bioinformatics software for the Ruby programming language](http://dx.doi.org/10.1093/bioinformatics/btq475)
38
+ * [Biogem: an effective tool-based approach for scaling up open source software development in bioinformatics](http://dx.doi.org/10.1093/bioinformatics/bts080)
39
+
40
+ ## Biogems.info
41
+
42
+ This Biogem is published at (http://biogems.info/index.html#bio-samtools-server)
43
+
44
+ ## Copyright
45
+
46
+ Copyright (c) 2014 homonecloco. See LICENSE.txt for further details.
47
+
@@ -0,0 +1,48 @@
1
+ = bio-samtools-server
2
+
3
+ {<img
4
+ src="https://secure.travis-ci.org/homonecloco/bioruby-samtools-server.png"
5
+ />}[http://travis-ci.org/#!/homonecloco/bioruby-samtools-server]
6
+
7
+ Full description goes here
8
+
9
+ Note: this software is under active development!
10
+
11
+ == Installation
12
+
13
+ gem install bio-samtools-server
14
+
15
+ == Usage
16
+
17
+ == Developers
18
+
19
+ To use the library
20
+
21
+ require 'bio-samtools-server'
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/homonecloco/bioruby-samtools-server
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-samtools-server
44
+
45
+ == Copyright
46
+
47
+ Copyright (c) 2014 homonecloco. See LICENSE.txt for further details.
48
+
@@ -0,0 +1,55 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+
6
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
7
+
8
+ begin
9
+ Bundler.setup(:default, :development)
10
+ rescue Bundler::BundlerError => e
11
+ $stderr.puts e.message
12
+ $stderr.puts "Run `bundle install` to install missing gems"
13
+ exit e.status_code
14
+ end
15
+ require 'rake'
16
+
17
+ require 'jeweler'
18
+ Jeweler::Tasks.new do |gem|
19
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
20
+ gem.name = "bio-samtools-server"
21
+ gem.homepage = "http://github.com/homonecloco/bioruby-samtools-server"
22
+ gem.license = "MIT"
23
+ gem.summary = %Q{Web server for bio-samtools}
24
+ gem.description = %Q{A minimal web service on the top of sinatra to query bam files}
25
+ gem.email = "ricardo.ramirez-gonzalez@tgac.ac.uk"
26
+ gem.authors = ["homonecloco"]
27
+ gem.version = version
28
+ # dependencies defined in Gemfile
29
+ end
30
+ Jeweler::RubygemsDotOrgTasks.new
31
+
32
+ require 'rake/testtask'
33
+ Rake::TestTask.new(:test) do |test|
34
+ test.libs << 'lib' << 'test'
35
+ test.pattern = 'test/**/test_*.rb'
36
+ test.verbose = true
37
+ end
38
+
39
+ desc "Code coverage detail"
40
+ task :simplecov do
41
+ ENV['COVERAGE'] = "true"
42
+ Rake::Task['test'].execute
43
+ end
44
+
45
+ task :default => :test
46
+
47
+ require 'rdoc/task'
48
+ Rake::RDocTask.new do |rdoc|
49
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "bio-samtools-server #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
@@ -0,0 +1,28 @@
1
+ require 'optparse'
2
+ #require 'sinatra/base'
3
+
4
+ $: << File.expand_path(File.dirname(__FILE__) + '/../lib')
5
+ $: << File.expand_path('.')
6
+ path=File.expand_path(File.dirname(__FILE__) + '/../lib/bio-samtools-server.rb')
7
+ $stderr.puts "Loading: #{path}"
8
+ require path
9
+
10
+
11
+ options = {}
12
+
13
+
14
+ OptionParser.new do |opts|
15
+ opts.banner = "Usage: bam-server.rb [options]"
16
+
17
+ opts.on("-r", "--reference FOLDER", "Folder with fasta files with the reference sequences. Make sure to run faidx before running bfr in parallel") do |o|
18
+ options[:reference] = o
19
+ end
20
+
21
+ opts.on("-f", "--bam FOLDER", "Folder containing the BAM files") do |o|
22
+ options[:folder] = o
23
+ end
24
+
25
+ end.parse!
26
+
27
+ #Bio::WS::BAM.set :folder, options[:folder]
28
+ Bio::WS::BAM.run!(options)
@@ -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
+ require 'bio-samtools'
11
+ require 'bio-samtools-server/samtools-server.rb'
12
+
@@ -0,0 +1,46 @@
1
+ require 'rubygems' if RUBY_VERSION < "1.9"
2
+ require 'sinatra/base'
3
+
4
+ module Bio::WS
5
+ class BAM < Sinatra::Base
6
+
7
+ def initialize(app = nil, params = {})
8
+ super(app)
9
+ @bootstrap = params.fetch(:bootstrap, false)
10
+ @bam_files = Hash.new
11
+ end
12
+
13
+ def get_bam(bam,reference)
14
+ return @bam_files[bam] if @bam_files[bam]
15
+
16
+ bam_path = "#{self.settings.folder.to_s}/#{bam}.bam"
17
+ reference_path = "#{self.settings.reference.to_s}/#{reference}"
18
+ return nil unless File.file?(bam_path)
19
+ @bam_files[bam] = Bio::DB::Sam.new(
20
+ :fasta => reference_path,
21
+ :bam => bam_path
22
+ )
23
+
24
+ return @bam_files[bam]
25
+ end
26
+
27
+ get '/' do
28
+ folder = settings.folder.to_s
29
+
30
+ bam = params[:bam]
31
+ region = params[:region]
32
+ ref = params[:ref]
33
+
34
+ # "Hello World from MyApp in separate file! #{ self.settings.folder.to_s} #{bam} #{region}"
35
+ #self.settings.folder.to_s
36
+ stream do |out|
37
+ get_bam(bam, ref).fetch("chr_1", 10,1000) do |sam|
38
+ # test that all the objects are Bio::DB::Alignment objects
39
+ #assert_equal(sam.class, Bio::DB::Alignment)
40
+ #assert_equal(sam.rname, "chr_1")
41
+ out << "#{sam.sam_string}\n"
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,34 @@
1
+ require 'simplecov'
2
+
3
+ module SimpleCov::Configuration
4
+ def clean_filters
5
+ @filters = []
6
+ end
7
+ end
8
+
9
+ SimpleCov.configure do
10
+ clean_filters
11
+ load_adapter 'test_frameworks'
12
+ end
13
+
14
+ ENV["COVERAGE"] && SimpleCov.start do
15
+ add_filter "/.rvm/"
16
+ end
17
+ require 'rubygems'
18
+ require 'bundler'
19
+ begin
20
+ Bundler.setup(:default, :development)
21
+ rescue Bundler::BundlerError => e
22
+ $stderr.puts e.message
23
+ $stderr.puts "Run `bundle install` to install missing gems"
24
+ exit e.status_code
25
+ end
26
+ require 'test/unit'
27
+ require 'shoulda'
28
+
29
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
30
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
31
+ require 'bio-samtools-server'
32
+
33
+ class Test::Unit::TestCase
34
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestBioSamtoolsServer < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,172 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bio-samtools-server
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - homonecloco
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bio-samtools
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: sinatra
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.4.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: shoulda
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rdoc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.12'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: jeweler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2'
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 1.0.21
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.0.21
111
+ - !ruby/object:Gem::Dependency
112
+ name: bio
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 1.4.2
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 1.4.2
125
+ description: A minimal web service on the top of sinatra to query bam files
126
+ email: ricardo.ramirez-gonzalez@tgac.ac.uk
127
+ executables:
128
+ - bam-server.rb
129
+ extensions: []
130
+ extra_rdoc_files:
131
+ - LICENSE.txt
132
+ - README.md
133
+ - README.rdoc
134
+ files:
135
+ - ".document"
136
+ - ".travis.yml"
137
+ - Gemfile
138
+ - LICENSE.txt
139
+ - README.md
140
+ - README.rdoc
141
+ - Rakefile
142
+ - VERSION
143
+ - bin/bam-server.rb
144
+ - lib/bio-samtools-server.rb
145
+ - lib/bio-samtools-server/samtools-server.rb
146
+ - test/helper.rb
147
+ - test/test_bio-samtools-server.rb
148
+ homepage: http://github.com/homonecloco/bioruby-samtools-server
149
+ licenses:
150
+ - MIT
151
+ metadata: {}
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ requirements: []
167
+ rubyforge_project:
168
+ rubygems_version: 2.2.1
169
+ signing_key:
170
+ specification_version: 4
171
+ summary: Web server for bio-samtools
172
+ test_files: []