# end
# end
- def run
- child_count = 0
-
- @files_fasta.each do |file|
- Thread.pass while child_count >= @cpus
- child_count += 1
-
- Thread.new do
- command = command_compile(file)
- system(command)
- raise PatScanError, "Command failed: #{command}" unless $?.success?
- child_count -= 1
- end
- end
- end
-
# def run
# child_count = 0
-# ch_mutex = Mutex.new
-# threads = []
#
# @files_fasta.each do |file|
# Thread.pass while child_count >= @cpus
-# ch_mutex.synchronize { child_count += 1 }
+# child_count += 1
#
-# threads << Thread.new do
+# Thread.new do
# command = command_compile(file)
# system(command)
# raise PatScanError, "Command failed: #{command}" unless $?.success?
-# ch_mutex.synchronize { child_count -= 1 }
+# child_count -= 1
# end
# end
-#
-# threads.each { |t| t.join }
# end
+ def run
+ child_count = 0
+ ch_mutex = Mutex.new
+ threads = []
+
+ @files_fasta.each do |file|
+ Thread.pass while child_count >= @cpus
+ ch_mutex.synchronize { child_count += 1 }
+
+ threads << Thread.new do
+ command = command_compile(file)
+ system(command)
+ raise PatScanError, "Command failed: #{command}" unless $?.success?
+ ch_mutex.synchronize { child_count -= 1 }
+ end
+ end
+
+ threads.each { |t| t.join }
+ end
+
def command_compile(file)
commands = []
commands << "nice -n 19"
options = Biopieces.options_parse(ARGV, casts)
-#tmpdir = Biopieces.mktmpdir
-tmpdir = "/home/maasha/Tyt"
+tmpdir = Biopieces.mktmpdir
file_records = File.join(tmpdir, "data.stream")
file_pattern = File.join(tmpdir, "pattern.txt")