[Bioperl-guts-l] [15037] bioperl-live/trunk/t: move into directory structure

Christopher John Fields cjfields at dev.open-bio.org
Thu Nov 27 23:50:18 EST 2008


Revision: 15037
Author:   cjfields
Date:     2008-11-27 23:50:18 -0500 (Thu, 27 Nov 2008)

Log Message:
-----------
move into directory structure

Added Paths:
-----------
    bioperl-live/trunk/t/SearchIO/
    bioperl-live/trunk/t/SearchIO/SearchIO.t
    bioperl-live/trunk/t/SearchIO/Writer/
    bioperl-live/trunk/t/SearchIO/Writer/HTMLWriter.t
    bioperl-live/trunk/t/SearchIO/Writer/HitTableWriter.t
    bioperl-live/trunk/t/SearchIO/blast.t
    bioperl-live/trunk/t/SearchIO/blast_pull.t
    bioperl-live/trunk/t/SearchIO/blasttable.t
    bioperl-live/trunk/t/SearchIO/blastxml.t
    bioperl-live/trunk/t/SearchIO/cross_match.t
    bioperl-live/trunk/t/SearchIO/erpin.t
    bioperl-live/trunk/t/SearchIO/exonerate.t
    bioperl-live/trunk/t/SearchIO/fasta.t
    bioperl-live/trunk/t/SearchIO/hmmer.t
    bioperl-live/trunk/t/SearchIO/hmmer_pull.t
    bioperl-live/trunk/t/SearchIO/infernal.t
    bioperl-live/trunk/t/SearchIO/megablast.t
    bioperl-live/trunk/t/SearchIO/psl.t
    bioperl-live/trunk/t/SearchIO/rnamotif.t
    bioperl-live/trunk/t/SearchIO/sim4.t
    bioperl-live/trunk/t/SearchIO/waba.t
    bioperl-live/trunk/t/SearchIO/wise.t

Removed Paths:
-------------
    bioperl-live/trunk/t/SearchIO.t
    bioperl-live/trunk/t/SearchIO_HTMLWriter.t
    bioperl-live/trunk/t/SearchIO_HitTableWriter.t
    bioperl-live/trunk/t/SearchIO_blast.t
    bioperl-live/trunk/t/SearchIO_blast_pull.t
    bioperl-live/trunk/t/SearchIO_blasttable.t
    bioperl-live/trunk/t/SearchIO_blastxml.t
    bioperl-live/trunk/t/SearchIO_cross_match.t
    bioperl-live/trunk/t/SearchIO_erpin.t
    bioperl-live/trunk/t/SearchIO_exonerate.t
    bioperl-live/trunk/t/SearchIO_fasta.t
    bioperl-live/trunk/t/SearchIO_hmmer.t
    bioperl-live/trunk/t/SearchIO_hmmer_pull.t
    bioperl-live/trunk/t/SearchIO_infernal.t
    bioperl-live/trunk/t/SearchIO_megablast.t
    bioperl-live/trunk/t/SearchIO_psl.t
    bioperl-live/trunk/t/SearchIO_rnamotif.t
    bioperl-live/trunk/t/SearchIO_sim4.t
    bioperl-live/trunk/t/SearchIO_waba.t
    bioperl-live/trunk/t/SearchIO_wise.t

