forked from valflanza/nurig
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNuRIG.pl
More file actions
executable file
·92 lines (71 loc) · 2.2 KB
/
NuRIG.pl
File metadata and controls
executable file
·92 lines (71 loc) · 2.2 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/perl
use Cwd 'abs_path';
use Statistics::R;
use strict;
use Getopt::Long;
my $ref;
my $outFile;
my $table;
my $palette;
my $W;
my $H;
my $format;
my $PATH;
my $R;
my $cmdLista;
my $annot = undef;
my @Options;
@Options = (
{OPT=>"ref=s", VAR=>\$ref, DESC=>"Reference Genome"},
{OPT=>"out=s", VAR=>\$outFile, DEFAULT => 'out', DESC=>"Image- filename"},
{OPT=>"list=s", VAR=>\$table, DESC=>"list with query genome files"},
{OPT=>"annot=s", VAR=>\$annot, DESC=>"Annotation file"},
{OPT=>"palette=s", VAR=>\$palette, DEFAULT => 'rainbow', DESC=>"Color palette for figure (rainbow, topo, terrain, distinc (Requires randomcolorR package)"},
{OPT=>"W=i", VAR=>\$W, DEFAULT => '1000', DESC=>"Image weight"},
{OPT=>"H=i", VAR=>\$H, DEFAULT => '1000', DESC=>"Image height"},
{OPT=>"format=s", VAR=>\$format, DEFAULT => 'SVG', DESC=>"Output format image (JPG,PNG,SVG,SVGZ)"}
);
#Check options and set variables
(@ARGV < 1) && (usage());
GetOptions(map {$_->{OPT}, $_->{VAR}} @Options) || usage();
# Now setup default values.
foreach (@Options) {
if (defined($_->{DEFAULT}) && !defined(${$_->{VAR}})) {
${$_->{VAR}} = $_->{DEFAULT};
}
}
unless($ref){
print STDERR "You must specified a reference genome file\n";
&usage();
}
unless($table){
print STDERR "You must specified table genomes file\n";
&usage();
}
$PATH = abs_path($0);
$PATH =~ s/\/NuRIG.pl//;
$R = Statistics::R->new(shared => 1);
$R->start();
$R->set('ref',$ref);
if($annot)
{
$R->set('annotFile',$annot);
}
$R->set('listFile',$table);
$R->set('palette_color',$palette);
$R->run_from_file("$PATH/lib/NuRIG.R");
$R-> stop();
system("java -jar $PATH/bin/cgview/cgview.jar -i out.xml -o $outFile.$format -f $format -W $W -H $H");
sub usage {
print "Usage:\n\n";
print "Nucmer Ring Image Generator (NuRIG) BETA-Version\n";
print "writen by: Val F. Lanza (valfernandez.vf\@gmail.com)\n\n";
print "NuRIG.pl --ref reference.fasta --list list.txt --annot AnnotationFile.tab --out image.svg --palette rainbow --W 1000 --H 1000 --format SVG\n";
print "\nParameters:\n\n";
foreach (@Options) {
printf " --%-13s %s%s.\n",$_->{OPT},$_->{DESC},
defined($_->{DEFAULT}) ? " (default '$_->{DEFAULT}')" : "";
}
print "\n\n\n";
exit(1);
}