-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathexblxsym.pl
More file actions
executable file
·43 lines (35 loc) · 885 Bytes
/
exblxsym.pl
File metadata and controls
executable file
·43 lines (35 loc) · 885 Bytes
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
#!/usr/bin/perl
use FileIndex;
$usage .= "$0 -- symmetrise asymmetric MSPcrunch data\n";
$usage .= "\n";
$usage .= "Usage: $0 <MSPcrunch file>\n";
$usage .= "\n";
$usage .= "Output is sorted by first sequence name *only*\n";
$usage .= "\n";
while (@ARGV) {
last unless $ARGV[0] =~ /^-/;
$opt = shift;
die "$usage\nUnknown option: $opt\n";
}
@ARGV==1 or die $usage;
($filename) = @ARGV;
$mspfile = FileIndex->new($filename);
$lines = $mspfile->lines();
for ($i=0;$i<$lines;$i++) {
$_ = $mspfile->getline($i);
@f = split;
push @{$indices{$f[4]}}, $i+1;
push @{$indices{$f[7]}}, -$i-1;
}
foreach $name (sort keys %indices) {
foreach $i (@{$indices{$name}}) {
if ($i > 0) {
$_ = $mspfile->getline($i-1);
print;
} else {
$_ = $mspfile->getline(-$i-1);
@f = split;
print join("\t",@f[0,1,5..7,2..4,8..$#f]),"\n";
}
}
}