Copied: bioperl-live/trunk/t/SearchIO/SearchIO.t (from rev 15035, bioperl-live/trunk/t/SearchIO.t)
===================================================================
--- bioperl-live/trunk/t/SearchIO/SearchIO.t	                        (rev 0)
+++ bioperl-live/trunk/t/SearchIO/SearchIO.t	2008-11-28 04:50:18 UTC (rev 15037)
@@ -0,0 +1,39 @@
+# -*-Perl-*- Test Harness script for Bioperl
+# $Id$
+
+use strict;
+
+BEGIN {
+	use lib 't/lib';
+    use BioperlTest;
+    
+    test_begin(-tests => 19);
+	
+	use_ok('Bio::SearchIO');
+}
+
+# only methods defined in Bio::SearchIO should be tested here; all
+# parsers should have their own separate SearchIO_*.t test file
+
+# Let's test if _guess_format is doing its job correctly
+my %pair = ( 'filename.blast'  => 'blast',
+	     'filename.bls'    => 'blast',
+	     'f.blx'           => 'blast',
+	     'f.tblx'          => 'blast',
+	     'fast.bls'        => 'blast',
+	     'f.fasta'         => 'fasta',
+	     'f.fa'            => 'fasta',
+	     'f.fx'            => 'fasta',
+	     'f.fy'            => 'fasta',
+	     'f.ssearch'       => 'fasta',
+	     'f.SSEARCH.m9'    => 'fasta',
+	     'f.m9'            => 'fasta',
+	     'f.psearch'       => 'fasta',
+	     'f.osearch'       => 'fasta',
+	     'f.exon'          => 'exonerate',
+	     'f.exonerate'     => 'exonerate',
+	     'f.blastxml'      => 'blastxml',
+	     'f.xml'           => 'blastxml');
+while( my ($file,$expformat) = each %pair ) {
+    is(Bio::SearchIO->_guess_format($file),$expformat, "$expformat for $file");
+}

Copied: bioperl-live/trunk/t/SearchIO/Writer/HTMLWriter.t (from rev 15035, bioperl-live/trunk/t/SearchIO_HTMLWriter.t)
===================================================================
--- bioperl-live/trunk/t/SearchIO/Writer/HTMLWriter.t	                        (rev 0)
+++ bioperl-live/trunk/t/SearchIO/Writer/HTMLWriter.t	2008-11-28 04:50:18 UTC (rev 15037)
@@ -0,0 +1,38 @@
+# -*-Perl-*- Test Harness script for Bioperl
+# $Id: SearchIO_HTMLWriter.t 14995 2008-11-16 06:20:00Z cjfields $
+
+use strict;
+
+BEGIN {
+    use lib 't/lib';
+    use BioperlTest;
+    
+    test_begin(-tests => 8);
+    
+    use_ok('Bio::SearchIO');
+    use_ok('Bio::SearchIO::Writer::HTMLResultWriter');
+}
+
+my ($searchio, $result,$iter,$hit,$hsp);
+
+$searchio = Bio::SearchIO->new('-format' => 'blast',
+                   '-file'   => test_input_file('HUMBETGLOA.tblastx'));
+
+$result = $searchio->next_result;
+
+isa_ok($result,'Bio::Search::Result::ResultI');
+$hit = $result->next_hit;
+is($hit->accession, 'AE000479');
+is($hit->bits, 33.6);
+$hsp = $hit->next_hsp;
+is($hit->hsp->bits,$hsp->bits);
+isa_ok($hsp->get_aln,'Bio::Align::AlignI');
+
+my $outfile = test_output_file();
+my $writerhtml = Bio::SearchIO::Writer::HTMLResultWriter->new();
+my $outhtml = Bio::SearchIO->new(-writer => $writerhtml,
+                -file   => ">$outfile");
+$outhtml->write_result($result, 1);
+ok(-s $outfile);
+
+# tests checking HTML file output?

