#!/usr/bin/perl
use warnings;
use strict;
my $usage =<<USAGE;
Usage perl $0 file
USAGE
die $usage if
@argv <1;
my ($in) = @ARGV;
my %hash;
my @head;
my $out = "#ID\tFPKM>100\tFPKM>100 num\t10<FPKM<=100\t10<FPKM<=100 num\t3<=FPKM<=10\t3<=FPKM<=10 num\t0.5<FPKM<3\t0.5<FPKM<3 num\tFPKM<=0.5\tFPKM<=0.5 num\n";
open IN, $in or die "Error $in\n";
while (<IN>) {
chomp;
my
@璐村惂鐢ㄦ埛_00000eP馃惥 = split "\t",$_;
if ($_ =~ /^#/) {
@head = @a;
next;
}
for my $i ( 1 .. $#a ) {
if ($a[$i] > 100) {
#$hash{$a[0]}{'a'}++;
push @{$hash{$a[0]}{'a'}},$head[$i];
}
elsif ($a[$i] > 10 && $a[$i] <= 100) {
#$hash{$a[0]}{'b'}++;
push @{$hash{$a[0]}{'b'}},$head[$i];
}
elsif ($a[$i] >= 3 && $a[$i] <= 10) {
#$hash{$a[0]}{'c'}++;
push @{$hash{$a[0]}{'c'}},$head[$i];
}
elsif ($a[$i] > 0.5 && $a[$i] < 3) {
#$hash{$a[0]}{'d'}++;
push @{$hash{$a[0]}{'d'}},$head[$i];
}
elsif ($a[$i] <= 0.5) {
#$hash{$a[0]}{'e'}++;
push @{$hash{$a[0]}{'e'}},$head[$i];
}
}
$out .= "$a[0]";
for my $i ('a','b','c','d','e') {
my $num = 0;
my $sample = "";
if ($hash{$a[0]}{$i}) {
$num = @{$hash{$a[0]}{$i}};
$sample = join(",", @{$hash{$a[0]}{$i}});
}
$out .= "\t$sample\t$num";
}
$out .= "\n";
}
print $out;