#!/usr/bin/perl -w use strict; #open blastx output file my $file = shift @ARGV; #define variables my ($queryname, $temseq, $wormid, $geneano, $evalue); open (IN, "<$file"); #read in file while (my $line = ) { #pull out query name if ($line =~ /^Query=\s+(\d+)/) { $queryname = $1; } #pull out wormID and gene annotation elsif ($line =~ /^>/) { chomp ($line); $temseq = $line; #append the 2nd line with gene annotation $line = ; $temseq .= $line; if ($temseq =~ /^>(\S+)\s\S+\s\S+\s(.+)\sprotein/) { $wormid = $1; $geneano = $2; } } #pull out e-value and print if $e-value is less than 1e-10 elsif ($line =~ /Expect =\s(\S+),\sP/) { $evalue = $1; if ($evalue <= 1e-10) {print "$queryname, $wormid, $geneano, $evalue\n";} } } close IN;