#!/usr/bin/perl # cd /home/xiangyang/Desktop/P.stutzeri_genome/Blast_A1501 # perl Cluster_blast.pl /home/xiangyang/Desktop/P.stutzeri_genome/Blast_A1501/3793_genome.total > 3793_genome.shared # use strict; ################################################################################################################ my $infile=$ARGV[0]; open (INFILE, $infile); my %original; my @array; my @value; my $lines; my %result; my $test; my $test2; my $length; while (){ chomp; $line=$_; @array=split ',', $line; if ($array[2] >= "50%" and $array[6] >= "90%"){ $original{$array[0]}=$array[1]; } } ################################################################################################################ foreach my $key (keys %original) { if ( !exists $result{ $original{$key} } ) { $result{ $original{$key} } = $key; } } ################################################################################################################ foreach $test (keys %result) { # push @value,$test; foreach $test2 (keys %original){ if ($test eq $original{$test2}) { push @value, $test2;}else {next;} } $length=scalar @value; print "@value\n"; @value=(); }