transcriptic 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df7520b6492d5e8e386b736c581a85139675ca58
4
- data.tar.gz: 2fa1a96e201c8e7bfcb439709c4c8696027d622c
3
+ metadata.gz: 01ee5e633ccf6090da9f9c302ed28d5ebcb51a91
4
+ data.tar.gz: 082a53ce0fea38126c1ab6e3d2c1a8e88d568c94
5
5
  SHA512:
6
- metadata.gz: c6e0a7a3a6d862678dceb771223d267c824b8a909d4a20e9baa95a0907eb13c8df136cbba72a443ae4378e6d7a4bba0f4c9c42274888f4ebeb33928f2af81295
7
- data.tar.gz: 396a542b17b24a4dbd17c5e84b6c6afbb917e950a7e3c74d8ba6e6611eb55b36119465e220955170558efe20559c65e71a62550beb66f4d422d517802e3d6fea
6
+ metadata.gz: d547dcbf5cd749034f0a053dd5ce9e54db318bb2b084777e91c044c3db8343a3f64813ba7946cb004e61c40c964a84b63b1b516f934d6e76923ad5813962764c
7
+ data.tar.gz: 2a601e5d2f5dc0f3b78a9906b14d78978ac76904b4eb5a6853755596b67db115de69233f6ab02ad3d9c2acd3cb1bf321cb49e78b8a850e683558ee238d01037b
@@ -96,12 +96,32 @@ module Transcriptic
96
96
  end
97
97
  end
98
98
 
99
+ desc "lookup QUERY", "Search for resources"
100
+ long_desc <<-LONGDESC
101
+ Search your organization's resource library as well as all public resources (i.e., commercial reagents). Useful
102
+ \x5 for looking up resource IDs of the format VENDOR/SKU as required for use in protocols. Example:
103
+
104
+ transcriptic lookup phusion
105
+ \x5===> NEB/M0530 Phusion High-Fidelity DNA Polymerase
106
+ \x5===> NEB/M0535 Phusion Hot Start Flex DNA Polymerase
107
+ \x5===> NEB/B0519 Phusion GC Buffer
108
+ \x5===> NEB/B0518 Phusion HF Buffer
109
+ LONGDESC
110
+ method_option :limit, type: :numeric, desc: "Maximum number of results to return"
111
+ def lookup(term)
112
+ ret = transcriptic.search_resources(term)
113
+ ret["results"].each do |result|
114
+ output_with_arrow "#{result[:resource_id]}: #{result[:name]}"
115
+ end
116
+ end
117
+
99
118
  desc "update", "Update the project's dependencies"
100
119
  def update
101
120
  require_labfile!
102
121
  output_with_arrow "Updating dependencies..."
103
122
  labfile = Transcriptic::Labfile.from_file(Transcriptic.find_labfile)
104
123
  Transcriptic::DependenciesGenerator.new([Dir.pwd, labfile.dependencies], options).invoke_all
124
+ Transcriptic::SBT.update
105
125
  end
106
126
 
107
127
  desc "compile", "Compile the project"
@@ -112,14 +132,15 @@ module Transcriptic
112
132
  end
113
133
 
114
134
  desc "analyze OBJECTPATH", "Analyze a protocol. Object path is of the form edu.foo.bar where bar is the name of your Protocol object."
115
- method_options :raw => :boolean, :iterations => :integer
135
+ method_options :raw => :boolean, :iterations => :numeric, :linearize => :boolean
116
136
  def analyze(object_path)
117
137
  raw = options.raw ? "--raw" : ""
138
+ linearize = options.linearize ? "--linearize" : ""
118
139
  iterations = options.iterations ? options.iterations : 5
119
140
  require_labfile!
120
141
  update
121
142
  Transcriptic::SBT.stage
122
- data = `target/start #{object_path} --verify #{raw} --iterations #{iterations}`
143
+ data = `target/start #{object_path} --verify #{raw} #{linearize} --iterations #{iterations}`
123
144
  if not options.raw
124
145
  json = json_decode(data)
