lib/transcriptic/cli.rb in transcriptic-0.2.2 vs lib/transcriptic/cli.rb in transcriptic-0.2.3

- old
+ new

@@ -94,33 +94,54 @@ ret.each do |run| say " #{run.name}" end end + desc "lookup QUERY", "Search for resources" + long_desc <<-LONGDESC + Search your organization's resource library as well as all public resources (i.e., commercial reagents). Useful + \x5 for looking up resource IDs of the format VENDOR/SKU as required for use in protocols. Example: + + transcriptic lookup phusion + \x5===> NEB/M0530 Phusion High-Fidelity DNA Polymerase + \x5===> NEB/M0535 Phusion Hot Start Flex DNA Polymerase + \x5===> NEB/B0519 Phusion GC Buffer + \x5===> NEB/B0518 Phusion HF Buffer + LONGDESC + method_option :limit, type: :numeric, desc: "Maximum number of results to return" + def lookup(term) + ret = transcriptic.search_resources(term) + ret["results"].each do |result| + output_with_arrow "#{result[:resource_id]}: #{result[:name]}" + end + end + desc "update", "Update the project's dependencies" def update require_labfile! output_with_arrow "Updating dependencies..." labfile = Transcriptic::Labfile.from_file(Transcriptic.find_labfile) Transcriptic::DependenciesGenerator.new([Dir.pwd, labfile.dependencies], options).invoke_all + Transcriptic::SBT.update end desc "compile", "Compile the project" def compile require_labfile! update Transcriptic::SBT.compile end desc "analyze OBJECTPATH", "Analyze a protocol. Object path is of the form edu.foo.bar where bar is the name of your Protocol object." - method_options :raw => :boolean, :iterations => :integer + method_options :raw => :boolean, :iterations => :numeric, :linearize => :boolean def analyze(object_path) raw = options.raw ? "--raw" : "" + linearize = options.linearize ? "--linearize" : "" iterations = options.iterations ? options.iterations : 5 require_labfile! update Transcriptic::SBT.stage - data = `target/start #{object_path} --verify #{raw} --iterations #{iterations}` + data = `target/start #{object_path} --verify #{raw} #{linearize} --iterations #{iterations}` if not options.raw json = json_decode(data) output_with_arrow "Verification successful for #{object_path}" output_with_indent "Expected cost: $#{json["price_avg"]}, maximum observed cost: $#{json["price_max"]}" else