findbestfromcogs.pl
findBestCOGs.pl
written by Haeyoung Jeong
#!/usr/bin/perl # while (<>) { chomp; my @data = split /,/, $_; push @{$perQuery{$data[0]}}, $_; $query{$data[0]} = ''; } foreach (sort keys %query) { if (scalar @{$perQuery{$_}} == 1) { print $perQuery{$_}->[0], ',none', "\n" if $perQuery{$_}->[0] =~ /,\-1$/; print $perQuery{$_}->[0], ',sinlge', "\n" if $perQuery{$_}->[0] =~ /COG\d{4}$/; } else { # multiple COGs assigned per a single query my @sorted = (); @sorted = map { $_->[0] } sort { $b->[5] <=> $a->[5] } map { [ $_, (split /,/) ] } @{$perQuery{$_}}; print $sorted[0], ',multi', "\n"; } }
findbestfromcogs.pl.txt · Last modified: 2021/03/17 13:09 by 127.0.0.1