125
146
  output_with_arrow "Verification successful for #{object_path}"
@@ -5,7 +5,8 @@
5
5
  #
6
6
  # require 'transcriptic'
7
7
  # transcriptic = Transcriptic::Client.new('me@example.com', 'mypass')
8
- # transcriptic.create('myapp')
8
+ # transcriptic.list_resources
9
+ # transcriptic.run_info("run-625f827a")
9
10
  #
10
11
  class Transcriptic::Client
11
12
  include Transcriptic::UI
@@ -15,7 +16,7 @@ class Transcriptic::Client
15
16
  end
16
17
 
17
18
  def self.gem_version_string
18
- "transcriptic-gem/#{version}"
19
+ "transcriptic/#{version}"
19
20
  end
20
21
 
21
22
  attr_accessor :host, :user, :api_key
@@ -31,49 +32,82 @@ class Transcriptic::Client
31
32
  @host = host
32
33
  end
33
34
 
34
- def list_projects
35
- json_decode get("/api/projects.json").to_s
35
+ def search_resources(term, limit = 10)
36
+ json_decode get("/api/resources/search.json?query=#{escape(term)}&limit=#{limit}").to_s
36
37
  end
37
38
 
38
- def project_info(name)
39
- json_decode get("/api/projects/#{name}.json").to_s
39
+ def list_resources
40
+ json_decode get("/api/resources.json").to_s
40
41
  end
41
42
 
42
- class ProtocolException < RuntimeError; end
43
+ def resource_info(id)
44
+ json_decode get("/api/resources/#{id}.json").to_s
45
+ end
43
46
 
44
- # Show a list of projects which you are a collaborator on.
45
- def list
46
- json_decode get('/api/runs.json').to_s
47
+ def list_runs
48
+ json_decode get("/api/runs.json").to_s
47
49
  end
48
50
 
49
- def list_datasets(run_id = nil, project_id = nil)
50
- json_decode get("/api/datasets.json?run_id=#{run_id}&project_id=#{project_id}").to_s
51
+ def run_info(id)
52
+ json_decode get("/api/runs/#{id}.json").to_s
51
53
  end
52
54
 
53
- def get_dataset_info(dataset_id)
54
- json_decode get("/api/datasets/#{dataset_id}").to_s
55
+ def create_run(fd, project_id)
56
+ payload = {
57
+ 'zipdata' => Base64.encode64(File.open(fd).read),
58
+ 'project_id' => project_id
59
+ }
60
+ json_decode post("/api/runs", payload, { 'Content-Type' => 'application/zip; charset=UTF-8' }).to_s
55
61
  end
56
62
 
57
- def delete_dataset(dataset_id)
58
- json_decode delete("/api/datasets/#{dataset_id}").to_s
63
+ def protocol(run_id)
64
+ Protocol.new(self, run_id)
59
65
  end
60
66
 
61
- # Show info such as mode, custom domain, and collaborators on an app.
62
- def info(name_or_domain)
63
- name_or_domain = name_or_domain.gsub(/^(http:\/\/)?(www\.)?/, '')
67
+ def read_logs(run_id, options=[])
68
+ query = "&" + options.join("&") unless options.empty?
69
+ url = get("/api/runs/#{run_id}/logs.json?#{query}").to_s
70
+ if 'not_found' == url
71
+ error "Run #{run_id} not found!"
72
+ end
73
+
74
+ uri = URI.parse(url);
75
+ http = Net::HTTP.new(uri.host, uri.port)
76
+
77
+ if uri.scheme == 'https'
78
+ http.use_ssl = true
79
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
80
+ end
81
+
82
+ http.read_timeout = 60 * 60 * 24
83
+
84
+ begin
85
+ http.start do
86
+ http.request_get(uri.path + (uri.query ? "?" + uri.query : "")) do |request|
87
+ request.read_body do |chunk|
88
+ yield chunk
89
+ end
90
+ end
91
+ end
92
+ rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, SocketError
93
+ abort(" ! Could not connect to logging service")
94
+ rescue Timeout::Error, EOFError
95
+ abort("\n ! Request timed out")
96
+ end
64
97
  end
