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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4b848b1b52f01215fabf404f7387e6f621a2285b
4
- data.tar.gz: e434cbad53ac982974c30cf2a940668862a6d2bd
2
+ SHA256:
3
+ metadata.gz: f24f55bc589e3b5d791c6c19fe7c221df301ba0bc6fbf9026c942a694a2e6941
4
+ data.tar.gz: f5c70c5e67b23d36267380f39e8c217d8c2635c825234dc23ba423e657f78d4f
5
5
  SHA512:
6
- metadata.gz: ef7eb0c0008b8d8ed45d6e1deeeb4c59ef187a8af3a92fbc91dba33d91af03b475c337c2e69dcdcb8c34c3cfeea3f9f5d54e42fadba8d0270e0a776c96609c79
7
- data.tar.gz: beb3fccf28f54a30fc355a93261043d27dfd4d2ebb34043245404608d1608d2185aae57b8263192ca5973caf1a99c9b9b1614187e5d253656efc9ec9fab9aa50
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"
@@ -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', '~> 1.7.6'
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'
@@ -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.2
73
+ :default => 0.25
74
74
  opt :hthigh, 'high level for categorizing heterozygosity',
75
75
  :type => Float,
76
- :default => 0.9
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
- @options[symbol] = File.expand_path(file)
245
- next if type == :optional
246
- if type == :required and not File.exist?(file)
247
- raise CheripicIOError.new "#{symbol} file, #{file} does not exist: "
248
- elsif type == :either and File.exist?(file)
249
- check = 1
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
- elsif type == :required
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?
@@ -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 "Score\tAlleleFreq\tlength\tseq_id\tposition\tref_base\tcoverage\tbases\tbase_quals\tsequence_left\tAlt_seq\tsequence_right"
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]
@@ -9,8 +9,8 @@ module Cheripic
9
9
  # Default parameter settings
10
10
  @def_settings = {
11
11
  :hmes_adjust => 0.5,
12
- :htlow => 0.2,
13
- :hthigh => 0.9,
12
+ :htlow => 0.25,
13
+ :hthigh => 0.75,
14
14
  :mindepth => 6,
15
15
  :maxdepth => 0,
16
16
  :max_d_multiple => 5,
@@ -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
- logger.info "processing #{input} file"
82
- if @params.input_format == 'pileup'
83
- extract_pileup(infile, input)
84
- elsif @params.input_format == 'vcf'
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
- extract_bam_pileup(infile, input)
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
@@ -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
- var_pos_bg = get_vars(bgbulk_vcf)
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
@@ -2,6 +2,6 @@ module Cheripic
2
2
 
3
3
  # Sets the semantic version number for this module.
4
4
  # Version number will be used in help messages and for generating gem.
5
- VERSION = '1.2.6'
5
+ VERSION = '1.2.7'
6
6
 
7
7
  end
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.6
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: 2016-10-26 00:00:00.000000000 Z
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.4.3
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