File: mrunfile.pl

package info (click to toggle)
lagan 2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,360 kB
  • sloc: ansic: 8,542; perl: 7,732; cpp: 3,260; makefile: 85
file content (111 lines) | stat: -rwxr-xr-x 1,783 bytes parent folder | download | duplicates (3)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/perl

# This script requires the environment variables:
# LAGAN_DIR and VISTA_DIR

if (@ARGV < 1) {
    print ("usage:\n mrunfile.pl filename [-pairwise] [-vista]\n\n");
    exit(1);
}

($lagandir = $ENV{LAGAN_DIR}) or die "LAGAN_DIR not set";


$filename = $ARGV[0];
open(PARAMFILE, "$filename") || die "Could not open $filename.\n\n";

$pairwise = 0;
$dovista = 0;

for ($l=1; $l<@ARGV; $l++) {
    if ($ARGV[$l] eq "-pairwise") {
	$pairwise = 1;
    }
    elsif ($ARGV[$l] eq "-vista") {
	$dovista = 1;
    }
}

$i=0;
$j=0;
$k=0;
$filespec = 0;
while ($line = <PARAMFILE>) {
    chomp $line;
    if ((substr($line, 0, 1) ne "#") && ($line ne "")) {
	if (!$filespec) {
	    $seqfile = $line;
	    $filespec = 1;
	} elsif (substr($line,0,1) eq "-") {
	    if (substr($line,0,2) eq "--") {
		@vparams[$j++] = $line;
	    } else {
		@params[$i++] = $line;
	    }
	} else {
	    @seqs[$k++] = $line;
	}
    }
}

if ($lagandir eq "") {
    print ("Must specify environment variable LAGAN_DIR\n");
    exit(1);
}

if ($pairwise) {
    $mexecs = "mrunpairs.pl";
} else {
    $mexecs = "mrun.pl";
}

$mstr = "$lagandir/utils/$mexecs $seqfile";

foreach $s (@params) {
    $mstr = "$mstr $s"
}

foreach $s (@seqs) {
    $mstr = "$mstr $s"
}

foreach $s (@vparams) {
    $mstr = "$mstr $s"
}

print "$mstr\n";
`$mstr`;

if($dovista) {

    $prefix = substr $seqfile, 0, (rindex $filename, ".");
    $prefix = "$prefix\_";
    
    if ($pairwise) {
	$prefix="$prefix\pairwise\_";
    }
    
    $plotfile = "$prefix.plotfile";

    ($vistadir = $ENV{VISTA_DIR}) or die "VISTA_DIR not set";

    $vistastr = "$vistadir/RunVista $plotfile";
    print "$vistastr\n";
    if (!`$vistastr`) { print "\nVISTA failure...\n"; exit(1); }

}

print "\nmrunfile.pl -- end.\n\n";