1
|
1 #!/usr/bin/env ruby
|
|
2 ##
|
|
3 ## Wrapper Arpa
|
|
4 ##
|
|
5 ## By: Isis Soledad, 2015
|
|
6 ##
|
|
7 ## Updates:
|
|
8 ## - Rodrigo Jardim, 206
|
|
9 ##
|
|
10
|
|
11 # ARGV[0] - Output File
|
|
12 # ARGV[1] - Input File in Fasta Format
|
|
13 # ARGV[2] - ARPA Complement Parameters
|
|
14 output = ARGV[0]
|
|
15 dirOut = "/tmp/arpa_#{Time.now.strftime("%Y%m%d%H%M%S")}"
|
|
16 file = ARGV[1]
|
|
17 params = ARGV[2]
|
|
18
|
|
19 # Create Output temporary dir
|
|
20 unless File.directory?(dirOut)
|
|
21 Kernel.system("mkdir #{dirOut}")
|
|
22 end
|
|
23
|
|
24 # Copy Input file to temporary dir
|
|
25 unless File.exist?("#{dirOut}/#{File.basename(file)}")
|
|
26 Kernel.system("cp #{file} #{dirOut}/#{File.basename(file)}.fasta")
|
|
27 end
|
|
28
|
|
29 #puts "python /usr/local/arpa/arpa.py #{params} -o #{dirOut} #{dirOut}/#{File.basename(file)}.fasta 1>/dev/null"
|
|
30
|
|
31 # Call OS process
|
|
32 Kernel.system("python /usr/local/arpa/arpa.py #{params} -o #{dirOut} #{dirOut}/#{File.basename(file)}.fasta 1>/dev/null")
|
|
33
|
|
34 # Copact temporary dir
|
|
35 Kernel.system("cd #{dirOut} && zip output.zip *"
|
|
36
|
|
37 # Copy compact file to output galaxy
|
|
38 Kernel.system("cp #{dirOut}/output.zip #{output}")
|
|
39
|
|
40 # Remove temporary dir
|
|
41 Kernel.system("rm -rf #{dirout}")
|