Copied: bioperl-live/trunk/t/SearchIO/Writer/HitTableWriter.t (from rev 15035, bioperl-live/trunk/t/SearchIO_HitTableWriter.t)
===================================================================
--- bioperl-live/trunk/t/SearchIO/Writer/HitTableWriter.t	                        (rev 0)
+++ bioperl-live/trunk/t/SearchIO/Writer/HitTableWriter.t	2008-11-28 04:50:18 UTC (rev 15037)
@@ -0,0 +1,48 @@
+# -*-Perl-*- Test Harness script for Bioperl
+# $Id: SearchIO_HitTableWriter.t 14995 2008-11-16 06:20:00Z cjfields $
+
+use strict;
+
+BEGIN {
+    use lib 't/lib';
+    use BioperlTest;
+    
+    test_begin(-tests => 8);
+    
+    use_ok('Bio::SearchIO');
+    use_ok('Bio::SearchIO::Writer::HitTableWriter');
+}
+
+my ($searchio, $result, $hit, $hsp);
+
+$searchio = Bio::SearchIO->new('-format' => 'blast',
+    '-file'   => test_input_file('HUMBETGLOA.tblastx'));
+
+$result = $searchio->next_result;
+
+isa_ok($result,'Bio::Search::Result::ResultI');
+$hit = $result->next_hit;
+is($hit->accession, 'AE000479');
+is($hit->bits, 33.6);
+$hsp = $hit->next_hsp;
+is($hit->hsp->bits,$hsp->bits);
+isa_ok($hsp->get_aln,'Bio::Align::AlignI');
+
+my $writer = Bio::SearchIO::Writer::HitTableWriter->new( 
+    -columns => [qw(query_name
+                    query_length
+                    hit_name
+                    hit_length
+                    bits
+                    score
+                    frac_identical_query
+                    expect
+                    )]  );
+
+my $outfile = test_output_file();
+my $out = Bio::SearchIO->new(-writer => $writer,
+             -file   => ">$outfile");
+$out->write_result($result, 1);
+ok(-s $outfile);
+
+# tests checking file output?

