toxbank-investigation 0.0.2pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +111 -0
- data/LICENSE +674 -0
- data/README +34 -0
- data/Rakefile +14 -0
- data/application.rb +284 -0
- data/bin/toxbank-investigation-install +76 -0
- data/config.ru +6 -0
- data/config/production.rb +9 -0
- data/java/config/isa_configurator/cellcount_flowcytometry.xml +1 -0
- data/java/config/isa_configurator/cellsorting_flowcyt.xml +5 -0
- data/java/config/isa_configurator/clinical_chemistry.xml +1 -0
- data/java/config/isa_configurator/copynumvariation_micro.xml +1 -0
- data/java/config/isa_configurator/dnamethylation_micro.xml +1 -0
- data/java/config/isa_configurator/dnamethylation_seq.xml +1 -0
- data/java/config/isa_configurator/envgen_survey_seq.xml +1 -0
- data/java/config/isa_configurator/genome_seq.xml +1 -0
- data/java/config/isa_configurator/hematology.xml +1 -0
- data/java/config/isa_configurator/heterozygosity_micro.xml +1 -0
- data/java/config/isa_configurator/histology.xml +1 -0
- data/java/config/isa_configurator/histonemodification_seq.xml +1 -0
- data/java/config/isa_configurator/metaboliteprofiling_ms.xml +114 -0
- data/java/config/isa_configurator/metaboliteprofiling_nmr.xml +114 -0
- data/java/config/isa_configurator/metagenome_seq.xml +1 -0
- data/java/config/isa_configurator/nru_assay.xml +8 -0
- data/java/config/isa_configurator/ppi_detection_micro.xml +1 -0
- data/java/config/isa_configurator/protein_dna_binding_ident_micro.xml +1 -0
- data/java/config/isa_configurator/protein_dna_binding_ident_seq.xml +1 -0
- data/java/config/isa_configurator/protein_expression_ge.xml +101 -0
- data/java/config/isa_configurator/protein_expression_micro.xml +1 -0
- data/java/config/isa_configurator/protein_expression_ms.xml +1 -0
- data/java/config/isa_configurator/proteinident_ms.xml +1 -0
- data/java/config/isa_configurator/snpanalysis_micro.xml +1 -0
- data/java/config/isa_configurator/studySample.xml +1 -0
- data/java/config/isa_configurator/tfbsident_micro.xml +1 -0
- data/java/config/isa_configurator/tfbsident_seq.xml +1 -0
- data/java/config/isa_configurator/transcription_micro.xml +1 -0
- data/java/config/isa_configurator/transcription_rtpcr.xml +1 -0
- data/java/config/isa_configurator/transcription_seq.xml +6 -0
- data/toxbank-investigation.gemspec +29 -0
- metadata +108 -0
data/README
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
toxbank-investigation: Investigation service for ToxBank
|
2
|
+
|
3
|
+
Installation:
|
4
|
+
|
5
|
+
Dependencies: ruby 1.9.x, git, zip, java, curl, wget
|
6
|
+
|
7
|
+
gem install toxbank-investigation
|
8
|
+
toxbank-investigation-install # service setup, configuration and webserver start
|
9
|
+
|
10
|
+
Development:
|
11
|
+
|
12
|
+
git clone git@github.com:ToxBank/toxbank-investigation.git
|
13
|
+
cd toxbank-investigation
|
14
|
+
git checkout development
|
15
|
+
|
16
|
+
# edit Gemfile
|
17
|
+
#
|
18
|
+
# uncomment and edit if you want to use github versions of opentox gems
|
19
|
+
# gem 'opentox-server', :git => "git://github.com/opentox/opentox-server", :branch => "development"
|
20
|
+
# gem 'opentox-client', :git => "git://github.com/opentox/opentox-client", :branch => "development"
|
21
|
+
# uncomment and edit if you want to use local installations of opentox gems
|
22
|
+
# gem 'opentox-server', :path => "~/opentox-server"
|
23
|
+
# gem "opentox-client", :path => "~/opentox-client"
|
24
|
+
|
25
|
+
bundle install
|
26
|
+
bin/toxbank-investigation-install
|
27
|
+
# Do you want to start the webserver? (y/n)
|
28
|
+
# Answer "n"
|
29
|
+
unicorn # starts server in development mode at port 8080
|
30
|
+
# unicorn -h: more options
|
31
|
+
|
32
|
+
see also https://github.com/opentox/opentox-server
|
33
|
+
|
34
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'bundler'
|
3
|
+
Bundler.require
|
4
|
+
Bundler.setup
|
5
|
+
|
6
|
+
require 'rake/testtask'
|
7
|
+
Rake::TestTask.new do |t|
|
8
|
+
t.libs << 'test'
|
9
|
+
t.test_files = FileList['test/*.rb'] - FileList["test/setup.rb"]
|
10
|
+
t.verbose = true
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Run tests"
|
14
|
+
task :default => :test
|
data/application.rb
ADDED
@@ -0,0 +1,284 @@
|
|
1
|
+
require "opentox-server"
|
2
|
+
require File.join(ENV["HOME"],".opentox","config","toxbank-investigation.rb")
|
3
|
+
|
4
|
+
module OpenTox
|
5
|
+
class Application < Service
|
6
|
+
|
7
|
+
helpers do
|
8
|
+
|
9
|
+
def uri
|
10
|
+
params[:id] ? url_for("/#{params[:id]}", :full).sub("http://","https://") : "https://#{request.env['HTTP_HOST']}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def uri_list
|
14
|
+
params[:id] ? d = "./investigation/#{params[:id]}/*" : d = "./investigation/*"
|
15
|
+
uris = Dir[d].collect{|f| url_for(f.sub(/\.\/investigation/,''), :full).sub("http://","https://") }
|
16
|
+
uris.collect!{|u| u.sub(/(\/#{params[:id]}\/)/,'\1isatab/')} if params[:id]
|
17
|
+
uris.compact.sort.join("\n") + "\n"
|
18
|
+
end
|
19
|
+
|
20
|
+
def dir
|
21
|
+
File.join File.dirname(File.expand_path __FILE__), "investigation", params[:id].to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
def tmp
|
25
|
+
File.join dir,"tmp"
|
26
|
+
end
|
27
|
+
|
28
|
+
def file
|
29
|
+
File.join dir, params[:filename]
|
30
|
+
end
|
31
|
+
|
32
|
+
def n3
|
33
|
+
"#{params[:id]}.n3"
|
34
|
+
end
|
35
|
+
|
36
|
+
def next_id
|
37
|
+
id = Dir["./investigation/*"].collect{|f| File.basename(f).to_i}.sort.last
|
38
|
+
id ? id + 1 : 0
|
39
|
+
end
|
40
|
+
|
41
|
+
def prepare_upload
|
42
|
+
# remove stale directories from failed tests
|
43
|
+
stale_files = `cd #{File.dirname(__FILE__)}/investigation && git ls-files --others --exclude-standard --directory`.chomp
|
44
|
+
`cd #{File.dirname(__FILE__)}/investigation && rm -rf #{stale_files}` unless stale_files.empty?
|
45
|
+
# lock tmp dir
|
46
|
+
locked_error "Processing investigation #{params[:id]}. Please try again later." if File.exists? tmp
|
47
|
+
bad_request_error "Please submit data as multipart/form-data" unless request.form_data?
|
48
|
+
# move existing ISA-TAB files to tmp
|
49
|
+
FileUtils.mkdir_p tmp
|
50
|
+
FileUtils.cp Dir[File.join(dir,"*.txt")], tmp
|
51
|
+
File.open(File.join(tmp, params[:file][:filename]), "w+"){|f| f.puts params[:file][:tempfile].read}
|
52
|
+
end
|
53
|
+
|
54
|
+
def extract_zip
|
55
|
+
# overwrite existing files with new submission
|
56
|
+
`unzip -o #{File.join(tmp,params[:file][:filename])} -d #{tmp}`
|
57
|
+
Dir["#{tmp}/*"].collect{|d| d if File.directory?(d)}.compact.each do |d|
|
58
|
+
`mv #{d}/* #{tmp}`
|
59
|
+
`rmdir #{d}`
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def extract_xls
|
64
|
+
# use Excelx.new instead of Excel.new if your file is a .xlsx
|
65
|
+
xls = Excel.new(File.join(tmp, params[:file][:filename])) if params[:file][:filename].match(/.xls$/)
|
66
|
+
xls = Excelx.new(File.join(tmp, params[:file][:filename])) if params[:file][:filename].match(/.xlsx$/)
|
67
|
+
xls.sheets.each_with_index do |sh, idx|
|
68
|
+
name = sh.to_s
|
69
|
+
xls.default_sheet = xls.sheets[idx]
|
70
|
+
1.upto(xls.last_row) do |ro|
|
71
|
+
1.upto(xls.last_column) do |co|
|
72
|
+
unless (co == xls.last_column)
|
73
|
+
File.open(File.join(tmp, name + ".txt"), "a+"){|f| f.print "#{xls.cell(ro, co)}\t"}
|
74
|
+
else
|
75
|
+
File.open(File.join(tmp, name + ".txt"), "a+"){|f| f.print "#{xls.cell(ro, co)}\n"}
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
rescue
|
81
|
+
bad_request_error "Could not parse spreadsheet #{params[:file][:filename]}"
|
82
|
+
end
|
83
|
+
|
84
|
+
def isa2rdf
|
85
|
+
begin # isa2rdf returns correct exit code
|
86
|
+
`cd #{File.dirname(__FILE__)}/java && java -jar isa2rdf-0.0.1-SNAPSHOT.jar -d #{tmp} -o #{File.join tmp,n3} &> #{File.join tmp,'log'}`
|
87
|
+
rescue
|
88
|
+
log = File.read File.join(tmp,"log")
|
89
|
+
FileUtils.remove_entry dir
|
90
|
+
bad_request_error "ISA-TAB validation failed:\n#{log}", uri
|
91
|
+
end
|
92
|
+
# rewrite default prefix
|
93
|
+
`sed -i 's;http://onto.toxbank.net/isa/tmp/;#{uri}/;' #{File.join tmp,n3}`
|
94
|
+
# add owl:sameAs to identify investigation later
|
95
|
+
investigation_id = `grep ":I[0-9]" #{File.join tmp,n3}|cut -f1 -d ' '`.strip
|
96
|
+
`echo "\n: owl:sameAs #{investigation_id} ." >> #{File.join tmp,n3}`
|
97
|
+
FileUtils.rm Dir[File.join(tmp,"*.zip")]
|
98
|
+
# if everything is fine move ISA-TAB files back to original dir
|
99
|
+
FileUtils.cp Dir[File.join(tmp,"*")], dir
|
100
|
+
# git commit
|
101
|
+
newfiles = `cd #{File.dirname(__FILE__)}/investigation; git ls-files --others --exclude-standard --directory`
|
102
|
+
`cd #{File.dirname(__FILE__)}/investigation && git add #{newfiles}`
|
103
|
+
['application/zip', 'application/vnd.ms-excel'].include?(params[:file][:type]) ? action = "created" : action = "modified"
|
104
|
+
`cd #{File.dirname(__FILE__)}/investigation && git commit -am "investigation #{params[:id]} #{action} by #{request.ip}"`
|
105
|
+
# create new zipfile
|
106
|
+
zipfile = File.join dir, "investigation_#{params[:id]}.zip"
|
107
|
+
`zip -j #{zipfile} #{dir}/*.txt`
|
108
|
+
# store RDF
|
109
|
+
length = File.size(File.join dir,n3)
|
110
|
+
file = File.join(dir,n3)
|
111
|
+
`curl -0 -k -u #{$four_store[:user]}:#{$four_store[:password]} -T #{file} -H 'Content_Length => #{length}' '#{$four_store[:uri]}/data/?graph=#{$four_store[:uri]}/data/#{$four_store[:user]}/investigation#{n3}'`
|
112
|
+
FileUtils.remove_entry tmp # unlocks tmp
|
113
|
+
OpenTox::Authorization.check_policy(uri, @subjectid)
|
114
|
+
uri
|
115
|
+
end
|
116
|
+
|
117
|
+
def query sparql
|
118
|
+
if @accept.match(/turtle/) and sparql.match(/CONSTRUCT/)
|
119
|
+
response['Content-type'] = @accept
|
120
|
+
elsif sparql.match(/CONSTRUCT/)
|
121
|
+
response['Content-type'] = 'application/rdf+xml'
|
122
|
+
else
|
123
|
+
response['Content-type'] = "application/sparql-results+xml"
|
124
|
+
end
|
125
|
+
`curl -H 'Accept:#{@accept}' -k -u #{$four_store[:user]}:#{$four_store[:password]} -d 'query=#{sparql}' '#{$four_store[:uri]}/sparql/'`
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
before do
|
131
|
+
not_found_error "Directory #{dir} does not exist." unless File.exist? dir
|
132
|
+
@accept = request.env['HTTP_ACCEPT']
|
133
|
+
response['Content-Type'] = @accept
|
134
|
+
# TODO: A+A
|
135
|
+
end
|
136
|
+
|
137
|
+
# Query all investigations or get a list of all investigations
|
138
|
+
# Requests with a query parameter will perform a SPARQL query on all investigations
|
139
|
+
# @return [application/sparql-results+json] Query result
|
140
|
+
# @return [text/uri-list] List of investigations
|
141
|
+
get '/?' do
|
142
|
+
if params[:query] # pass SPARQL query to 4store
|
143
|
+
query params[:query]
|
144
|
+
else
|
145
|
+
# Requests without a query parameter return a list of all investigations
|
146
|
+
case @accept
|
147
|
+
when 'text/uri-list'
|
148
|
+
uri_list
|
149
|
+
else
|
150
|
+
response['Content-Type'] = 'application/rdf+xml'
|
151
|
+
response['Content-Type'] = @accept if @accept == 'text/turtle'
|
152
|
+
query "
|
153
|
+
PREFIX isa: <http://onto.toxbank.net/isa/>
|
154
|
+
CONSTRUCT { ?s ?p ?o . }
|
155
|
+
WHERE {
|
156
|
+
?s a isa:Investigation ;
|
157
|
+
?p ?o .
|
158
|
+
}
|
159
|
+
"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# Create a new investigation from ISA-TAB files
|
165
|
+
# @param [Header] Content-type: multipart/form-data
|
166
|
+
# @param file Zipped investigation files in ISA-TAB format
|
167
|
+
# @return [text/uri-list] Investigation URI
|
168
|
+
post '/?' do
|
169
|
+
params[:id] = next_id
|
170
|
+
mime_types = ['application/zip','text/tab-separated-values', "application/vnd.ms-excel"]
|
171
|
+
bad_request_error "No file uploaded." unless params[:file]
|
172
|
+
bad_request_error "Mime type #{params[:file][:type]} not supported. Please submit data as zip archive (application/zip), Excel file (application/vnd.ms-excel) or as tab separated text (text/tab-separated-values)" unless mime_types.include? params[:file][:type]
|
173
|
+
task = OpenTox::Task.create($task[:uri], :description => "#{params[:file][:filename]}: Uploding, validating and converting to RDF") do
|
174
|
+
prepare_upload
|
175
|
+
case params[:file][:type]
|
176
|
+
when "application/vnd.ms-excel"
|
177
|
+
extract_xls
|
178
|
+
when "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
179
|
+
extract_xls
|
180
|
+
when 'application/zip'
|
181
|
+
extract_zip
|
182
|
+
#when 'text/tab-separated-values' # do nothing, file is already in tmp
|
183
|
+
end
|
184
|
+
isa2rdf
|
185
|
+
end
|
186
|
+
response['Content-Type'] = 'text/uri-list'
|
187
|
+
halt 202,task.uri+"\n"
|
188
|
+
end
|
189
|
+
|
190
|
+
# Get an investigation representation
|
191
|
+
# @param [Header] Accept: one of text/tab-separated-values, text/uri-list, application/zip, application/sparql-results+json
|
192
|
+
# @return [text/tab-separated-values, text/uri-list, application/zip, application/sparql-results+json] Investigation in the requested format
|
193
|
+
get '/:id' do
|
194
|
+
not_found_error "Investigation #{uri} does not exist." unless File.exist? dir # not called in before filter???
|
195
|
+
case @accept
|
196
|
+
when "text/tab-separated-values"
|
197
|
+
send_file Dir["./investigation/#{params[:id]}/i_*txt"].first, :type => @accept
|
198
|
+
when "text/uri-list"
|
199
|
+
uri_list
|
200
|
+
when "application/zip"
|
201
|
+
send_file File.join dir, "investigation_#{params[:id]}.zip"
|
202
|
+
when "application/rdf+xml"
|
203
|
+
query "CONSTRUCT { ?s ?p ?o } FROM <#{$four_store[:uri]}/data/#{$four_store[:user]}/investigation#{n3}> WHERE {?s ?p ?o } LIMIT 15000"
|
204
|
+
else
|
205
|
+
#$logger.debug request.to_yaml
|
206
|
+
#bad_request_error "Accept header #{@accept} not supported for #{uri}"
|
207
|
+
$logger.warn "Accept header #{@accept} not supported for #{uri}" # do not halt: strange requests from test, TODO: identify and fix
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
# Get investigation metadata in RDF
|
212
|
+
get '/:id/metadata' do
|
213
|
+
not_found_error "Investigation #{uri} does not exist." unless File.exist? dir # not called in before filter???
|
214
|
+
query "
|
215
|
+
PREFIX : <#{uri}/>
|
216
|
+
PREFIX owl: <http://www.w3.org/2002/07/owl#>
|
217
|
+
CONSTRUCT { ?s ?p ?o. }
|
218
|
+
WHERE {
|
219
|
+
: owl:sameAs ?s .
|
220
|
+
?s ?p ?o .
|
221
|
+
}
|
222
|
+
"
|
223
|
+
end
|
224
|
+
|
225
|
+
# Get a study, assay, data representation
|
226
|
+
# @param [Header] one of text/tab-separated-values, application/sparql-results+json
|
227
|
+
# @return [text/tab-separated-values, application/sparql-results+json] Study, assay, data representation in ISA-TAB or RDF format
|
228
|
+
get '/:id/isatab/:filename' do
|
229
|
+
not_found_error "File #{File.join uri,"isatab",params[:filename]} does not exist." unless File.exist? file
|
230
|
+
# TODO: returns text/plain content type for tab separated files
|
231
|
+
send_file file, :type => File.new(file).mime_type
|
232
|
+
end
|
233
|
+
|
234
|
+
# Get RDF for an investigation resource
|
235
|
+
get '/:id/:resource' do
|
236
|
+
query "
|
237
|
+
PREFIX : <#{uri}/>
|
238
|
+
PREFIX owl: <http://www.w3.org/2002/07/owl#>
|
239
|
+
CONSTRUCT { :#{params[:resource]} ?p ?o. }
|
240
|
+
WHERE {
|
241
|
+
:#{params[:resource]} ?p ?o .
|
242
|
+
}
|
243
|
+
"
|
244
|
+
end
|
245
|
+
|
246
|
+
# Add studies, assays or data to an investigation
|
247
|
+
# @param [Header] Content-type: multipart/form-data
|
248
|
+
# @param file Study, assay and data file (zip archive of ISA-TAB files or individual ISA-TAB files)
|
249
|
+
post '/:id' do
|
250
|
+
mime_types = ['application/zip','text/tab-separated-values', "application/vnd.ms-excel"]
|
251
|
+
bad_request_error "Mime type #{params[:file][:type]} not supported. Please submit data as zip archive (application/zip), Excel file (application/vnd.ms-excel) or as tab separated text (text/tab-separated-values)" unless mime_types.include? params[:file][:type]
|
252
|
+
task = OpenTox::Task.create($task[:uri], :description => "#{params[:file][:filename]}: Uploding, validationg and converting to RDF") do
|
253
|
+
prepare_upload
|
254
|
+
isa2rdf
|
255
|
+
end
|
256
|
+
response['Content-Type'] = 'text/uri-list'
|
257
|
+
halt 202,task.uri+"\n"
|
258
|
+
end
|
259
|
+
|
260
|
+
# Delete an investigation
|
261
|
+
delete '/:id' do
|
262
|
+
FileUtils.remove_entry dir
|
263
|
+
# git commit
|
264
|
+
`cd #{File.dirname(__FILE__)}/investigation; git commit -am "#{dir} deleted by #{request.ip}"`
|
265
|
+
# updata RDF
|
266
|
+
`curl -i -k -u #{$four_store[:user]}:#{$four_store[:password]} -X DELETE '#{$four_store[:uri]}/data/#{$four_store[:user]}/investigation#{n3}'`
|
267
|
+
response['Content-Type'] = 'text/plain'
|
268
|
+
"Investigation #{params[:id]} deleted"
|
269
|
+
end
|
270
|
+
|
271
|
+
# Delete an individual study, assay or data file
|
272
|
+
delete '/:id/:filename' do
|
273
|
+
task = OpenTox::Task.create($task[:uri], :description => "Deleting #{params[:file][:filename]} from investigation #{params[:id]}.") do
|
274
|
+
prepare_upload
|
275
|
+
File.delete File.join(tmp,params[:filename])
|
276
|
+
isa2rdf
|
277
|
+
"#{request.env['rack.url_scheme']}://#{request.env['HTTP_HOST']}"
|
278
|
+
end
|
279
|
+
response['Content-Type'] = 'text/uri-list'
|
280
|
+
halt 202,task.uri+"\n"
|
281
|
+
end
|
282
|
+
|
283
|
+
end
|
284
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# Main ToxBank-investigation install script
|
3
|
+
# Author: Christoph Helma, Andreas Maunz, Denis Gebele.
|
4
|
+
|
5
|
+
ISA2RDF=isa2rdf-0.0.1-SNAPSHOT.jar
|
6
|
+
|
7
|
+
echo
|
8
|
+
echo "This script will setup and configure the toxbank-investigation service."
|
9
|
+
echo "You may have to run the script as root if the toxbank-invetigation gem has been installed as root (deprecated)"
|
10
|
+
echo
|
11
|
+
|
12
|
+
TB_HOME=`dirname $0`/..
|
13
|
+
cd $TB_HOME
|
14
|
+
TB_HOME=`pwd`
|
15
|
+
mkdir -p investigation
|
16
|
+
mkdir -p java
|
17
|
+
mkdir -p public
|
18
|
+
|
19
|
+
|
20
|
+
cd java
|
21
|
+
if [ ! -f $ISA2RDF ]
|
22
|
+
then
|
23
|
+
echo "Installing isa2rdf"
|
24
|
+
wget -v "https://github.com/downloads/ToxBank/isa2rdf/$ISA2RDF"
|
25
|
+
fi
|
26
|
+
cd $TB_HOME
|
27
|
+
|
28
|
+
cd investigation
|
29
|
+
if [ ! -d .git ]
|
30
|
+
then
|
31
|
+
echo "Initializing git for investigations"
|
32
|
+
git init
|
33
|
+
echo "*/*.zip" > .gitignore
|
34
|
+
echo "*/tmp" >> .gitignore
|
35
|
+
git add .gitignore
|
36
|
+
git commit -am "Initial commit: .gitignore added"
|
37
|
+
fi
|
38
|
+
cd $TB_HOME
|
39
|
+
|
40
|
+
echo "Installing configuration files"
|
41
|
+
|
42
|
+
mkdir -p "$HOME/.opentox/config/toxbank-investigation"
|
43
|
+
mkdir -p "$HOME/.opentox/log"
|
44
|
+
mkdir -p "$HOME/.opentox/tmp"
|
45
|
+
|
46
|
+
config="$HOME/.opentox/config/toxbank-investigation/production.rb"
|
47
|
+
|
48
|
+
if [ -f $config ]
|
49
|
+
then
|
50
|
+
echo "Configuration $config exists. Please check if the settings are correct."
|
51
|
+
else
|
52
|
+
echo "Creating configuration"
|
53
|
+
echo -n "Please enter your 4store username: "
|
54
|
+
read user
|
55
|
+
echo -n "Please enter your 4store password: "
|
56
|
+
read pass
|
57
|
+
|
58
|
+
sed -e "s/ USER/ '$user'/;s/ PASS/ '$pass'/" config/production.rb > $config
|
59
|
+
echo "Configuration $config created. Please check if the settings are correct."
|
60
|
+
fi
|
61
|
+
|
62
|
+
echo
|
63
|
+
echo "Installation finished and system configured."
|
64
|
+
echo "Do you want to start the webserver? (y/n)"
|
65
|
+
|
66
|
+
read answer
|
67
|
+
if [ $answer = "y" ]
|
68
|
+
then
|
69
|
+
last_ip=`ip addr show|grep -w inet|grep -v '127.0'|sed 's/ \+inet //'|cut -d '/' -f1|cut -d '.' -f4`
|
70
|
+
port=8`printf "%03d" $last_ip`
|
71
|
+
echo "Starting unicorn in production mode at port $port"
|
72
|
+
unicorn -p $port -E production -D
|
73
|
+
else
|
74
|
+
echo "Run 'unicorn -E production -D' to start the service. See 'unicorn -h' for more options"
|
75
|
+
fi
|
76
|
+
echo
|
data/config.ru
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
<isatab-config-file xmlns="http://www.ebi.ac.uk/bii/isatab_configuration#"><isatab-configuration table-name="cellcount_flowcytometry" isatab-assay-type="generic_assay" isatab-conversion-target="generic"><measurement term-label="cell counting" term-accession="1111111" source-abbreviation="OBI"/><technology term-label="flow cytometry" term-accession="2222222" source-abbreviation="OBI"/><field header="Sample Name" data-type="String" is-file-field="false" is-multiple-value="true" is-required="true" is-hidden="false"><description><![CDATA[the name identifying the sample]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT]</generated-value-template></field><protocol-field protocol-type ="labeling"/><field header="Labeled Sample Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[a name identifying the labeled sample.]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT]</generated-value-template></field><field header="Label" data-type="Ontology term" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[a semi-colon separated value of dyes selected from CHEBI]]></description><default-value><![CDATA[]]></default-value><recommended-ontologies><ontology id="1007" abbreviation="CHEBI" name="Chemical entities of biological interest" version="40664"/></recommended-ontologies></field><field header="Assay Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[the name identifying the assay]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT].Extract-[EXTRACT_COUNT].LE-[LABEL_COUNT].ASSAY-[HYB_COUNT]</generated-value-template></field><protocol-field protocol-type ="data collection"/><field header="Parameter Value[flow cytometry instrument]" data-type="Ontology term" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[instrument]]></description><default-value><![CDATA[]]></default-value></field><field header="Parameter Value[optical path]" data-type="String" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[the optical path]]></description><default-value><![CDATA[]]></default-value></field><field header="Parameter Value[detector voltage]" data-type="Integer" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[detector voltage]]></description><default-value><![CDATA[]]></default-value></field><unit-field data-type="Ontology term" is-multiple-value="false" is-required="false"><description>unit"</description><recommended-ontologies><ontology id="1112" abbreviation="UO" name="Units of measurement" version="40305"/></recommended-ontologies></unit-field><field header="Image File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[path to image file]]></description><default-value><![CDATA[]]></default-value></field><field header="Raw Data File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[path to fcs datafile]]></description><default-value><![CDATA[]]></default-value></field><protocol-field protocol-type ="gating"/><field header="Data Transformation Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[a data transformation carried out on the raw data files]]></description><default-value><![CDATA[]]></default-value></field><field header="Derived Data File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[path to gating-ml file]]></description><default-value><![CDATA[]]></default-value></field><structured-field name="Factors"/></isatab-configuration></isatab-config-file>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<isatab-config-file xmlns="http://www.ebi.ac.uk/bii/isatab_configuration#"><isatab-configuration table-name="cellsorting_flowcyt" isatab-assay-type="generic_assay" isatab-conversion-target="generic"><measurement term-label="cell sorting" term-accession="" source-abbreviation=""/><technology term-label="flow cytometry" term-accession="" source-abbreviation=""/><field header="Sample Name" data-type="String" is-file-field="false" is-multiple-value="true" is-required="true" is-hidden="false"><description><![CDATA[the name identifying the sample]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT]
|
2
|
+
</generated-value-template></field><protocol-field protocol-type ="labeling"/><field header="Labeled Sample Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[a labeled sample name]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT]
|
3
|
+
</generated-value-template></field><field header="Label" data-type="Ontology term" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[a semi-colon separated value of dyes selected from CHEBI]]></description><default-value><![CDATA[]]></default-value><recommended-ontologies><ontology id="1007" abbreviation="CHEBI" name="Chemical entities of biological interest" version="40664"/></recommended-ontologies></field><field header="Assay Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[the name identifying the assay]]></description><default-value><![CDATA[]]></default-value><generated-value-template>
|
4
|
+
[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT].Extract-[EXTRACT_COUNT].LE-[LABEL_COUNT].ASSAY-[HYB_COUNT]
|
5
|
+
</generated-value-template></field><protocol-field protocol-type ="data collection"/><field header="Parameter Value[flow cytometry instrument]" data-type="Ontology term" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[the name of the flow cytometer used]]></description><default-value><![CDATA[]]></default-value></field><field header="Parameter Value[optical path]" data-type="String" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[the optical path]]></description><default-value><![CDATA[]]></default-value></field><field header="Parameter Value[detector voltage]" data-type="Integer" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[a voltage value]]></description><default-value><![CDATA[]]></default-value></field><unit-field data-type="Ontology term" is-multiple-value="false" is-required="false"><description>voltage"</description><recommended-ontologies><ontology id="1112" abbreviation="UO" name="Units of measurement" version="40305"/></recommended-ontologies></unit-field><field header="Image File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[a path to an image file]]></description><default-value><![CDATA[]]></default-value></field><field header="Raw Data File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[fcs files]]></description><default-value><![CDATA[]]></default-value></field><protocol-field protocol-type ="gating"/><field header="Data Transformation Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[the name identifying the sample]]></description><default-value><![CDATA[]]></default-value></field><field header="Derived Data File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[a derived data file (e.g gating.ml file)]]></description><default-value><![CDATA[]]></default-value></field><structured-field name="Factors"/></isatab-configuration></isatab-config-file>
|
@@ -0,0 +1 @@
|
|
1
|
+
<isatab-config-file xmlns="http://www.ebi.ac.uk/bii/isatab_configuration#"><isatab-configuration table-name="clinical_chemistry" isatab-assay-type="generic_assay" isatab-conversion-target="generic"><measurement term-label="clinical chemistry analysis" term-accession="" source-abbreviation="OBI"/><technology term-label="" term-accession="" source-abbreviation=""/><field header="Sample Name" data-type="String" is-file-field="false" is-multiple-value="true" is-required="true" is-hidden="false"><description><![CDATA[Samples represent major outputs resulting from a protocol application other than the special case outputs of Extract or a Labeled Extract.]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT]</generated-value-template></field><protocol-field protocol-type ="clinical chemistry"/><field header="Assay Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[User-defined name for an assay.]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT].Extract-[EXTRACT_COUNT].LE-[LABEL_COUNT].ASSAY-[HYB_COUNT]</generated-value-template></field><field header="Raw Data File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[Name (or URI) of the data file generated by an assay.]]></description><default-value><![CDATA[]]></default-value></field><field header="Data Transformation Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[User-defined name for each data transformation applied.]]></description><default-value><![CDATA[]]></default-value></field><field header="Normalization Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[User-defined name for each normalization applied]]></description><default-value><![CDATA[]]></default-value></field><field header="Derived Data File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[Name (or URI) of the data file generated by an assay.]]></description><default-value><![CDATA[]]></default-value></field><structured-field name="Factors"/></isatab-configuration></isatab-config-file>
|
@@ -0,0 +1 @@
|
|
1
|
+
<isatab-config-file xmlns="http://www.ebi.ac.uk/bii/isatab_configuration#"><isatab-configuration table-name="copynumvariation_micro" isatab-assay-type="transcriptomics_assay" isatab-conversion-target="magetab"><measurement term-label="copy number variation profiling" term-accession="" source-abbreviation="OBI"/><technology term-label="DNA microarray" term-accession="0400148" source-abbreviation="OBI"/><field header="Sample Name" data-type="String" is-file-field="false" is-multiple-value="true" is-required="true" is-hidden="false"><description><![CDATA[Samples represent major outputs resulting from a protocol application other than the special case outputs of Extract or a Labeled Extract.]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT]</generated-value-template></field><protocol-field protocol-type ="DNA extraction"/><field header="Extract Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[User-defined names for each portion of extracted material.]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT].Extract-[EXTRACT_COUNT]</generated-value-template></field><protocol-field protocol-type ="labeling"/><field header="Labeled Extract Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[Identifier for the labeled extract.]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT].Extract-[EXTRACT_COUNT].LE-[LABEL_COUNT]</generated-value-template></field><field header="Label" data-type="Ontology term" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[Indicates a chemical or biological marker, such as a radioactive isotope or a fluorescent dye which is bound to a material in order to make it detectable by some assay technology (e.g. P33, biotin, GFP).]]></description><default-value><![CDATA[]]></default-value><recommended-ontologies><ontology id="1007" abbreviation="CHEBI" name="Chemical entities of biological interest" version="40664"/></recommended-ontologies></field><protocol-field protocol-type ="nucleic acid hybridization"/><field header="Hybridization Assay Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[User-defined name for an assay.]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[INSTITUTION].Group-[GROUP_NO].Subject-[SUBJECT_NO].[SAMPLE_EXTRACT].Extract-[EXTRACT_COUNT].LE-[LABEL_COUNT].HYB-[HYB_COUNT]</generated-value-template></field><field header="Array Design REF" data-type="String" is-file-field="false" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[Reference to the identifier (or accession number) of an existing array design]]></description><default-value><![CDATA[]]></default-value><generated-value-template>[ARRAY_DESIGN]</generated-value-template></field><protocol-field protocol-type ="data collection"/><field header="Scan Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[User-defined name for each scan event.]]></description><default-value><![CDATA[]]></default-value></field><field header="Image File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[Name (or URI) of the image files generated by an assay]]></description><default-value><![CDATA[]]></default-value></field><field header="Array Data File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="true" is-hidden="false"><description><![CDATA[Name (or URI) of the data file generated by an assay]]></description><default-value><![CDATA[]]></default-value></field><field header="Array Data Matrix File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[Name (or URI) of the raw array data matrix file.]]></description><default-value><![CDATA[]]></default-value></field><protocol-field protocol-type ="normalization data transformation"/><field header="Normalization Name" data-type="String" is-file-field="false" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[User-defined name for each normalization applied]]></description><default-value><![CDATA[]]></default-value></field><field header="Derived Array Data File" data-type="String" is-file-field="true" is-multiple-value="false" is-required="false" is-hidden="false"><description><![CDATA[Name (or URI) of the data file generated by an assay]]></description><default-value><![CDATA[]]></default-value></field><protocol-field protocol-type ="data transformation"/><field header="Data Transformation Name" data-type="String" is-file-field="false" is-multiple-value="true" is-required="false" is-hidden="false"><description><![CDATA[User-defined name for each data transformation applied]]></description><default-value><![CDATA[]]></default-value></field><field header="Derived Array Data Matrix File" data-type="String" is-file-field="true" is-multiple-value="true" is-required="false" is-hidden="false"><description><![CDATA[Name (or URI) of the processed data matrix file resulting from data transformation or processing.]]></description><default-value><![CDATA[]]></default-value></field><structured-field name="Factors"/></isatab-configuration></isatab-config-file>
|