bio-freebayes 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ea94d7b4ac2f228991791f9bf85427bd9e1097af
4
+ data.tar.gz: 608d8848276886fad612e67f6ce3c31238a7b61b
5
+ SHA512:
6
+ metadata.gz: dbf7d6e9198e9492e4561f0ecbb708b48d06c93551a1fc4c03959c319efbf45ddc2734ad66320a73c73131cf8aa13016d94b4d3f334bc70cea0663a85cf3f8a8
7
+ data.tar.gz: 3dae18f6dfa1a829a1a2b0093557bd699a655c2df9dbe078a45988644045f2987db9ffe3e7f347ee3fa5efc4f10cb1c9c609cebab53f1448a60301b4d740657a
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bio-freebayes.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Bio::Freebayes
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bio/freebayes`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'bio-freebayes'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install bio-freebayes
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( https://github.com/[my-github-username]/bio-freebayes/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bio/freebayes"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bio/freebayes/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bio-freebayes"
8
+ spec.version = Bio::Freebayes::VERSION
9
+ spec.authors = ["Natapol Pornputtapong"]
10
+ spec.email = ["natapol.por@gmail.com"]
11
+
12
+ spec.summary = %q{The API for Freebayes version #{Bio::Freebayes::EXTVERSION}}
13
+ spec.description = %q{The API for Freebayes version #{Bio::Freebayes::EXTVERSION}}
14
+ spec.homepage = "http://rubygems.org/gems/bio-freebayes"
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+ spec.extensions = ["ext/mkrf_conf.rb"]
29
+
30
+ spec.add_runtime_dependency "bio-vcf", "~> 0.8"
31
+
32
+ spec.add_development_dependency "bundler", "~> 1.9"
33
+ spec.add_development_dependency "rake", "~> 10.0"
34
+ end
data/ext/mkrf_conf.rb ADDED
@@ -0,0 +1,43 @@
1
+ # coding: utf-8
2
+
3
+ path = File.expand_path(File.dirname(__FILE__))
4
+
5
+ require '../lib/bio/freebayes/version'
6
+ version = Bio::Freebayes::EXTVERSION
7
+
8
+ File.open(File.join(path,"Rakefile"),"w") do |rakefile|
9
+ rakefile.write <<-RAKE
10
+ require 'rbconfig'
11
+ require 'open-uri'
12
+ require 'fileutils'
13
+ include FileUtils::Verbose
14
+ require 'rake/clean'
15
+ require 'mkmf'
16
+
17
+ task :freebayes do
18
+
19
+ missing = []
20
+ ['git', 'cmake'].each do |exe|
21
+ missing.push(exe) if !find_executable(exe)
22
+ end
23
+
24
+ raise "Missing \#\{missing.join(', ')\}" if !missing.empty?
25
+
26
+ sh "git clone --recursive git://github.com/ekg/freebayes.git"
27
+ mkdir "../lib/bio/freebayes/external"
28
+
29
+ cd "freebayes" do
30
+ sh "git checkout v#{version} && git submodule update --recursive"
31
+ sh "make"
32
+ mv "bin/freebayes", "../../lib/bio/freebayes/external"
33
+ mv "bin/bamleftalign", "../../lib/bio/freebayes/external"
34
+ end
35
+
36
+ rm_rf "freebayes"
37
+
38
+ end
39
+
40
+ task :default => [:freebayes]
41
+ RAKE
42
+
43
+ end
@@ -0,0 +1,64 @@
1
+ require "bio/freebayes/version"
2
+ require 'open3'
3
+
4
+ module Bio
5
+ class Freebayes
6
+
7
+ # instantiate Freebayes command tools
8
+ def initialize(path = nil)
9
+ @filter = nil
10
+ @eval = nil
11
+ @path = path || File.join(File.expand_path(File.dirname(__FILE__)), 'freebayes', 'external', 'freebayes')
12
+ end
13
+
14
+ # run freebayes tools for command and all options please go to
15
+ # https://github.com/ekg/freebayes
16
+ #
17
+ # @param [String] fasta_reference path of the reference fasta file
18
+ # @param [String] bam path of the alignment file in bam format
19
+ # @param [Array] options of freebayes command
20
+ # @return [String] A VCF string
21
+ def run(fasta_reference, bam, *options)
22
+ result = `#{@path} #{options.flatten.join(' ')} --fasta-reference #{fasta_reference} #{bam}`
23
+ if @filter != nil || @eval != nil || @filter != '' || @eval != ''
24
+ Open3.popen2("bio-vcf #{@filter != nil && !@filter.empty? ? "--filter '#{@filter}' " : ''}#{@eval != nil && !@eval.empty? ? "--eval '#{@eval}' " : ''}") {|stdin, stdout, wthr|
25
+ stdin.print result
26
+ stdin.close
27
+ return stdout.gets
28
+ }
29
+ else
30
+ return result
31
+ end
32
+ end
33
+
34
+ # set bio-vcf Filter
35
+ # for details please go to https://github.com/pjotrp/bioruby-vcf
36
+ # the chaning have to end with run
37
+ #
38
+ # @param [String] filter a VCF filter for bio-vcf
39
+ # @return [Freebayes] return freebayes object for chaining
40
+ def vcffilter(filter)
41
+ @filter = filter
42
+ return self
43
+ end
44
+
45
+ # set command for the eval option of bio-vcf
46
+ # more details please go to https://github.com/pjotrp/bioruby-vcf
47
+ # the chaning have to end with run
48
+ #
49
+ # @param [String] eval a VCF filter for bio-vcf
50
+ # @return [Freebayes] return freebayes object for chaining
51
+ def vcfeval(eval)
52
+ @eval = eval
53
+ return self
54
+ end
55
+
56
+ # run help
57
+ # https://github.com/ekg/freebayes
58
+ #
59
+ def help
60
+ `#{@path} -h`
61
+ end
62
+ end
63
+
64
+ end
@@ -0,0 +1,6 @@
1
+ module Bio
2
+ class Freebayes
3
+ VERSION = "0.1.5"
4
+ EXTVERSION = "0.9.20"
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bio-freebayes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.5
5
+ platform: ruby
6
+ authors:
7
+ - Natapol Pornputtapong
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bio-vcf
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.9'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.9'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: 'The API for Freebayes version #{Bio::Freebayes::EXTVERSION}'
56
+ email:
57
+ - natapol.por@gmail.com
58
+ executables: []
59
+ extensions:
60
+ - ext/mkrf_conf.rb
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
+ - CODE_OF_CONDUCT.md
67
+ - Gemfile
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - bio-freebayes.gemspec
73
+ - ext/mkrf_conf.rb
74
+ - lib/bio/freebayes.rb
75
+ - lib/bio/freebayes/version.rb
76
+ homepage: http://rubygems.org/gems/bio-freebayes
77
+ licenses: []
78
+ metadata:
79
+ allowed_push_host: 'TODO: Set to ''http://mygemserver.com'''
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.0.14
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: 'The API for Freebayes version #{Bio::Freebayes::EXTVERSION}'
100
+ test_files: []
101
+ has_rdoc: