Class: MiGA::Cli::Action::New
- Inherits:
-
MiGA::Cli::Action
- Object
- MiGA
- MiGA::Cli::Action
- MiGA::Cli::Action::New
- Defined in:
- lib/miga/cli/action/new.rb
Constant Summary
Constants included from MiGA
MiGA::CITATION, VERSION, VERSION_DATE, VERSION_NAME
Instance Attribute Summary
Attributes inherited from MiGA::Cli::Action
Instance Method Summary collapse
Methods inherited from MiGA::Cli::Action
#complete, #empty_action, #initialize, #launch, load, #name
Methods inherited from MiGA
CITATION, CITATION_ARRAY, DEBUG, DEBUG_OFF, DEBUG_ON, DEBUG_TRACE_OFF, DEBUG_TRACE_ON, FULL_VERSION, LONG_VERSION, VERSION, VERSION_DATE, #advance, debug?, debug_trace?, initialized?, #like_io?, #num_suffix, rc_path, #result_files_exist?, #say
Methods included from MiGA::Common::Path
Methods included from MiGA::Common::Format
#clean_fasta_file, #seqs_length, #tabulate
Methods included from MiGA::Common::Net
#download_file_ftp, #known_hosts, #remote_connection
Methods included from MiGA::Common::SystemCall
Constructor Details
This class inherits a constructor from MiGA::Cli::Action
Instance Method Details
#parse_cli ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/miga/cli/action/new.rb', line 7 def parse_cli cli.parse do |opt| cli.opt_object(opt, [:project, :project_type_req]) opt.on( '-n', '--name STRING', 'Name of the project' ) { |v| cli[:name] = v } opt.on( '-d', '--description STRING', 'Description of the project' ) { |v| cli[:description] = v } opt.on( '-c', '--comments STRING', 'Comments on the project' ) { |v| cli[:comments] = v } opt.on( '--fast', 'Use faster identity engines (Diamond-AAI and FastANI)', 'Equivalent to: -m aai_p=diamond,ani_p=fastani' ) { |v| cli[:fast] = v } opt.on( '--sensitive', 'Use more sensitive identity engines (BLAST+)', 'Equivalent to: -m aai_p=blast+,ani_p=blast+' ) { |v| cli[:sensitive] = v } opt.on( '-m', '--metadata STRING', 'Metadata as key-value pairs separated by = and delimited by comma', 'Values are saved as strings except for booleans (true / false) or nil' ) { |v| cli[:metadata] = v } end end |
#perform ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/miga/cli/action/new.rb', line 40 def perform cli.ensure_type(MiGA::Project) cli.ensure_par(project: '-P') unless MiGA::MiGA.initialized? raise 'MiGA has not been initialized, please use "miga init" first' end cli.say "Creating project: #{cli[:project]}" raise 'Project already exists, aborting' if Project.exist?(cli[:project]) p = Project.new(cli[:project], false) p = cli.(p) if cli[:sensitive] p.set_option(:aai_p, 'blast+') p.set_option(:ani_p, 'blast+') elsif cli[:fast] p.set_option(:aai_p, 'diamond') p.set_option(:ani_p, 'fastani') end end |