Root/old-boom/gen2chr

1#!/usr/bin/perl
2
3require "parser.pl";
4require "match.pl";
5
6
7sub translate
8{
9    local ($r) = @_;
10
11    undef %field;
12    $field{"REF"} = $r;
13    &match_set_error($r);
14    if (!&apply_rules()) {
15    print "$id{$r}\n" if $negate;
16    return;
17    }
18    return if $negate;
19    print $id{$r};
20    for (sort keys %field) {
21    next if $_ =~ /^_/;
22    next if $_ eq "REF";
23    print " $_=$field{$_}";
24    }
25    print "\n";
26}
27
28
29sub usage
30{
31    print STDERR "usage: $0 [-d|-n] key file ...\n";
32    print STDERR " $0 -q query file ...\n";
33    exit(1);
34}
35
36while ($ARGV[0] =~ /^-/) {
37    if ($ARGV[0] eq "-d") {
38    $debug = 1;
39    } elsif ($ARGV[0] eq "-n") {
40    $negate = 1;
41    } elsif ($ARGV[0] eq "-q") {
42    $query = 1;
43    } else {
44    &usage;
45    }
46    shift @ARGV;
47}
48
49$key = shift @ARGV;
50&usage unless defined $key;
51
52&parse;
53
54if ($query) {
55    $debug = 1;
56    &translate($key);
57    exit(0);
58}
59
60print "#CHR\n";
61for (keys %id) {
62    next unless $id{$_} eq "$key $_";
63    &translate($_);
64}
65

Archive Download this file

Branches:
master



interactive