forked from boutroslab/nextrnai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnextrnai_wrapper.pl
executable file
·50 lines (39 loc) · 1.01 KB
/
nextrnai_wrapper.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#/usr/bin/perl
use strict;
use Getopt::Long;
use File::Temp;
my $cmd;
#debug
my $debug = 0;
#parameters
my $probe_name;
my $output;
#
Getopt::Long::Configure ("pass_through");
my $result = GetOptions(
'output=s' => \$output,
'name=s' => \$probe_name,
);
#run next rnai script with temp folder
my $tmp_output = $output."_results";
if (-e $tmp_output){
if( unlink($tmp_output) != 0){
die "Error, tmp output directory exists and cannot be deleted";
}
}
$cmd = "perl /software/bin/nextrnai.pl @ARGV -n $probe_name --output $tmp_output >/home/galaxy/galaxy_dist/logs/nextrnai.log 2>/home/galaxy/galaxy_dist/logs/nextrnai.err";
#print $output,"\n";
print $cmd,"\n" if $debug;
system($cmd);
#copy the tar.gz file and replace the output file with it
$cmd = "cp ".$tmp_output."/".$probe_name.".tar.gz"." $output";
print $cmd,"\n" if $debug;
system($cmd);
#clean up the temp file
if( -e $tmp_output){
$cmd = "rm -r $tmp_output";
print $cmd,"\n" if $debug;
system($cmd);
}
print "PLEASE DOWNLOAD THE RESULTS!\n";
exit;