0
|
1 #!/usr/bin/perl
|
|
2
|
|
3 use strict;
|
|
4 use warnings;
|
|
5
|
|
6 use FindBin;
|
|
7
|
|
8 print STDOUT "The tool script is called with:\n", join(" ", ($0, @ARGV)), "\n\n";
|
|
9
|
|
10 my ($idx, $in) = ("", "");
|
|
11 my $default_option = "-o bsf-call.out -W bsfwork";
|
|
12
|
|
13 my $tooldir = shift(@ARGV);
|
|
14 $tooldir = $FindBin::Bin;
|
|
15 $ENV{PATH} = "$tooldir/bin:" . $ENV{PATH};
|
|
16 my $reference_source = shift(@ARGV);
|
|
17 my $read_end = shift(@ARGV);
|
|
18 my $gslot = shift(@ARGV);
|
|
19 #$idx = "$tooldir/data/chrX.sub.fa";
|
|
20
|
|
21 if ($reference_source eq "indexed") {
|
|
22 $idx = shift(@ARGV);
|
|
23 }
|
|
24 elsif ($reference_source eq "history") {
|
|
25 my $own = shift(@ARGV);
|
|
26 $idx = "reference.fa";
|
|
27 &invoke_command("ln -s $own reference.fa");
|
|
28 }
|
|
29 else {
|
|
30 die "never reach here\n";
|
|
31 }
|
|
32
|
|
33 if ($read_end eq "single-end") {
|
|
34 $in = shift(@ARGV);
|
|
35 &invoke_command("$tooldir/bin/bsf-call $default_option -p $gslot $idx $in");
|
|
36 }
|
|
37 elsif ($read_end eq "paired-end") {
|
|
38 my $in1 = shift(@ARGV);
|
|
39 my $in2 = shift(@ARGV);
|
|
40 $in = $in1 . "," . $in2;
|
|
41 &invoke_command("$tooldir/bin/bsf-call $default_option -p $gslot $idx $in");
|
|
42 }
|
|
43 else {
|
|
44 die "never reach here\n";
|
|
45 }
|
|
46
|
|
47 sub invoke_command {
|
|
48 my ($command) = @_;
|
|
49 print "invoking: $command\n";
|
|
50 system($command);
|
|
51 }
|