annotate wrapper_arpa.rb @ 1:2b93b36547ba draft default tip

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