/usr/share/ampliconnoise/Scripts/SubsampleDat.pl is in ampliconnoise 1.25-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 | #!/usr/bin/perl
my $datFile = shift;
my $N = shift;
my @lines = ();
my $total = 0;
my @id = ();
srand(78126723);
open(FILE, $datFile) or die "Can't open $datFile\n";
$line = <FILE>;
chomp($line);
($total, $M) = split(/ /,$line);
for($i = 0; $i < $total; $i++){
$line = <FILE>;
chomp($line);
push(@lines, $line);
}
close(FILE);
my @select = ();
for($i = 0; $i < $total; $i++){
$select[$i] = 0;
}
$i = 0;
while($i < $N){
my $random_number = int(rand($total));
while($select[$random_number] == 1){
$random_number = int(rand($total));
}
$select[$random_number] = 1;
$i++;
}
print "$N $M\n";
for($i = 0; $i < $total; $i++){
if($select[$i] == 1){
printf("$lines[$i]\n");
}
}
|