/usr/lib/cd-hit/cd-hit-div.pl is in cd-hit 4.5.7-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 | #!/usr/bin/perl
#not like cd-hit-div, this script do not sort input
#or throw away seq
$in = shift; $in or die "no input file";
$out = shift; $out or die "no output file";
$div = shift; $div or die "no div number";
@fhs = ();
for ($i=0; $i<$div; $i++) {
my $tf = "$out-$i";
$tfh = "FH". $i;
open($tfh, "> $tf") || die "can not open output files for write";
push(@fhs, $tfh);
}
open(TMP, $in) || die "can not open input file";
my $seq;
my $des;
my $no = 0;
while($ll = <TMP>) {
if ($ll =~ /^>/) {
if ($seq) {
$i = $no % $div;
$tfh = $fhs[$i];
$no++;
print $tfh $des, $seq;
}
$des = $ll;
$seq = "";
}
else {
$seq .= $ll;
}
}
if ($seq) {
$i = $no % $div;
$tfh = $fhs[$i];
$no++;
print $tfh $des, $seq;
}
close(TMP);
for ($i=0; $i<$div; $i++) {
$tfh = $fhs[$i];
close($tfh);
}
|