lib/cheripic/cmd.rb in cheripic-1.2.5 vs lib/cheripic/cmd.rb in cheripic-1.2.6
- old
+ new
@@ -43,28 +43,30 @@
version Cheripic::VERSION
banner cmds.help_message
opt :assembly, 'Assembly file in FASTA format',
:short => '-f',
:type => String
- opt :input_format, 'bulk and parent alignment file format types - set either pileup or bam',
+ opt :input_format, 'bulk and parent alignment file format types - set either pileup or bam or vcf',
:short => '-F',
:type => String,
:default => 'pileup'
opt :mut_bulk, 'Pileup or sorted BAM file alignments from mutant/trait of interest bulk 1',
:short => '-a',
:type => String
opt :mut_bulk_vcf, 'vcf file for variants from mutant/trait of interest bulk 1',
- :type => String
+ :type => String,
+ :default => ''
opt :bg_bulk, 'Pileup or sorted BAM file alignments from background/wildtype bulk 2',
:short => '-b',
:type => String
opt :bg_bulk_vcf, 'vcf file for variants from background/wildtype bulk 2',
- :type => String
+ :type => String,
+ :default => ''
opt :output, 'custom name tag to include in the output file name',
:default => 'cheripic_results'
opt :loglevel, 'Choose any one of "info / warn / debug" level for logs generated',
- :default => 'debug'
+ :default => 'info'
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,
@@ -77,23 +79,23 @@
: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",
:type => Integer,
:default => 5
- opt :maxdepth, "maximum read depth at a position to consider for variant calls
-if set to zero no user max depth will be used",
+ opt :maxdepth, 'maximum read depth at a position to consider for variant calls
+if set to zero no user max depth will be used',
:type => Integer,
:default => 0
opt :min_non_ref_count, 'minimum read depth supporting non reference base at each position',
:type => Integer,
:default => 3
opt :min_indel_count_support, 'minimum read depth supporting an indel at each position',
:type => Integer,
:default => 3
opt :ambiguous_ref_bases, 'including variant at completely ambiguous bases in the reference',
- :type => FalseClass,
- :default => false
+ :type => String,
+ :default => 'false'
opt :mapping_quality, 'minimum mapping quality of read covering the position',
:short => '-q',
:type => Integer,
:default => 20
opt :base_quality, 'minimum base quality of bases covering the position',
@@ -105,19 +107,19 @@
:default => 0.1
opt :cross_type, 'type of cross used to generated mapping population - back or out',
:type => String,
:default => 'back'
opt :use_all_contigs, 'option to select all contigs or only contigs containing variants for analysis',
- :type => FalseClass,
- :default => false
+ :type => String,
+ :default => 'false'
opt :include_low_hmes, 'option to include or discard variants from contigs with
low hme-score or bfr score to list in the final output',
- :type => FalseClass,
- :default => false
+ :type => String,
+ :default => 'false'
opt :polyploidy, 'Set if the data input is from polyploids',
- :type => FalseClass,
- :default => false
+ :type => String,
+ :default => 'false'
opt :mut_parent, 'Pileup or sorted BAM file alignments from mutant/trait of interest parent',
:short => '-p',
:type => String,
:default => ''
opt :bg_parent, 'Pileup or sorted BAM file alignments from background/wildtype parent',
@@ -185,12 +187,36 @@
exit(0)
end
# calls other methods to check if command line inputs are valid
def check_arguments
+ convert_boolean_strings
check_output
check_log_level
+ check_input_entry
check_input_types
+ end
+
+ # convert true or false options to boolean
+ def convert_boolean_strings
+ %i{ambiguous_ref_bases use_all_contigs include_low_hmes polyploidy}.each do | symbol |
+ if @options.key?(symbol)
+ @options[symbol] = @options[symbol] == 'false' ? false : true
+ end
+ end
+ end
+
+ # set file given option to false if input is nil or None or ''
+ def check_input_entry
+ %i{assembly mut_bulk bg_bulk mut_bulk_vcf bg_bulk_vcf mut_parent bg_parent repeats_file}.each do | symbol |
+ if @options.key?(symbol)
+ if @options[symbol] == 'None'
+ param = (symbol.to_s + '_given').to_sym
+ @options[symbol] = ''
+ @options.delete(param)
+ end
+ end
+ end
end
# checks input files based on bulk file type
def check_input_types
inputfiles = {}