Copied: bioperl-live/trunk/t/SearchIO/blast.t (from rev 15035, bioperl-live/trunk/t/SearchIO_blast.t)
===================================================================
--- bioperl-live/trunk/t/SearchIO/blast.t	                        (rev 0)
+++ bioperl-live/trunk/t/SearchIO/blast.t	2008-11-28 04:50:18 UTC (rev 15037)
@@ -0,0 +1,1582 @@
+# -*-Perl-*- Test Harness script for Bioperl
+# $Id: SearchIO_blast.t 14995 2008-11-16 06:20:00Z cjfields $
+
+use strict;
+
+BEGIN {
+	use lib 't/lib';
+    use BioperlTest;
+    
+    test_begin(-tests => 1089);
+	
+	use_ok('Bio::SearchIO');
+}
+
+my ($searchio, $result,$iter,$hit,$hsp);
+
+$searchio = Bio::SearchIO->new('-format' => 'blast',
+		'-file'   => test_input_file('ecolitst.bls'));
+
+$result = $searchio->next_result;
+
+is($result->database_name, 'ecoli.aa', 'database_name()');
+is($result->database_entries, 4289);
+is($result->database_letters, 1358990);
+
+is($result->algorithm, 'BLASTP');
+like($result->algorithm_version, qr/^2\.1\.3/);
+like($result->query_name, qr/gi|1786183|gb|AAC73113.1| (AE000111) aspartokinase I,\s+homoserine dehydrogenase I [Escherichia coli]/);
+is($result->query_accession, 'AAC73113.1');
+is($result->query_gi, 1786183);
+is($result->query_length, 820);
+is($result->get_statistic('kappa'), '0.135');
+is($result->get_statistic('kappa_gapped'), '0.0410');
+is($result->get_statistic('lambda'), '0.319');
+is($result->get_statistic('lambda_gapped'), '0.267');
+is($result->get_statistic('entropy'), '0.383');
+is($result->get_statistic('entropy_gapped'), '0.140');
+
+is($result->get_statistic('dbletters'), 1358990);
+is($result->get_statistic('dbentries'), 4289);
+is($result->get_statistic('effective_hsplength'), 47);
+is($result->get_statistic('effectivespace'), 894675611);
+is($result->get_parameter('matrix'), 'BLOSUM62');
+is($result->get_parameter('gapopen'), 11);
+is($result->get_parameter('gapext'), 1);
+is($result->get_statistic('S2'), '92');
+is($result->get_statistic('S2_bits'), '40.0');
+is($result->get_parameter('expect'), '1.0e-03');
+is($result->get_statistic('num_extensions'), '82424');
+
+
+my @valid = ( [ 'gb|AAC73113.1|', 820, 'AAC73113', '0', 1567, 4058],
+	      [ 'gb|AAC76922.1|', 810, 'AAC76922', '1e-91', 332, 850],
+	      [ 'gb|AAC76994.1|', 449, 'AAC76994', '3e-47', 184, 467]);
+my $count = 0;
+while( $hit = $result->next_hit ) {
+    my $d = shift @valid;
+
+    is($hit->name, shift @$d);
+    is($hit->length, shift @$d);
+    is($hit->accession, shift @$d);
+    is(sprintf("%g",$hit->significance), sprintf("%g",shift @$d) );
+    is($hit->bits, shift @$d );
+    is($hit->raw_score, shift @$d );
+
+    if( $count == 0 ) {
+        my $hsps_left = 1;
+        while( my $hsp = $hit->next_hsp ) {
+            is($hsp->query->start, 1);
+            is($hsp->query->end, 820);
+            is($hsp->hit->start, 1);
+            is($hsp->hit->end, 820);
+            is($hsp->length('total'), 820);
+            is($hsp->start('hit'), $hsp->hit->start);
+            is($hsp->end('query'), $hsp->query->end);
+            is($hsp->strand('sbjct'), $hsp->subject->strand);# alias for hit
+            is($hsp->evalue, '0.0');
+            is($hsp->score, 4058);
+            is($hsp->bits,1567);	    	    
+            is(sprintf("%.2f",$hsp->percent_identity), 98.29);
+            is(sprintf("%.4f",$hsp->frac_identical('query')), 0.9829);
+            is(sprintf("%.4f",$hsp->frac_identical('hit')), 0.9829);
+            is($hsp->gaps, 0);
+            $hsps_left--;
+        }
+        is($hsps_left, 0);
+    }
+    last if( $count++ > @valid );
+}
+is(@valid, 0);
+
+$searchio = Bio::SearchIO->new('-format' => 'blast',
+			       '-file'   => test_input_file('ecolitst.wublastp'));
+
+$result = $searchio->next_result;
+
+is($result->database_name, 'ecoli.aa');
+is($result->database_letters, 1358990);
+is($result->database_entries, 4289);
+is($result->algorithm, 'BLASTP');
+like($result->algorithm_version, qr/^2\.0MP\-WashU/);
+like($result->query_name, qr/gi|1786183|gb|AAC73113.1| (AE000111) aspartokinase I,\s+homoserine dehydrogenase I [Escherichia coli]/);
+is($result->query_accession, 'AAC73113.1');
+
+is($result->query_length, 820);
+is($result->query_gi, 1786183);
+is($result->get_statistic('kappa'), 0.136);
+is($result->get_statistic('lambda'), 0.319);
+is($result->get_statistic('entropy'), 0.384);
+is($result->get_statistic('dbletters'), 1358990);
+is($result->get_statistic('dbentries'), 4289);
+is($result->get_parameter('matrix'), 'BLOSUM62');
+is($result->get_statistic('Frame+0_lambda_used'), '0.319');
+is($result->get_statistic('Frame+0_kappa_used'), '0.136');
+is($result->get_statistic('Frame+0_entropy_used'), '0.384');
+
+is($result->get_statistic('Frame+0_lambda_computed'), '0.319');
+is($result->get_statistic('Frame+0_kappa_computed'), '0.136');
+is($result->get_statistic('Frame+0_entropy_computed'), '0.384');
+
+is($result->get_statistic('Frame+0_lambda_gapped'), '0.244');
+is($result->get_statistic('Frame+0_kappa_gapped'), '0.0300');
+is($result->get_statistic('Frame+0_entropy_gapped'), '0.180');
+
+ at valid = ( [ 'gb|AAC73113.1|', 820, 'AAC73113', '0', 4141],
+	   [ 'gb|AAC76922.1|', 810, 'AAC76922', '3.1e-86', 844],
+	   [ 'gb|AAC76994.1|', 449, 'AAC76994', '2.8e-47', 483]);
+$count = 0;
+while( $hit = $result->next_hit ) {
+    my $d = shift @valid;
+
+    if ($count==1) {
+        # Test HSP contig data returned by SearchUtils::tile_hsps()
+        # Second hit has two hsps that overlap.
+        my($qcontigs, $scontigs) = Bio::Search::SearchUtils::tile_hsps($hit);
+        # Query contigs

@@ Diff output truncated at 10000 characters. @@



More information about the Bioperl-guts-l mailing list