lib/cheripic/cmd.rb in cheripic-1.2.6 vs lib/cheripic/cmd.rb in cheripic-1.2.7
- old
+ new
@@ -68,14 +68,14 @@
opt :hmes_adjust, 'factor added to snp count of each contig to adjust for hme score calculations',
:type => Float,
:default => 0.5
opt :htlow, 'lower level for categorizing heterozygosity',
:type => Float,
- :default => 0.2
+ :default => 0.25
opt :hthigh, 'high level for categorizing heterozygosity',
:type => Float,
- :default => 0.9
+ :default => 0.75
opt :mindepth, 'minimum read depth at a position to consider for variant calls',
:type => Integer,
:default => 6
opt :max_d_multiple, "multiplication factor for average coverage to calculate maximum read coverage
if set zero no calculation will be made from bam file.\nsetting this value will override user set max depth",
@@ -233,31 +233,45 @@
check_input_files(inputfiles)
end
# checks if input files are valid
def check_input_files(inputfiles)
- check = 0
inputfiles.each_key do | type |
inputfiles[type].flatten!
+ check = 0
inputfiles[type].each do | symbol |
- if @options[symbol]
+ if @options[symbol] == nil or @options[symbol] == ''
+ if type == :required
+ raise CheripicArgError.new "Options #{inputfiles}, all must be specified. Try --help for further help."
+ end
+ else
file = @options[symbol]
- @options[symbol] = File.expand_path(file)
- next if type == :optional
- if type == :required and not File.exist?(file)
- raise CheripicIOError.new "#{symbol} file, #{file} does not exist: "
- elsif type == :either and File.exist?(file)
- check = 1
+ if symbol == :bg_bulk or symbol == :bg_bulk_vcf
+ if file.include? ','
+ @options[symbol] = []
+ file.split(',').each do | infile |
+ @options[symbol] << File.expand_path(infile)
+ file_exist?(symbol, infile)
+ end
+ end
+ else
+ @options[symbol] = File.expand_path(file)
+ file_exist?(symbol, file)
end
- elsif type == :required
- raise CheripicArgError.new "Options #{inputfiles}, all must be specified. " +
- 'Try --help for further help.'
+ check = 1
end
end
if type == :either and check == 0
raise CheripicArgError.new "One of the options #{inputfiles}, must be specified. " +
'Try --help for further help.'
end
+ end
+ end
+
+ def file_exist?(symbol, file)
+ # checks if a given file exists
+ unless File.exist?(file)
+ raise CheripicIOError.new "#{symbol} file, #{file} does not exist!"
end
end
# checks if files with output tag name already exists
def check_output