cheripic 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +1 -0
- data/cheripic.gemspec +1 -1
- data/lib/cheripic/cmd.rb +27 -13
- data/lib/cheripic/implementer.rb +1 -1
- data/lib/cheripic/options.rb +2 -2
- data/lib/cheripic/variants.rb +16 -7
- data/lib/cheripic/vcf.rb +12 -1
- data/lib/cheripic/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f24f55bc589e3b5d791c6c19fe7c221df301ba0bc6fbf9026c942a694a2e6941
|
4
|
+
data.tar.gz: f5c70c5e67b23d36267380f39e8c217d8c2635c825234dc23ba423e657f78d4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: debd30f6e790b0ba0c4defadd6cd507ea982253e574817afd8af1e83cdcff24e70756a7f548bc37d40c62bf6e1ff25d622c121a55614900e84f9c61a2d8eba69
|
7
|
+
data.tar.gz: 503fb4e4b5a7ce63cac2ea2a739fb622573ef9c20bb9acb1868ab202901f5cde9594ba998b06ff84ec4d06c46954c1e567c636f3f18893a9b4a49a6b605f27a0
|
data/Rakefile
CHANGED
@@ -64,6 +64,7 @@ def create_package(target)
|
|
64
64
|
sh "mkdir -p #{package_dir}/lib/app/bin"
|
65
65
|
sh "cp bin/cheripic #{package_dir}/lib/app/bin/"
|
66
66
|
sh "cp -R lib #{package_dir}/lib/app/"
|
67
|
+
sh "unzip test/data/test_data.zip -d #{package_dir}/"
|
67
68
|
sh "mkdir #{package_dir}/lib/app/ruby"
|
68
69
|
sh "tar -xzf packaging/traveling-ruby-#{TRAVELING_RUBY_VERSION}-#{target}.tar.gz -C #{package_dir}/lib/app/ruby"
|
69
70
|
sh "cp packaging/wrapper.sh #{package_dir}/cheripic"
|
data/cheripic.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency 'bio-samtools', '~> 2.4.0'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'activesupport', '~> 4.2.6'
|
28
|
-
spec.add_development_dependency 'bundler', '
|
28
|
+
spec.add_development_dependency 'bundler', '>= 1.7.6'
|
29
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
30
30
|
spec.add_development_dependency 'minitest'
|
31
31
|
spec.add_development_dependency 'minitest-reporters', '>= 1.0.17'
|
data/lib/cheripic/cmd.rb
CHANGED
@@ -70,10 +70,10 @@ module Cheripic
|
|
70
70
|
:default => 0.5
|
71
71
|
opt :htlow, 'lower level for categorizing heterozygosity',
|
72
72
|
:type => Float,
|
73
|
-
:default => 0.
|
73
|
+
:default => 0.25
|
74
74
|
opt :hthigh, 'high level for categorizing heterozygosity',
|
75
75
|
:type => Float,
|
76
|
-
:default => 0.
|
76
|
+
:default => 0.75
|
77
77
|
opt :mindepth, 'minimum read depth at a position to consider for variant calls',
|
78
78
|
:type => Integer,
|
79
79
|
:default => 6
|
@@ -235,22 +235,29 @@ low hme-score or bfr score to list in the final output',
|
|
235
235
|
|
236
236
|
# checks if input files are valid
|
237
237
|
def check_input_files(inputfiles)
|
238
|
-
check = 0
|
239
238
|
inputfiles.each_key do | type |
|
240
239
|
inputfiles[type].flatten!
|
240
|
+
check = 0
|
241
241
|
inputfiles[type].each do | symbol |
|
242
|
-
if @options[symbol]
|
242
|
+
if @options[symbol] == nil or @options[symbol] == ''
|
243
|
+
if type == :required
|
244
|
+
raise CheripicArgError.new "Options #{inputfiles}, all must be specified. Try --help for further help."
|
245
|
+
end
|
246
|
+
else
|
243
247
|
file = @options[symbol]
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
248
|
+
if symbol == :bg_bulk or symbol == :bg_bulk_vcf
|
249
|
+
if file.include? ','
|
250
|
+
@options[symbol] = []
|
251
|
+
file.split(',').each do | infile |
|
252
|
+
@options[symbol] << File.expand_path(infile)
|
253
|
+
file_exist?(symbol, infile)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
else
|
257
|
+
@options[symbol] = File.expand_path(file)
|
258
|
+
file_exist?(symbol, file)
|
250
259
|
end
|
251
|
-
|
252
|
-
raise CheripicArgError.new "Options #{inputfiles}, all must be specified. " +
|
253
|
-
'Try --help for further help.'
|
260
|
+
check = 1
|
254
261
|
end
|
255
262
|
end
|
256
263
|
if type == :either and check == 0
|
@@ -260,6 +267,13 @@ low hme-score or bfr score to list in the final output',
|
|
260
267
|
end
|
261
268
|
end
|
262
269
|
|
270
|
+
def file_exist?(symbol, file)
|
271
|
+
# checks if a given file exists
|
272
|
+
unless File.exist?(file)
|
273
|
+
raise CheripicIOError.new "#{symbol} file, #{file} does not exist!"
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
263
277
|
# checks if files with output tag name already exists
|
264
278
|
def check_output
|
265
279
|
if (@options[:output].split('') & %w{# / : * ? ' < > | & $ ,}).any?
|
data/lib/cheripic/implementer.rb
CHANGED
@@ -75,7 +75,7 @@ module Cheripic
|
|
75
75
|
end
|
76
76
|
# print selected variants that could be potential markers or mutation
|
77
77
|
out_file = File.open(@options[pos_type], 'w')
|
78
|
-
out_file.puts "
|
78
|
+
out_file.puts "HMES\tAlleleFreq\tlength\tseq_id\tposition\tref_base\tcoverage\tbases\tbase_quals\tsequence_left\tAlt_seq\tsequence_right"
|
79
79
|
regions = Regions.new(@options.assembly)
|
80
80
|
@variants.send(pos_type).each_key do | frag |
|
81
81
|
contig_obj = @variants.assembly[frag]
|
data/lib/cheripic/options.rb
CHANGED
data/lib/cheripic/variants.rb
CHANGED
@@ -78,20 +78,29 @@ module Cheripic
|
|
78
78
|
%i{mut_bulk bg_bulk mut_parent bg_parent}.each do | input |
|
79
79
|
infile = @params[input]
|
80
80
|
if infile != ''
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
extract_vcfs(infile, input)
|
81
|
+
if infile.kind_of?(Array) and input == :bg_bulk
|
82
|
+
infile.each do | file |
|
83
|
+
send_file_to_extract(file, input)
|
84
|
+
end
|
86
85
|
else
|
87
|
-
|
86
|
+
send_file_to_extract(infile, input)
|
88
87
|
end
|
89
88
|
end
|
90
89
|
end
|
91
|
-
|
92
90
|
@pileups_analyzed = true
|
93
91
|
end
|
94
92
|
|
93
|
+
def send_file_to_extract(infile, input)
|
94
|
+
logger.info "processing #{input} file"
|
95
|
+
if @params.input_format == 'pileup'
|
96
|
+
extract_pileup(infile, input)
|
97
|
+
elsif @params.input_format == 'vcf'
|
98
|
+
extract_vcfs(infile, input)
|
99
|
+
else
|
100
|
+
extract_bam_pileup(infile, input)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
95
104
|
# Input vcf file is read and positions are selected that pass the thresholds
|
96
105
|
# @param vcffile [String] path to the pileup file to read
|
97
106
|
# @param sym [Symbol] Symbol of the pileup file used to write selected variants
|
data/lib/cheripic/vcf.rb
CHANGED
@@ -68,8 +68,19 @@ module Cheripic
|
|
68
68
|
def self.filtering(mutant_vcf, bgbulk_vcf)
|
69
69
|
var_pos_mut = get_vars(mutant_vcf)
|
70
70
|
return var_pos_mut if bgbulk_vcf == ''
|
71
|
-
|
71
|
+
if bgbulk_vcf.kind_of?(Array)
|
72
|
+
bgbulk_vcf.each do | file |
|
73
|
+
var_pos_bg = get_vars(file)
|
74
|
+
var_pos_mut = subtract(var_pos_mut,var_pos_bg)
|
75
|
+
end
|
76
|
+
else
|
77
|
+
var_pos_bg = get_vars(bgbulk_vcf)
|
78
|
+
return subtract(var_pos_mut,var_pos_bg)
|
79
|
+
end
|
80
|
+
var_pos_mut
|
81
|
+
end
|
72
82
|
|
83
|
+
def self.subtract(var_pos_mut, var_pos_bg)
|
73
84
|
# if both bulks have homozygous mutations at same positions then deleting them
|
74
85
|
var_pos_mut.each_key do | frag |
|
75
86
|
positions = var_pos_mut[frag][:hom].keys
|
data/lib/cheripic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cheripic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shyam Rallapalli
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yell
|
@@ -102,14 +102,14 @@ dependencies:
|
|
102
102
|
name: bundler
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
104
104
|
requirements:
|
105
|
-
- - "
|
105
|
+
- - ">="
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: 1.7.6
|
108
108
|
type: :development
|
109
109
|
prerelease: false
|
110
110
|
version_requirements: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
|
-
- - "
|
112
|
+
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: 1.7.6
|
115
115
|
- !ruby/object:Gem::Dependency
|
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
267
|
version: '0'
|
268
268
|
requirements: []
|
269
269
|
rubyforge_project:
|
270
|
-
rubygems_version: 2.
|
270
|
+
rubygems_version: 2.7.6
|
271
271
|
signing_key:
|
272
272
|
specification_version: 4
|
273
273
|
summary: picks causative mutation from bulks segregant sequencing
|