bahuvrihi-ms-data_explorer 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ms/data_explorer/convert/dat_to_ascii.rb +26 -19
- metadata +26 -4
@@ -1,10 +1,11 @@
|
|
1
|
+
require 'tap/tasks/file_task'
|
1
2
|
require 'ms/data_explorer'
|
2
3
|
|
3
4
|
module Ms
|
4
5
|
module DataExplorer
|
5
6
|
module Convert
|
6
7
|
|
7
|
-
# :startdoc::
|
8
|
+
# :startdoc::task converts .dat file to ascii text
|
8
9
|
#
|
9
10
|
# Uses the Applied Biosystems DataExplorer software to extract an ASCII spectrum
|
10
11
|
# from a '.dat' file. Each input file should be a dat file; ascii files will be placed in
|
@@ -12,15 +13,33 @@ module Ms
|
|
12
13
|
# the same directory as the input file).
|
13
14
|
#
|
14
15
|
# DatToAscii is based on the getdeascii.pl script.
|
15
|
-
class DatToAscii < Tap::FileTask
|
16
|
+
class DatToAscii < Tap::Tasks::FileTask
|
16
17
|
include DataExplorer
|
17
18
|
|
18
|
-
config :output_dir, nil, &c.string_or_nil # the output dir
|
19
|
-
|
19
|
+
config :output_dir, nil, &c.string_or_nil # the output dir
|
20
|
+
|
21
|
+
def updated_files
|
22
|
+
@updated_files ||= []
|
23
|
+
end
|
24
|
+
|
25
|
+
def call(*args)
|
26
|
+
@updated_files = []
|
27
|
+
|
28
|
+
results = super
|
29
|
+
close_data_explorer
|
30
|
+
|
31
|
+
# Ensure de has time to close, then make sure all the output files are dated later than the inputs
|
32
|
+
# This rigmarole is necessary because the output file is created while the input file is open in
|
33
|
+
# DataExplorer, and apparently DataExplorer doesn't release the file until it completely exits.
|
34
|
+
sleep 1 unless @updated_files.empty?
|
35
|
+
@updated_files.each {|file| FileUtils.touch(file) }
|
36
|
+
@updated_files = nil
|
37
|
+
results
|
38
|
+
end
|
39
|
+
|
20
40
|
def process(*input_files)
|
21
|
-
@updated_files = []
|
22
41
|
input_files.collect do |input_file|
|
23
|
-
check_terminate
|
42
|
+
app.check_terminate
|
24
43
|
|
25
44
|
output_file = if output_dir
|
26
45
|
File.join(output_dir, basename(input_file, ".txt"))
|
@@ -51,25 +70,13 @@ module Ms
|
|
51
70
|
# TODO -- add debug logging for this...
|
52
71
|
end
|
53
72
|
|
54
|
-
|
73
|
+
updated_files << output_file
|
55
74
|
end
|
56
75
|
|
57
76
|
output_file
|
58
77
|
end
|
59
78
|
end
|
60
79
|
|
61
|
-
protected
|
62
|
-
|
63
|
-
def after_execute
|
64
|
-
close_data_explorer
|
65
|
-
|
66
|
-
# Ensure de has time to close, then make sure all the output files are dated later than the inputs
|
67
|
-
# This rigmarole is necessary because the output file is created while the input file is open in
|
68
|
-
# DataExplorer, and apparently DataExplorer doesn't release the file until it completely exits.
|
69
|
-
sleep 1 unless @updated_files.empty?
|
70
|
-
@updated_files.each {|file| FileUtils.touch(file) }
|
71
|
-
@updated_files = nil
|
72
|
-
end
|
73
80
|
end
|
74
81
|
end
|
75
82
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bahuvrihi-ms-data_explorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Chiang
|
@@ -9,20 +9,42 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-04-08 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: tap
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
|
-
- -
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.17.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: tap-tasks
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.0
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: tap-test
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
21
42
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
43
|
+
version: 0.1.0
|
23
44
|
version:
|
24
45
|
- !ruby/object:Gem::Dependency
|
25
46
|
name: mspire
|
47
|
+
type: :runtime
|
26
48
|
version_requirement:
|
27
49
|
version_requirements: !ruby/object:Gem::Requirement
|
28
50
|
requirements:
|