65
98
 
99
+ class ProtocolException < RuntimeError; end
100
+
66
101
  class Protocol
67
- attr_accessor :attached, :upid
102
+ attr_accessor :attached
68
103
 
69
- def initialize(client, protocol, upid=nil)
104
+ def initialize(client, protocol)
70
105
  @client = client
71
106
  @protocol = protocol
72
- @upid = upid
73
107
  end
74
108
 
75
109
  # launch the protocol
76
- def launch(command, attached=false)
110
+ def launch(command, attached = false)
77
111
  @attached = attached
78
112
  @response = @client.post(
79
113
  "/api/runs/#{@app}/confirm",
@@ -129,58 +163,6 @@ class Transcriptic::Client
129
163
  end
130
164
  end
131
165
 
132
- def status(run_id)
133
- json_decode get("/api/runs/#{run_id}").to_s
134
- end
135
-
136
- def create_run(fd, project_id)
137
- payload = {
138
- 'zipdata' => Base64.encode64(File.open(fd).read),
139
- 'project_id' => project_id
140
- }
141
- json_decode post("/api/runs", payload, { 'Content-Type' => 'application/zip; charset=UTF-8' }).to_s
142
- end
143
-
144
- def launch_run(run_id)
145
- json_decode post("/api/runs/#{run_id}/confirm").to_s
146
- end
147
-
148
- def protocol(run_id, upid)
149
- Protocol.new(self, run_id, upid)
150
- end
151
-
152
- def read_logs(run_id, options=[])
153
- query = "&" + options.join("&") unless options.empty?
154
- url = get("/api/runs/#{run_id}/logs.json?#{query}").to_s
155
- if 'not_found' == url
156
- error "Run #{run_id} not found!"
157
- end
158
-
159
- uri = URI.parse(url);
160
- http = Net::HTTP.new(uri.host, uri.port)
161
-
162
- if uri.scheme == 'https'
163
- http.use_ssl = true
164
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
165
- end
166
-
167
- http.read_timeout = 60 * 60 * 24
168
-
169
- begin
170
- http.start do
171
- http.request_get(uri.path + (uri.query ? "?" + uri.query : "")) do |request|
172
- request.read_body do |chunk|
173
- yield chunk
174
- end
175
- end
176
- end
177
- rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, SocketError
178
- abort(" ! Could not connect to logging service")
179
- rescue Timeout::Error, EOFError
180
- abort("\n ! Request timed out")
181
- end
182
- end
183
-
184
166
  def on_warning(&blk)
185
167
  @warning_callback = blk
186
168
  end
@@ -13,6 +13,11 @@ module Transcriptic
13
13
  sbt("stage")
14
14
  end
15
15
 
16
+ def update
17
+ ensure_installed
18
+ sbt("update")
19
+ end
20
+
16
21
  private
17
22
  def ensure_installed
18
23
  stat = `which sbt`
@@ -49,7 +49,7 @@ object AutoprotocolBuild extends Build {
49
49
  "<%= name %>",
50
50
  file("."),
51
51
  settings =
52
- buildSettings ++ Seq (libraryDependencies ++= (Seq("org.autoprotocol" %% "autoprotocol" % "0.1.0-SNAPSHOT") ++
52
+ buildSettings ++ Seq (libraryDependencies ++= (Seq("org.autoprotocol" %% "autoprotocol-library" % "0.1.1-SNAPSHOT") ++
53
53
  dependencies), resolvers ++= Seq(transcriptic, autoprotocol, typesafe)) ++ Defaults.defaultSettings ++
54
54
  StartScriptPlugin.startScriptForClassesSettings
55
55
  ) settings (
@@ -1,4 +1,4 @@
1
1
  module Transcriptic
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  AUTOPROTOCOL_VERSION = "0.1.0"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transcriptic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Transcriptic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-21 00:00:00.000000000 Z
11
+ date: 2013-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: netrc