rpipe 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/rpipe +2 -3
- data/lib/custom_methods/JohnsonMerit220Visit1Preproc.rb +1 -0
- data/lib/custom_methods/JohnsonMerit220Visit1Stats.rb +1 -0
- data/lib/default_methods/default_stats.rb +8 -2
- data/lib/generators/workflow_generator.rb +10 -4
- data/lib/global_additions.rb +6 -0
- data/lib/matlab_helpers/matlab_queue.rb +2 -1
- data/rpipe.gemspec +3 -3
- data/spec/generators/workflow_generator_spec.rb +1 -1
- data/spec/matlab_queue_spec.rb +2 -2
- data/spec/physio_spec.rb +29 -29
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/bin/rpipe
CHANGED
@@ -96,7 +96,7 @@ def run_with_logging(logfile_stem, options, &block)
|
|
96
96
|
teeout = Tee.new(out_logfile, :out, 'a')
|
97
97
|
teeerr = Tee.new(error_logfile, :err, 'a')
|
98
98
|
|
99
|
-
|
99
|
+
setup_runner_logger(command_logfile, teeout, teeerr, options)
|
100
100
|
|
101
101
|
begin
|
102
102
|
yield
|
@@ -112,13 +112,12 @@ def run_with_logging(logfile_stem, options, &block)
|
|
112
112
|
end
|
113
113
|
|
114
114
|
# Log Commands to a file and Output to stdout
|
115
|
-
def
|
115
|
+
def setup_runner_logger(command_logfile, teeout, teeerr, options)
|
116
116
|
console_pattern = "#{'*' * 10} %m [ %d ]"
|
117
117
|
$Log = Log4r::Logger.new('output')
|
118
118
|
$Log.level = Log4r::DEBUG
|
119
119
|
$Log.add Log4r::IOOutputter.new(:stdout, teeout, :formatter => FlashFormatter.new)
|
120
120
|
|
121
|
-
File.delete command_logfile if File.exist? command_logfile
|
122
121
|
$CommandLog = Log4r::Logger.new('command::output')
|
123
122
|
$CommandLog.add Log4r::FileOutputter.new(:file, :filename => command_logfile, :trunc => false, :formatter => Log4r::PatternFormatter.new(:pattern => "%m"))
|
124
123
|
$CommandLog.add Log4r::IOOutputter.new(:stdout, teeout, :formatter => FlashFormatter.new)
|
@@ -67,8 +67,14 @@ module DefaultStats
|
|
67
67
|
onsets_mat_files = []
|
68
68
|
wd = Dir.pwd
|
69
69
|
matching_directories = Dir.glob(responses['directory'])
|
70
|
-
|
71
|
-
|
70
|
+
|
71
|
+
case
|
72
|
+
when matching_directories.length == 0
|
73
|
+
raise(IOError, "Response directory #{responses['directory']} doesn't exist or isn't mounted.")
|
74
|
+
when matching_directories.length > 1
|
75
|
+
raise IOError, "Only one response directory currently accepted (matched directories: #{matching_directories.join(', ')})"
|
76
|
+
end
|
77
|
+
|
72
78
|
Dir.chdir matching_directories.first do
|
73
79
|
responses['logfiles'].each do |logfile|
|
74
80
|
# Either Strip off the prefix directly without changing the name...
|
@@ -18,7 +18,7 @@ require 'generators/stats_job_generator'
|
|
18
18
|
# - statsdir : A directory where stats will be saved. (This should be a final directory.)
|
19
19
|
|
20
20
|
class WorkflowGenerator < JobGenerator
|
21
|
-
attr_reader :spec
|
21
|
+
attr_reader :spec, :config
|
22
22
|
|
23
23
|
def initialize(rawdir, config = Hash.new)
|
24
24
|
config_defaults = {}
|
@@ -81,9 +81,15 @@ class WorkflowGenerator < JobGenerator
|
|
81
81
|
# Handle Directory Configuration and Defaults for orig, proc and stats dirs.
|
82
82
|
def configure_directories
|
83
83
|
processing_dir = @config['processing_dir']
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
if @config['directory_formats']
|
85
|
+
@spec['origdir'] = @config['origdir'] || parse_directory_format(@config['directory_formats']['origdir']) || File.join(processing_dir, @spec['subid'] + '_orig')
|
86
|
+
@spec['procdir'] = @config['procdir'] || parse_directory_format(@config['directory_formats']['procdir']) || File.join(processing_dir, @spec['subid'] + '_proc')
|
87
|
+
@spec['statsdir'] = @config['statsdir'] || parse_directory_format(@config['directory_formats']['statsdir']) || File.join(processing_dir, @spec['subid'] + '_stats')
|
88
|
+
else
|
89
|
+
@spec['origdir'] = @config['origdir'] || File.join(processing_dir, @spec['subid'] + '_orig')
|
90
|
+
@spec['procdir'] = @config['procdir'] || File.join(processing_dir, @spec['subid'] + '_proc')
|
91
|
+
@spec['statsdir'] = @config['statsdir'] || File.join(processing_dir, @spec['subid'] + '_stats')
|
92
|
+
end
|
87
93
|
end
|
88
94
|
|
89
95
|
# Replace a directory format string with respective values from the spec.
|
data/lib/global_additions.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'global_additions'
|
1
2
|
require 'default_logger'
|
2
3
|
|
3
4
|
# Maintain and run matlab commands and paths.
|
@@ -11,7 +12,7 @@ class MatlabQueue
|
|
11
12
|
@paths = []
|
12
13
|
@commands = []
|
13
14
|
@ml_command = "matlab -nosplash -nodesktop"
|
14
|
-
setup_logger
|
15
|
+
setup_logger unless defined?($Log)
|
15
16
|
end
|
16
17
|
|
17
18
|
def to_s
|
data/rpipe.gemspec
CHANGED
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rpipe}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristopher Kosmatka", "Erik Kastman"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-29}
|
13
13
|
s.description = %q{Neuroimaging preprocessing the Ruby way}
|
14
14
|
s.email = %q{kjkosmatka@gmail.com}
|
15
|
-
s.executables = ["
|
15
|
+
s.executables = ["swallow_batch_run.rb", "create_driver.rb", "rpipe"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
18
18
|
"README",
|
@@ -20,7 +20,7 @@ describe "Workflow Generator" do
|
|
20
20
|
"conditions"=> ["new_correct", "new_incorrect", "old_correct", "old_incorrect"],
|
21
21
|
"regressorsfiles"=> ["rp_amrt00000_EPI-fMRI-Task1.txt", "rp_amrt00000_EPI-fMRI-Task2.txt"],
|
22
22
|
"bold_reps"=>[164, 164],
|
23
|
-
"method" => "
|
23
|
+
"method" => "JohnsonMerit220Visit1Stats"
|
24
24
|
}
|
25
25
|
|
26
26
|
|
data/spec/matlab_queue_spec.rb
CHANGED
@@ -16,7 +16,7 @@ describe "Test Matlab Queue Operations" do
|
|
16
16
|
@q.commands << "2 + 3"
|
17
17
|
@q.length.should equal 2
|
18
18
|
|
19
|
-
@q.to_s.should == "1 + 2
|
19
|
+
@q.to_s.should == "1 + 2, 2 + 3"
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should add to the path" do
|
@@ -28,7 +28,7 @@ describe "Test Matlab Queue Operations" do
|
|
28
28
|
it "should generate a good string with paths and commands" do
|
29
29
|
@q.paths << File.dirname(__FILE__)
|
30
30
|
@q.commands << "1 + 2"
|
31
|
-
@q.to_s.should == "
|
31
|
+
@q.to_s.should == "1 + 2"
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should run matlab successfully." do
|
data/spec/physio_spec.rb
CHANGED
@@ -55,40 +55,40 @@ describe "Test Phyiosnoise" do
|
|
55
55
|
|
56
56
|
end
|
57
57
|
|
58
|
-
it "should create physionoise regressors from Cardiac and Respiration Data" do
|
59
|
-
Dir.chdir @recon_job.origdir do
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
Dir.compare_directories(@recon_job.origdir, @physionoise_fixture_dir).should be_true
|
58
|
+
it "should create physionoise regressors from Cardiac and Respiration Data" # do
|
59
|
+
# Dir.chdir @recon_job.origdir do
|
60
|
+
# @recon_job.create_physiosnoise_regressors(@scan_spec)
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# Dir.compare_directories(@recon_job.origdir, @physionoise_fixture_dir).should be_true
|
64
64
|
|
65
|
-
end
|
65
|
+
# end
|
66
66
|
|
67
|
-
it "should correctly build a spec for passing to physionoise" do
|
68
|
-
@recon_job.build_physionoise_run_spec(@scan_spec).should == @valid_physionoise_run_spec
|
69
|
-
end
|
67
|
+
it "should correctly build a spec for passing to physionoise" # do
|
68
|
+
# @recon_job.build_physionoise_run_spec(@scan_spec).should == @valid_physionoise_run_spec
|
69
|
+
# end
|
70
70
|
|
71
|
-
it "should correctly build a physionoise python command" do
|
72
|
-
@valid_physionoise_run_spec.each do |run|
|
73
|
-
|
74
|
-
end
|
75
|
-
end
|
71
|
+
it "should correctly build a physionoise python command" # do
|
72
|
+
# @valid_physionoise_run_spec.each do |run|
|
73
|
+
# puts Physionoise.build_run_cmd(run)
|
74
|
+
# end
|
75
|
+
# end
|
76
76
|
|
77
|
-
it "should build a 3dRetroicor string" do
|
78
|
-
valid_cmd = "3dretroicor -prefix ptask1.nii -card #{@runs_dir}/../cardiac/PPGData_epiRT_0211201009_21_22_80 -resp #{@runs_dir}/../cardiac/RESPData_epiRT_0211201009_21_22_80 task1.nii"
|
79
|
-
valid_outfile = "p#{@scan_spec['label']}.nii"
|
80
|
-
test_cmd, test_outfile = @recon_job.build_retroicor_cmd(@scan_spec['physio_files'], "#{@scan_spec['label']}.nii")
|
81
|
-
|
82
|
-
valid_cmd.should == test_cmd
|
83
|
-
valid_outfile.should == test_outfile
|
84
|
-
end
|
77
|
+
it "should build a 3dRetroicor string" # do
|
78
|
+
# valid_cmd = "3dretroicor -prefix ptask1.nii -card #{@runs_dir}/../cardiac/PPGData_epiRT_0211201009_21_22_80 -resp #{@runs_dir}/../cardiac/RESPData_epiRT_0211201009_21_22_80 task1.nii"
|
79
|
+
# valid_outfile = "p#{@scan_spec['label']}.nii"
|
80
|
+
# test_cmd, test_outfile = @recon_job.build_retroicor_cmd(@scan_spec['physio_files'], "#{@scan_spec['label']}.nii")
|
81
|
+
#
|
82
|
+
# valid_cmd.should == test_cmd
|
83
|
+
# valid_outfile.should == test_outfile
|
84
|
+
# end
|
85
85
|
|
86
|
-
it "should raise an error building a 3dRetroicor string if improperly configured" do
|
87
|
-
physio_files = @scan_spec['physio_files']
|
88
|
-
physio_files.delete(:cardiac_signal)
|
89
|
-
|
90
|
-
lambda {@recon_job.build_retroicor_cmd(physio_files, "#{@scan_spec['label']}.nii") }.should raise_error ScriptError, /Missing .* cardiac/
|
91
|
-
end
|
86
|
+
it "should raise an error building a 3dRetroicor string if improperly configured" # do
|
87
|
+
# physio_files = @scan_spec['physio_files']
|
88
|
+
# physio_files.delete(:cardiac_signal)
|
89
|
+
#
|
90
|
+
# lambda {@recon_job.build_retroicor_cmd(physio_files, "#{@scan_spec['label']}.nii") }.should raise_error ScriptError, /Missing .* cardiac/
|
91
|
+
# end
|
92
92
|
|
93
93
|
it "should raise an IOError building a 3dRetroicor string with bad files"
|
94
94
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristopher Kosmatka
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-29 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -81,9 +81,9 @@ dependencies:
|
|
81
81
|
description: Neuroimaging preprocessing the Ruby way
|
82
82
|
email: kjkosmatka@gmail.com
|
83
83
|
executables:
|
84
|
-
- rpipe
|
85
84
|
- swallow_batch_run.rb
|
86
85
|
- create_driver.rb
|
86
|
+
- rpipe
|
87
87
|
extensions: []
|
88
88
|
|
89
89
|
extra_rdoc_files:
|