#!/usr/bin/perl

# script to test if current version of find_species.pl subroutines are correct
#  run from protein sequences directory

use strict;
use warnings;

if(-e "$ENV{HOME}/scripts/jaiswallab/interactome_scripts/find_species.pl") {
	require "$ENV{HOME}/scripts/jaiswallab/interactome_scripts/find_species.pl";
}elsif(-e "$ENV{HOME}/bin/find_species.pl") {
	require "$ENV{HOME}/bin/find_species.pl";
}

my @file_array = qx(ls | grep -v ___ | grep -v bad_sequence);

for(my $i =0; $i<@file_array; $i++) {
	$file_array[$i] =~ s/\r//g;
	$file_array[$i] =~ s/\n//g;
	#print "$files[$i]\n";
}

foreach my $file (@file_array) {
	my $spec = find_species($file);
	
	my $line = qx(head -n 1 $file);
	chomp $line;
	
	my $gene = find_gene($line,$spec);
	
	print "$file\t\t$spec\t\t$gene\n";
}

print "\nIf this test didn't die with an error and looks correct, species and gene lookup is okay\n\n";

