cagnut_samtools 0.3.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.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +35 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/cagnut_samtools.gemspec +27 -0
- data/lib/cagnut_samtools/base.rb +23 -0
- data/lib/cagnut_samtools/check_tools.rb +36 -0
- data/lib/cagnut_samtools/configuration.rb +29 -0
- data/lib/cagnut_samtools/functions/do_flag_stat.rb +54 -0
- data/lib/cagnut_samtools/functions/merge_bam.rb +61 -0
- data/lib/cagnut_samtools/functions/mg_bam_soft_link.rb +69 -0
- data/lib/cagnut_samtools/functions/templates/merge_bam.sh +50 -0
- data/lib/cagnut_samtools/util.rb +25 -0
- data/lib/cagnut_samtools/version.rb +3 -0
- data/lib/cagnut_samtools.rb +16 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 14683e9ff5605abf37813b83fd8d7626c9a7a5d8
|
4
|
+
data.tar.gz: 4d7cd2823ba7aeed8ff44883a197781175ee9967
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 05dea5b194118fdb2256f623ed0b6ebb137c81ffff948745f8c18e760076a27f4698df18529c4a4d0b4d33b3d00347d77ee593b12f7c39f09bc5c104b630701d
|
7
|
+
data.tar.gz: e3d63bbb560db6bd203f2a7bae0ae9331417b3095a1374945a2bf26811be0f3a609094880ad25a8d9e641d752a3b953c930946781e932a0dbe23f61b3c11124a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.3.1
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Goldenio Technology
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# CagnutSamtools
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'cagnut_samtools'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install cagnut_samtools
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
24
|
+
|
25
|
+
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`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cagnut_samtools.
|
30
|
+
|
31
|
+
|
32
|
+
## License
|
33
|
+
|
34
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
35
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "cagnut_samtools"
|
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,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cagnut_samtools/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cagnut_samtools"
|
8
|
+
spec.version = CagnutSamtools::VERSION
|
9
|
+
spec.authors = ['Shi-Gang Wang', 'Tse-Ching Ho']
|
10
|
+
spec.email = ['seanwang@goldenio.com', 'tsechingho@goldenio.com']
|
11
|
+
|
12
|
+
spec.summary = %q{Cagnut Samtools tools}
|
13
|
+
spec.description = %q{Cagnut Samtools tools}
|
14
|
+
spec.homepage = "https://github.com/CAGNUT/cagnut_samtools"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency 'cagnut_core'
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'cagnut_samtools/functions/merge_bam'
|
2
|
+
require 'cagnut_samtools/functions/mg_bam_soft_link'
|
3
|
+
require 'cagnut_samtools/functions/do_flag_stat'
|
4
|
+
|
5
|
+
module CagnutSamtools
|
6
|
+
class Base
|
7
|
+
|
8
|
+
def merge_bam dirs, order, previous_job_id, input = nil
|
9
|
+
opts = { input: input, dirs: dirs, order: order }
|
10
|
+
CagnutSamtools::MergeBam.new(opts).run previous_job_id
|
11
|
+
end
|
12
|
+
|
13
|
+
def mg_bam_soft_link dirs, order, previous_job_id, input = nil
|
14
|
+
opts = { input: input, dirs: dirs, order: order }
|
15
|
+
CagnutSamtools::MgBamSoftLink.new(opts).run previous_job_id
|
16
|
+
end
|
17
|
+
|
18
|
+
def do_flag_stat dirs, order, previous_job_id, input = nil
|
19
|
+
opts = { input: input, dirs: dirs, order: order }
|
20
|
+
CagnutSamtools::DoFlagStat.new(opts).run previous_job_id
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module CagnutSamtools
|
2
|
+
module CheckTools
|
3
|
+
def check_tool tools_path, refs
|
4
|
+
super if defined?(super)
|
5
|
+
check_samtools tools_path['samtools']
|
6
|
+
check_samtools_index refs['ref_fasta']
|
7
|
+
end
|
8
|
+
|
9
|
+
def check_samtools path
|
10
|
+
check_tool_ver 'Samtools' do
|
11
|
+
`#{path} --version 2>&1| grep samtools | cut -f2 -d ' '` if path
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def check_samtools_index ref_path
|
16
|
+
puts 'Checking Samtools Reference Index Files...'
|
17
|
+
tool = 'Samtools Index'
|
18
|
+
file = "#{ref_path}.fai"
|
19
|
+
command = "#{@config['tools']['samtools']} faidx #{ref_path}"
|
20
|
+
check_ref_related file, tool, command
|
21
|
+
end
|
22
|
+
|
23
|
+
def check_ref_related file, tool, command
|
24
|
+
if File.exist?(file)
|
25
|
+
puts "\t#{tool}: Done"
|
26
|
+
else
|
27
|
+
puts "\t#{tool}: Not Found!"
|
28
|
+
puts "\tPlease execute command:"
|
29
|
+
puts "\t\t#{command}"
|
30
|
+
@check_completed = false
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
Cagnut::Configuration::Checks::Tools.prepend CagnutSamtools::CheckTools
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
module CagnutSamtools
|
4
|
+
class Configuration
|
5
|
+
|
6
|
+
include Singleton
|
7
|
+
attr_accessor :samtools_path
|
8
|
+
attr_reader :config
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def load config, params
|
12
|
+
instance.load config, params
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def load config, params = nil
|
17
|
+
@config = config
|
18
|
+
attributes.each do |name, value|
|
19
|
+
send "#{name}=", value if respond_to? "#{name}="
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def attributes
|
24
|
+
{
|
25
|
+
samtools_path: @config['tools']['samtools']
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module CagnutSamtools
|
2
|
+
class DoFlagStat
|
3
|
+
extend Forwardable
|
4
|
+
|
5
|
+
def_delegators :'Cagnut::Configuration.base', :jobs_dir, :sample_name,
|
6
|
+
:ref_fasta, :prefix_name, :dodebug
|
7
|
+
def_delegators :'CagnutSamtools.config', :samtools_path
|
8
|
+
|
9
|
+
def initialize opts = {}
|
10
|
+
@order = sprintf '%02i', opts[:order]
|
11
|
+
@job_name = "#{prefix_name}_doFlagStat_#{sample_name}"
|
12
|
+
@input = opts[:input].nil? ? "#{opts[:dirs][:input]}/#{sample_name}_markdup.bam" : opts[:input]
|
13
|
+
@output = "#{opts[:dirs][:output]}/#{sample_name}_merged_markdup.flagstat"
|
14
|
+
end
|
15
|
+
|
16
|
+
def run previous_job_id = nil
|
17
|
+
puts "Submitting doFlagStat for #{sample_name}_markdup suffix"
|
18
|
+
script_name = generate_script
|
19
|
+
::Cagnut::JobManage.submit script_name, @job_name, queuing_options(previous_job_id)
|
20
|
+
@job_name
|
21
|
+
end
|
22
|
+
|
23
|
+
def queuing_options previous_job_id = nil
|
24
|
+
{
|
25
|
+
previous_job_id: previous_job_id,
|
26
|
+
adjust_memory: ['h_vmem=500M'],
|
27
|
+
tools: ['samtools', 'do_flag_stat']
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def generate_script
|
32
|
+
script_name = "#{@order}_samtools_do_flag_stat"
|
33
|
+
file = File.join jobs_dir, "#{script_name}.sh"
|
34
|
+
File.open(file, 'w') do |f|
|
35
|
+
f.puts <<-BASH.strip_heredoc
|
36
|
+
#!/bin/bash
|
37
|
+
echo "#{script_name} is starting at $(date +%Y%m%d%H%M%S)" >> "#{jobs_dir}/finished_jobs"
|
38
|
+
#{samtools_path} flagstat #{@input} > #{@output} \\
|
39
|
+
#{::Cagnut::JobManage.run_local}
|
40
|
+
|
41
|
+
if [ ! -s #{@output} ]
|
42
|
+
then
|
43
|
+
echo "Incomplete output file #{@output}"
|
44
|
+
exit 100
|
45
|
+
fi
|
46
|
+
echo "#{script_name} is finished at $(date +%Y%m%d%H%M%S)" >> "#{jobs_dir}/finished_jobs"
|
47
|
+
|
48
|
+
BASH
|
49
|
+
end
|
50
|
+
File.chmod(0700, file)
|
51
|
+
script_name
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module CagnutSamtools
|
2
|
+
class MergeBam
|
3
|
+
extend Forwardable
|
4
|
+
|
5
|
+
def_delegators :'Cagnut::Configuration.base', :jobs_dir, :prefix_name,
|
6
|
+
:magic28, :ref_fasta, :sample_name, :dodebug
|
7
|
+
def_delegators :'CagnutSamtools.config', :samtools_path
|
8
|
+
|
9
|
+
def initialize opts = {}
|
10
|
+
@order = sprintf '%02i', opts[:order]
|
11
|
+
@sam_dir = opts[:dirs][:input]
|
12
|
+
@bam_dir = opts[:dirs][:output]
|
13
|
+
@job_name = "#{prefix_name}_mgBam_#{sample_name}"
|
14
|
+
@input = opts[:input].nil? ? "#{@bam_dir}/*.bam" : opts[:input]
|
15
|
+
@output = "#{@bam_dir}/#{sample_name}_merged.bam"
|
16
|
+
@output_bai = "#{@bam_dir}/#{sample_name}_merged.bai"
|
17
|
+
end
|
18
|
+
|
19
|
+
def run previous_job_id = nil
|
20
|
+
puts "Submitting samtoolsMergeBam #{sample_name}"
|
21
|
+
script_name = generate_script
|
22
|
+
::Cagnut::JobManage.submit script_name, @job_name, queuing_options(previous_job_id)
|
23
|
+
[@job_name, @output]
|
24
|
+
end
|
25
|
+
|
26
|
+
def queuing_options previous_job_id = nil
|
27
|
+
{
|
28
|
+
previous_job_id: previous_job_id,
|
29
|
+
adjust_memory: ['h_vmem=1G'],
|
30
|
+
tools: ['samtools', 'merge_bam']
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def generate_script
|
35
|
+
script_name = "#{@order}_samtools_merge_bam"
|
36
|
+
file = File.join jobs_dir, "#{script_name}.sh"
|
37
|
+
path = File.expand_path '../templates/merge_bam.sh', __FILE__
|
38
|
+
template = Tilt.new path
|
39
|
+
File.open(file, 'w') do |f|
|
40
|
+
f.puts template.render Object.new, job_params(script_name)
|
41
|
+
end
|
42
|
+
File.chmod(0700, file)
|
43
|
+
script_name
|
44
|
+
end
|
45
|
+
|
46
|
+
def job_params script_name
|
47
|
+
{
|
48
|
+
bam_dir: @bam_dir,
|
49
|
+
samtools_path: samtools_path,
|
50
|
+
magic28: magic28,
|
51
|
+
jobs_dir: jobs_dir,
|
52
|
+
input: @input,
|
53
|
+
output: @output,
|
54
|
+
output_bai: @output_bai,
|
55
|
+
sam_dir: @sam_dir,
|
56
|
+
script_name: script_name,
|
57
|
+
run_local: ::Cagnut::JobManage.run_local
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module CagnutSamtools
|
2
|
+
class MgBamSoftLink
|
3
|
+
extend Forwardable
|
4
|
+
|
5
|
+
def_delegators :'Cagnut::Configuration.base', :jobs_dir, :prefix_name, :dodebug,
|
6
|
+
:magic28, :ref_fasta, :sample_name
|
7
|
+
def_delegators :'CagnutSamtools.config', :samtools_path
|
8
|
+
|
9
|
+
def initialize opts = {}
|
10
|
+
@order = sprintf '%02i', opts[:order]
|
11
|
+
@job_name = "#{prefix_name}_mgBam_#{sample_name}"
|
12
|
+
@input = opts[:input].nil? ? "#{opts[:dirs][:input]}/#{sample_name}_rg.bam" : opts[:input]
|
13
|
+
@output = "#{opts[:dirs][:output]}/#{sample_name}_merged.bam"
|
14
|
+
@output_bai = "#{opts[:dirs][:output]}/#{sample_name}_merged.bai"
|
15
|
+
end
|
16
|
+
|
17
|
+
def run previous_job_id = nil
|
18
|
+
puts "Submitting mgBamSoftLink #{@input}"
|
19
|
+
script_name = generate_script
|
20
|
+
::Cagnut::JobManage.submit script_name, @job_name, queuing_options(previous_job_id)
|
21
|
+
[@job_name, @output]
|
22
|
+
end
|
23
|
+
|
24
|
+
def queuing_options previous_job_id = nil
|
25
|
+
{
|
26
|
+
previous_job_id: previous_job_id,
|
27
|
+
tools: ['samtools', 'mg_bam_soft_link']
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def generate_script
|
32
|
+
script_name = "#{@order}_samtools_mg_bam_soft_link"
|
33
|
+
file = File.join jobs_dir, "#{script_name}.sh"
|
34
|
+
File.open(file, 'w') do |f|
|
35
|
+
f.puts <<-BASH.strip_heredoc
|
36
|
+
#!/bin/bash
|
37
|
+
|
38
|
+
cd "#{jobs_dir}/../"
|
39
|
+
echo "#{script_name} is starting at $(date +%Y%m%d%H%M%S)" >> "#{jobs_dir}/finished_jobs"
|
40
|
+
rm -f #{@output} #{@output_bai}
|
41
|
+
ln -s #{@input} #{@output}
|
42
|
+
|
43
|
+
# Check BAM EOF
|
44
|
+
BAM_28=$(tail -c 28 #{@output}|xxd -p)
|
45
|
+
if [ "#{magic28}" != "$BAM_28" ]
|
46
|
+
then
|
47
|
+
echo "Error with BAM EOF" 1>&2
|
48
|
+
exit 100
|
49
|
+
fi
|
50
|
+
|
51
|
+
#{samtools_path} index #{@output} \\
|
52
|
+
#{::Cagnut::JobManage.run_local}
|
53
|
+
mv #{output}.bai #{@output_bai}
|
54
|
+
|
55
|
+
if [ ! -s "#{@output_bai}" ]
|
56
|
+
then
|
57
|
+
echo "Incorrect Output!"
|
58
|
+
exit 100
|
59
|
+
fi
|
60
|
+
echo "#{script_name} is finished at $(date +%Y%m%d%H%M%S)" >> "#{jobs_dir}/finished_jobs"
|
61
|
+
|
62
|
+
exit $EXITSTATUS
|
63
|
+
BASH
|
64
|
+
end
|
65
|
+
File.chmod(0700, file)
|
66
|
+
script_name
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
cd "#{jobs_dir}/../"
|
4
|
+
echo "#{script_name} is starting at $(date +%Y%m%d%H%M%S)" >> "#{jobs_dir}/finished_jobs"
|
5
|
+
rm -f #{output} #{output_bai}
|
6
|
+
CORE_LIST=$(ls core.*)
|
7
|
+
if [ -n "$CORE_LIST" ]
|
8
|
+
then
|
9
|
+
echo "Found core dumps from bwa. Exiting with error."
|
10
|
+
exit 100
|
11
|
+
fi
|
12
|
+
|
13
|
+
arr=$(ls #{input})
|
14
|
+
if [ ${#arr[@]} -eq 0 ]
|
15
|
+
then
|
16
|
+
echo "Error: No BAM files found in BAM_DIR(#{bam_dir})"
|
17
|
+
exit 100
|
18
|
+
elif [ ${#arr[@]} -eq 1 ]
|
19
|
+
then
|
20
|
+
# bam1=$(ls #{bam_dir}/*.bam | head -1)
|
21
|
+
cp ${arr[0]} #{output} #{run_local}
|
22
|
+
else
|
23
|
+
# create sam header for merged bam
|
24
|
+
# bam1=$(ls #{bam_dir}/*.bam | head -1)
|
25
|
+
#{samtools_path} view -H ${arr[0]} | grep -v RG > #{sam_dir}/header.sam #{run_local}
|
26
|
+
for i in `ls #{bam_dir}/*.bam`;do #{samtools_path} view -H $i | grep RG;done | sort | uniq >> #{sam_dir}/header.sam #{run_local}
|
27
|
+
#{samtools_path} merge -h #{sam_dir}/header.sam #{output} #{bam_dir}/*.bam #{run_local}
|
28
|
+
fi
|
29
|
+
|
30
|
+
EXITSTATUS=$?
|
31
|
+
|
32
|
+
if [ ! -s "#{output}" ]
|
33
|
+
then
|
34
|
+
echo "Incorrect Output!"
|
35
|
+
exit 100
|
36
|
+
fi
|
37
|
+
|
38
|
+
# Check BAM EOF
|
39
|
+
BAM_28=$(tail -c 28 #{output}|xxd -p)
|
40
|
+
if [ "#{magic28}" != "$BAM_28" ]
|
41
|
+
then
|
42
|
+
echo "Error with BAM EOF" 1>&2
|
43
|
+
exit 100
|
44
|
+
fi
|
45
|
+
|
46
|
+
#{samtools_path} index #{output} #{run_local}
|
47
|
+
mv #{bam_dir}/#{output}.bai #{output_bai}
|
48
|
+
echo "#{script_name} is finished at $(date +%Y%m%d%H%M%S)" >> "#{jobs_dir}/finished_jobs"
|
49
|
+
|
50
|
+
exit $EXITSTATUS
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module CagnutSamtools
|
2
|
+
class Util
|
3
|
+
attr_accessor :samtools, :config
|
4
|
+
|
5
|
+
def initialize config=nil
|
6
|
+
@config = config
|
7
|
+
@samtools = CagnutSamtools::Base.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def merge_bam dirs, order=1, previous_job_id=nil, filename = nil
|
11
|
+
job_name, filename = samtools.merge_bam dirs, order, previous_job_id, filename
|
12
|
+
[job_name, filename, order+1]
|
13
|
+
end
|
14
|
+
|
15
|
+
def mg_bam_soft_link dirs, order=1, previous_job_id=nil, filename = nil
|
16
|
+
job_name, filename = samtools.mg_bam_soft_link dirs, order, previous_job_id, filename
|
17
|
+
[job_name, filename, order+1]
|
18
|
+
end
|
19
|
+
|
20
|
+
def do_flag_stat dirs, order=1, previous_job_id=nil, filename = nil
|
21
|
+
samtools.do_flag_stat dirs, order, previous_job_id, filename
|
22
|
+
order+1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "cagnut_samtools/version"
|
2
|
+
|
3
|
+
module CagnutSamtools
|
4
|
+
class << self
|
5
|
+
def config
|
6
|
+
@config ||= begin
|
7
|
+
CagnutSamtools::Configuration.load(Cagnut::Configuration.config, Cagnut::Configuration.params['samtools'])
|
8
|
+
CagnutSamtools::Configuration.instance
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'cagnut_samtools/configuration'
|
15
|
+
require 'cagnut_samtools/base'
|
16
|
+
require 'cagnut_samtools/util'
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cagnut_samtools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shi-Gang Wang
|
8
|
+
- Tse-Ching Ho
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: cagnut_core
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.12'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.12'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '10.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '10.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.0'
|
70
|
+
description: Cagnut Samtools tools
|
71
|
+
email:
|
72
|
+
- seanwang@goldenio.com
|
73
|
+
- tsechingho@goldenio.com
|
74
|
+
executables: []
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- ".rspec"
|
80
|
+
- ".ruby-version"
|
81
|
+
- ".travis.yml"
|
82
|
+
- Gemfile
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- bin/console
|
87
|
+
- bin/setup
|
88
|
+
- cagnut_samtools.gemspec
|
89
|
+
- lib/cagnut_samtools.rb
|
90
|
+
- lib/cagnut_samtools/base.rb
|
91
|
+
- lib/cagnut_samtools/check_tools.rb
|
92
|
+
- lib/cagnut_samtools/configuration.rb
|
93
|
+
- lib/cagnut_samtools/functions/do_flag_stat.rb
|
94
|
+
- lib/cagnut_samtools/functions/merge_bam.rb
|
95
|
+
- lib/cagnut_samtools/functions/mg_bam_soft_link.rb
|
96
|
+
- lib/cagnut_samtools/functions/templates/merge_bam.sh
|
97
|
+
- lib/cagnut_samtools/util.rb
|
98
|
+
- lib/cagnut_samtools/version.rb
|
99
|
+
homepage: https://github.com/CAGNUT/cagnut_samtools
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata: {}
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 2.5.1
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: Cagnut Samtools tools
|
123
|
+
test_files: []
|