[Bio] / FigKernelScripts / FFB2_run_tests.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/FFB2_run_tests.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : olson 1.1 #
2 :     # Use the newly-generated Kmers to call genes in the
3 :     # set of test organisms that are kept in /vol/figfam-prod/test_genomes.
4 :     #
5 :     # Each test genome in the test directory has a single fasta file
6 :     # of its protein data named genomeid.peg.fasta.
7 :     #
8 :     # Write the output into figfamdir/tests/<genomeid.out>
9 :     #
10 :     # The output is the raw output of assign_using_kmers.
11 :     #
12 :    
13 :     use strict;
14 :     use FIG;
15 :     use FIG_Config;
16 :    
17 :     @ARGV == 1 or die "Usage: $0 figfam-dir\n";
18 :    
19 :     my $ffdir = shift;
20 :    
21 :     my @tests;
22 :    
23 :     my $seq_hit_threshold = 2;
24 :     my $score_threshold = 4;
25 :     my $thresh = "--seqHitThreshold $seq_hit_threshold --scoreThreshold $score_threshold";
26 :    
27 :     for my $file (</vol/figfam-prod/test_genomes/*.peg.fasta>)
28 :     {
29 :     my($genome) = $file =~ m,/(\d+\.\d+)\.peg\.fasta$,;
30 :     $genome or die "Invalid test data file $file\n";
31 :     push(@tests, [$genome, $file]);
32 :     }
33 :    
34 :     my $output_dir = "$ffdir/tests";
35 :     &FIG::verify_dir($output_dir);
36 :    
37 :     #
38 :     # Find the set of kmers we have.
39 :     #
40 :     opendir(D, "$ffdir/Merged") or die "cannot opendir $ffdir/Merged: $!";
41 :     my @kmers = sort { $a->[0] <=> $b->[0] } grep { $_->[0] =~ /^\d+/ && -f $_->[1] } map { [$_, "$ffdir/Merged/$_/table.binary" ] } readdir(D);
42 :     @kmers > 0 or die "No kmers found in $ffdir/Merged\n";
43 :    
44 :     print "testing kmers " . join(" ", map { $_->[0] } @kmers) . "\n";
45 :    
46 :     my $setI = "$ffdir/setI.db";
47 :     my $frI = "$ffdir/FRI.db";
48 :    
49 :     -f $setI or die "setI.db not found in $ffdir";
50 :     -f $frI or die "FRI.db not found in $ffdir";
51 :    
52 :     for my $kmerent (@kmers)
53 :     {
54 :     my($kmer, $kmer_data) = @$kmerent;
55 :    
56 :     my $koutdir = "$output_dir/$kmer";
57 :     &FIG::verify_dir($koutdir);
58 :    
59 :     system("cat $kmer_data > /dev/null &");
60 :     for my $test (@tests)
61 :     {
62 :     my($genome, $file) = @$test;
63 :    
64 :     print "Testing $genome with k=$kmer\n";
65 : olson 1.2
66 :     if (-f "$koutdir/$genome.out")
67 :     {
68 :     next;
69 :     }
70 : olson 1.1
71 :     my $cmd = "$FIG_Config::bin/assign_using_kmers $thresh --kmer $kmer $setI $frI $kmer_data < $file > $koutdir/$genome.out 2> $koutdir/$genome.err";
72 :     print "$cmd\n";
73 :     my $rc = system $cmd;
74 :     if ($rc != 0)
75 :     {
76 :     die "test failed with rc=$rc: $cmd\n";
77 :     }
78 : olson 1.2 $cmd = "cut -f1,2 $koutdir/$genome.out | $FIG_Config::bin/svr_metabolic_reconstruction > $koutdir/$genome.reconstruction 2> $koutdir/$genome.reconstruction.nomatch";
79 :     $rc = system $cmd;
80 :     if ($rc != 0)
81 :     {
82 :     die "test failed with rc=$rc: $cmd\n";
83 :     }
84 : olson 1.1 }
85 :    
86 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3