/usr/share/perl5/KronaTools/scripts/indexGIs.pl is in radiant 2.7+dfsg-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/env perl
# converts the large text files into uniform records so they can be randomly
# accessed instead of slow serial searches
my ($taxonomy) = @ARGV;
use strict;
indexGI();
sub indexGI
{
# GIs are unique across nucleotide and protein records, so we want to
# combine the taxid lists into one file in which each taxid is a 4 byte
# field and missing GIs have blank fields to preserve position.
my ($file) = @_;
open NUC, "<$taxonomy/gi_taxid_nucl.dmp" or die $!;
open PRO, "<$taxonomy/gi_taxid_prot.dmp" or die $!;
open OUT, ">$taxonomy/gi_taxid.dat" or die $!;
my $lastGI = -1;
my $giNuc;
my $giPro;
my $taxIDNuc;
my $taxIDPro;
# initalize records
#
($giNuc, $taxIDNuc) = getRecord(\*NUC);
($giPro, $taxIDPro) = getRecord(\*PRO);
while ( defined $giNuc || defined $giPro )
{
my $gi;
my $taxID;
# Use the record with the smallest gi and advance to the next record
# from its file.
#
if ( ! defined $giPro || defined $giNuc && $giNuc < $giPro )
{
$gi = $giNuc;
$taxID = $taxIDNuc;
($giNuc, $taxIDNuc) = getRecord(\*NUC);
}
else
{
$gi = $giPro;
$taxID = $taxIDPro;
($giPro, $taxIDPro) = getRecord(\*PRO);
}
# fill in GIs that weren't listed with 0s
#
for ( my $i = $lastGI + 1; $i < $gi; $i++ )
{
print OUT pack "L", 0;
}
print OUT pack "L", int($taxID);
$lastGI = $gi;
}
close OUT;
close PRO;
close NUC;
}
sub getRecord
{
my $fh = shift;
return split /\t/, <$fh>;
}
|