[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.3 - (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 : olson 1.3 use Getopt::Long;
18 :    
19 :     my @kmers;
20 :     my $ordered = 0;
21 :    
22 :     my $rc = GetOptions("kmers=i" => \@kmers,
23 :     "ordered" => \$ordered);
24 :    
25 :     ($rc && @ARGV == 1) or die "Usage: $0 [-ordered] [-kmers k1 -kmers k2 ...] figfam-dir\n";
26 : olson 1.1
27 :     my $ffdir = shift;
28 :    
29 :     my @tests;
30 :    
31 :     my $seq_hit_threshold = 2;
32 : olson 1.3 my $score_threshold = 2;
33 :     my $thresh = "--scoreThreshold $score_threshold";
34 :     #my $thresh = "--seqHitThreshold $seq_hit_threshold --scoreThreshold $score_threshold";
35 :     $thresh .= " --orderConstraint" if $ordered;
36 : olson 1.1
37 :     for my $file (</vol/figfam-prod/test_genomes/*.peg.fasta>)
38 :     {
39 :     my($genome) = $file =~ m,/(\d+\.\d+)\.peg\.fasta$,;
40 :     $genome or die "Invalid test data file $file\n";
41 :     push(@tests, [$genome, $file]);
42 :     }
43 :    
44 :     my $output_dir = "$ffdir/tests";
45 :     &FIG::verify_dir($output_dir);
46 :    
47 :     #
48 :     # Find the set of kmers we have.
49 :     #
50 : olson 1.3 if (@kmers == 0)
51 :     {
52 :     opendir(D, "$ffdir/Merged") or die "cannot opendir $ffdir/Merged: $!";
53 :     @kmers = sort { $a <=> $b } grep { /^\d+$/ } readdir(D);
54 :     closedir(D);
55 :     }
56 :    
57 :     my @kmers = sort { $a->[0] <=> $b->[0] } grep { $_->[0] =~ /^\d+/ && -f $_->[1] } map { [$_, "$ffdir/Merged/$_/table.binary" ] } @kmers;
58 : olson 1.1 @kmers > 0 or die "No kmers found in $ffdir/Merged\n";
59 :    
60 :     print "testing kmers " . join(" ", map { $_->[0] } @kmers) . "\n";
61 :    
62 :     my $setI = "$ffdir/setI.db";
63 :     my $frI = "$ffdir/FRI.db";
64 :    
65 :     -f $setI or die "setI.db not found in $ffdir";
66 :     -f $frI or die "FRI.db not found in $ffdir";
67 :    
68 :     for my $kmerent (@kmers)
69 :     {
70 :     my($kmer, $kmer_data) = @$kmerent;
71 :    
72 :     my $koutdir = "$output_dir/$kmer";
73 :     &FIG::verify_dir($koutdir);
74 :    
75 :     system("cat $kmer_data > /dev/null &");
76 :     for my $test (@tests)
77 :     {
78 :     my($genome, $file) = @$test;
79 :    
80 :     print "Testing $genome with k=$kmer\n";
81 : olson 1.2
82 :     if (-f "$koutdir/$genome.out")
83 :     {
84 :     next;
85 :     }
86 : olson 1.1
87 :     my $cmd = "$FIG_Config::bin/assign_using_kmers $thresh --kmer $kmer $setI $frI $kmer_data < $file > $koutdir/$genome.out 2> $koutdir/$genome.err";
88 :     print "$cmd\n";
89 :     my $rc = system $cmd;
90 :     if ($rc != 0)
91 :     {
92 :     die "test failed with rc=$rc: $cmd\n";
93 :     }
94 : olson 1.2 $cmd = "cut -f1,2 $koutdir/$genome.out | $FIG_Config::bin/svr_metabolic_reconstruction > $koutdir/$genome.reconstruction 2> $koutdir/$genome.reconstruction.nomatch";
95 :     $rc = system $cmd;
96 :     if ($rc != 0)
97 :     {
98 :     die "test failed with rc=$rc: $cmd\n";
99 :     }
100 : olson 1.1 }
101 :    
102 :     }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3