[Bioperl-guts-l] [15035] bioperl-live/trunk/t: Big reorganization of SeqIO tests.

Dave Messina dave_messina at dev.open-bio.org
Thu Nov 27 11:48:02 EST 2008


Revision: 15035
Author:   dave_messina
Date:     2008-11-27 11:48:01 -0500 (Thu, 27 Nov 2008)

Log Message:
-----------
Big reorganization of SeqIO tests. Now each flavor of SeqIO has its own test file (if it didn't already). Where possible, test data files were renamed test.<module> e.g. test.fasta so that it's easy to locate them and future code refactoring is simplified.

Added Paths:
-----------
    bioperl-live/trunk/t/SeqIO/
    bioperl-live/trunk/t/SeqIO/abi.t
    bioperl-live/trunk/t/SeqIO/ace.t
    bioperl-live/trunk/t/SeqIO/agave.t
    bioperl-live/trunk/t/SeqIO/alf.t
    bioperl-live/trunk/t/SeqIO/asciitree.t
    bioperl-live/trunk/t/SeqIO/bsml.t
    bioperl-live/trunk/t/SeqIO/bsml_sax.t
    bioperl-live/trunk/t/SeqIO/chadoxml.t
    bioperl-live/trunk/t/SeqIO/chaos.t
    bioperl-live/trunk/t/SeqIO/chaosxml.t
    bioperl-live/trunk/t/SeqIO/ctf.t
    bioperl-live/trunk/t/SeqIO/embl.t
    bioperl-live/trunk/t/SeqIO/entrezgene.t
    bioperl-live/trunk/t/SeqIO/excel.t
    bioperl-live/trunk/t/SeqIO/exp.t
    bioperl-live/trunk/t/SeqIO/fasta.t
    bioperl-live/trunk/t/SeqIO/fastq.t
    bioperl-live/trunk/t/SeqIO/flybase_chadoxml.t
    bioperl-live/trunk/t/SeqIO/game.t
    bioperl-live/trunk/t/SeqIO/gcg.t
    bioperl-live/trunk/t/SeqIO/genbank.t
    bioperl-live/trunk/t/SeqIO/interpro.t
    bioperl-live/trunk/t/SeqIO/kegg.t
    bioperl-live/trunk/t/SeqIO/largefasta.t
    bioperl-live/trunk/t/SeqIO/lasergene.t
    bioperl-live/trunk/t/SeqIO/locuslink.t
    bioperl-live/trunk/t/SeqIO/metafasta.t
    bioperl-live/trunk/t/SeqIO/phd.t
    bioperl-live/trunk/t/SeqIO/pir.t
    bioperl-live/trunk/t/SeqIO/pln.t
    bioperl-live/trunk/t/SeqIO/qual.t
    bioperl-live/trunk/t/SeqIO/raw.t
    bioperl-live/trunk/t/SeqIO/scf.t
    bioperl-live/trunk/t/SeqIO/strider.t
    bioperl-live/trunk/t/SeqIO/swiss.t
    bioperl-live/trunk/t/SeqIO/tab.t
    bioperl-live/trunk/t/SeqIO/table.t
    bioperl-live/trunk/t/SeqIO/tigr.t
    bioperl-live/trunk/t/SeqIO/tigrxml.t
    bioperl-live/trunk/t/SeqIO/tinyseq.t
    bioperl-live/trunk/t/SeqIO/ztr.t
    bioperl-live/trunk/t/data/test.abi
    bioperl-live/trunk/t/data/test.ctf
    bioperl-live/trunk/t/data/test.exp
    bioperl-live/trunk/t/data/test.locuslink
    bioperl-live/trunk/t/data/test.phd
    bioperl-live/trunk/t/data/test.pln
    bioperl-live/trunk/t/data/test.tseq
    bioperl-live/trunk/t/data/test.tsv
    bioperl-live/trunk/t/data/test.xls
    bioperl-live/trunk/t/data/test.ztr

Removed Paths:
-------------
    bioperl-live/trunk/t/LocusLink.t
    bioperl-live/trunk/t/abi.t
    bioperl-live/trunk/t/ace.t
    bioperl-live/trunk/t/asciitree.t
    bioperl-live/trunk/t/bsml_sax.t
    bioperl-live/trunk/t/chaosxml.t
    bioperl-live/trunk/t/ctf.t
    bioperl-live/trunk/t/data/LL-sample.seq
    bioperl-live/trunk/t/data/NM_002253.tseq
    bioperl-live/trunk/t/data/kinases.tsv
    bioperl-live/trunk/t/data/kinases.xls
    bioperl-live/trunk/t/data/phredfile.phd
    bioperl-live/trunk/t/data/readtest.abi
    bioperl-live/trunk/t/data/readtest.ctf
    bioperl-live/trunk/t/data/readtest.exp
    bioperl-live/trunk/t/data/readtest.pln
    bioperl-live/trunk/t/data/readtest.ztr
    bioperl-live/trunk/t/embl.t
    bioperl-live/trunk/t/entrezgene.t
    bioperl-live/trunk/t/exp.t
    bioperl-live/trunk/t/fasta.t
    bioperl-live/trunk/t/game.t
    bioperl-live/trunk/t/gcg.t
    bioperl-live/trunk/t/genbank.t
    bioperl-live/trunk/t/interpro.t
    bioperl-live/trunk/t/kegg.t
    bioperl-live/trunk/t/largefasta.t
    bioperl-live/trunk/t/lasergene.t
    bioperl-live/trunk/t/metafasta.t
    bioperl-live/trunk/t/phd.t
    bioperl-live/trunk/t/pir.t
    bioperl-live/trunk/t/pln.t
    bioperl-live/trunk/t/qual.t
    bioperl-live/trunk/t/raw.t
    bioperl-live/trunk/t/scf.t
    bioperl-live/trunk/t/swiss.t
    bioperl-live/trunk/t/tab.t
    bioperl-live/trunk/t/table.t
    bioperl-live/trunk/t/tigrxml.t
    bioperl-live/trunk/t/tinyseq.t
    bioperl-live/trunk/t/ztr.t

Deleted: bioperl-live/trunk/t/LocusLink.t
===================================================================
--- bioperl-live/trunk/t/LocusLink.t	2008-11-26 21:15:41 UTC (rev 15034)
+++ bioperl-live/trunk/t/LocusLink.t	2008-11-27 16:48:01 UTC (rev 15035)
@@ -1,93 +0,0 @@
-# -*-Perl-*- Test Harness script for Bioperl
-# $Id$
-
-use strict;
-
-BEGIN {
-	use lib 't/lib';
-    use BioperlTest;
-    
-    test_begin(-tests => 25,
-               -requires_module => 'Graph::Directed');
-	
-	use_ok('Bio::SeqIO');
-	use_ok('Bio::SeqFeature::Generic');
-	use_ok('Bio::SeqFeature::AnnotationAdaptor');
-}
-
-my $seqin = Bio::SeqIO->new(-file => test_input_file('LL-sample.seq'),
-			    -format => 'locuslink');
-ok $seqin;
-my $seqout = Bio::SeqIO->new(-file => ">".test_output_file(),
-			     -format => 'embl');
-
-# process and write to output
-my @seqs = ();
-
-while(my $seq = $seqin->next_seq()) {
-    push(@seqs, $seq);
-    
-    # create an artificial feature to stick the annotation on
-    my $fea = Bio::SeqFeature::Generic->new(-start => 1, -end => 9999,
-					    -strand => 1,
-					    -primary => 'annotation');
-    my $ac = Bio::SeqFeature::AnnotationAdaptor->new(-feature => $fea);
-    foreach my $k ($seq->annotation->get_all_annotation_keys()) {
-	foreach my $ann ($seq->annotation->get_Annotations($k)) {
-	    next unless $ann->isa("Bio::Annotation::SimpleValue");
-	    $ac->add_Annotation($ann);
-	}
-    }
-    $seq->add_SeqFeature($fea);
-    $seqout->write_seq($seq);
-}
-
-is (scalar(@seqs), 2);
-
-is ($seqs[0]->desc,
-    "amiloride binding protein 1 (amine oxidase (copper-containing))");
-is ($seqs[0]->accession, "26");
-is ($seqs[0]->display_id, "ABP1");
-is ($seqs[0]->species->binomial, "Homo sapiens");
-
-
-my @dblinks = $seqs[0]->annotation->get_Annotations('dblink');
-my %counts = map { ($_->database(),0) } @dblinks;
-foreach (@dblinks) { $counts{$_->database()}++; }
-
-is ($counts{GenBank}, 11);
-is ($counts{RefSeq}, 4);
-is ($counts{UniGene}, 1);
-is ($counts{Pfam}, 1);
-is ($counts{STS}, 2);
-is ($counts{MIM}, 1);
-is ($counts{PUBMED}, 6);
-is (scalar(@dblinks), 27);
-
-is ($seqs[1]->desc, "v-abl Abelson murine leukemia viral oncogene homolog 2 (arg, Abelson-related gene)");
-is ($seqs[1]->display_id, "ABL2");
-
-my $ac = $seqs[1]->annotation;
-my @keys = $ac->get_all_annotation_keys();
-is (scalar(@keys), 19);
-
-my ($cmt) = $ac->get_Annotations('comment');
-is (length($cmt->text), 403);
-
-my @isoforms = qw(a b);
-foreach ($ac->get_Annotations('PRODUCT')) {
-    is ($_->value,
-	"v-abl Abelson murine leukemia viral oncogene homolog 2 isoform ".
-	shift(@isoforms));
-}
-
-my @goann = ();
-foreach my $k (@keys) {
-    foreach my $ann ($ac->get_Annotations($k)) {
-	next unless $ann->isa("Bio::Ontology::TermI");
-	push(@goann, $ann);
-    }
-}
-is (scalar(@goann), 4);
- at goann = sort { $a->as_text() cmp $b->as_text() } @goann;
-is ($goann[2]->as_text, "cellular component|cytoplasm|");

Copied: bioperl-live/trunk/t/SeqIO/abi.t (from rev 15029, bioperl-live/trunk/t/abi.t)
===================================================================
--- bioperl-live/trunk/t/SeqIO/abi.t	                        (rev 0)
+++ bioperl-live/trunk/t/SeqIO/abi.t	2008-11-27 16:48:01 UTC (rev 15035)
@@ -0,0 +1,29 @@
+# -*-Perl-*- Test Harness script for Bioperl
+# $Id$
+
+use strict;
+
+BEGIN {
+	use lib 't/lib';
+    use BioperlTest;
+    
+    test_begin(-tests => 7,
+			   -requires_module => 'Bio::SeqIO::staden::read 1.52');
+	
+	use_ok('Bio::SeqIO');
+}
+
+my $verbose = test_debug();
+
+my $io = Bio::SeqIO->new(-format => 'abi',
+								 -verbose => $verbose,
+								 -file => test_input_file('readtest.abi',),
+								 -get_trace_data => 1);
+my $seq = $io->next_seq;
+isa_ok($seq, 'Bio::PrimarySeqI');
+is($seq->seq, "GCNTATGACGTGGATTNCGAATTCTNNNNNCGGTAGNNGAAAATCCCCGGNCAAGNTTNNCCCTGCAAANGGAANAANNTGGCCGAGCGCTACGGGCTGATCTGGGTGTGCCTGTTTCCCCCGGCCGGGGGGAGNGATGCAGGACATCCAAGTATCCCGCCNATGGNGGGCTGAGGACGAGGACGGCTTCCATCAGATCAGTGTGCCCGGNCTTCGACATCGGCGGCAGCGCCGCGCGCCAACTGGAAGGCTTCATCGACGTGNAGCATTTTGNCTTCNTGCGCACCGCTACCTTCACCCANCCGGACAAGCGCNAANTGCNGNCCTACACCACCACNGAAACACCGACCGGNTTNAATGCCGATTACCTGAGNNGCGTGGCAAATTATTCGGNGGACNTGCCGCTGNCGGACGTGGACCCGAACTTCCAATGGCTGCGTCATTNCTAGGTGAATCTGCCTTTCACCGCCACGCTCACCATCCACTTCCCGGTGCCGGGCAAGCGGTTGGTGATNATGAATGCCGCCAGACCGGTGTCCAAGCACACCANCCGCCTGNTGGTGCCGATCGNCCGCTAATTTCGACACCCATCTGCCNGNGGGAAGACGTACATGNGTTCAACCTTGCACNTNGTTCNAAAAAAACCNTGCCATGGTGGNAANCGCAAGCGGNCCGGAAATATCNGCCGGNTTGACCCGCNTGNTTGGAAAGTGCATATTCCCCNCCGATNCNCAATTTCGAT");
+# trace data points, only added if get_trace_data is invoked
+is($seq->get_trace_graph( -trace => 'a' ), 8793); 
+is($seq->get_trace_graph( -trace => 't' ), 8793); 
+is($seq->get_trace_graph( -trace => 'g' ), 8793); 
+is($seq->get_trace_graph( -trace => 'c' ), 8793); 
\ No newline at end of file


Property changes on: bioperl-live/trunk/t/SeqIO/abi.t
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + "Author Date Id Rev URL"
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: bioperl-live/trunk/t/SeqIO/ace.t (from rev 15029, bioperl-live/trunk/t/ace.t)
===================================================================
--- bioperl-live/trunk/t/SeqIO/ace.t	                        (rev 0)
+++ bioperl-live/trunk/t/SeqIO/ace.t	2008-11-27 16:48:01 UTC (rev 15035)
@@ -0,0 +1,65 @@
+# -*-Perl-*- Test Harness script for Bioperl
+# $Id$
+
+use strict;
+
+BEGIN {
+	use lib 't/lib';
+    use BioperlTest;
+    
+    test_begin(-tests => 7);
+	
+	use_ok('Bio::SeqIO');
+}
+
+my $verbose = test_debug();
+
+my $t_file = test_input_file('test.ace');
+my( $before );
+{
+	local $/ = undef;
+	local *BEFORE;
+	open BEFORE, $t_file;
+	$before = <BEFORE>;
+	close BEFORE;
+}
+
+my $a_in = Bio::SeqIO->new( -FILE => $t_file,
+									 -verbose => $verbose,
+									 -FORMAT => 'ace');
+my( @a_seq );
+while (my $a = $a_in->next_seq) {
+	push(@a_seq, $a);
+}
+
+is @a_seq, 3, 'number of sequence objects';
+
+my $esc_name = $a_seq[1]->display_id;
+is( $esc_name , 'Name; 4% strewn with \ various / escaped characters',
+	 "unescaping of characters, $esc_name");
+
+is $a_seq[0]->alphabet, 'protein', 'alphabets detected';
+is $a_seq[1]->alphabet, 'dna', 'alphabets detected';
+
+my $o_file = test_output_file();
+my $a_out = Bio::SeqIO->new(-FILE => "> $o_file",
+									 -verbose => $verbose,
+									 -FORMAT => 'ace');
+my $a_out_ok = 1;
+foreach my $a (@a_seq) {
+	$a_out->write_seq($a) or $a_out_ok = 0;
+}
+undef($a_out);  # Flush to disk
+is $a_out_ok,1,'writing sequence';
+
+my( $after );
+{
+	local $/ = undef;
+	local *AFTER;
+	open AFTER, $o_file;
+	$after = <AFTER>;
+	close AFTER;
+}
+
+is( ($before and $after and ($before eq $after)),1,
+	 'test output');


Property changes on: bioperl-live/trunk/t/SeqIO/ace.t
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + "Author Date Id Rev URL"
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Added: bioperl-live/trunk/t/SeqIO/agave.t
===================================================================
--- bioperl-live/trunk/t/SeqIO/agave.t	                        (rev 0)
+++ bioperl-live/trunk/t/SeqIO/agave.t	2008-11-27 16:48:01 UTC (rev 15035)
@@ -0,0 +1,47 @@
+# -*-Perl-*- Test Harness script for Bioperl
+# $Id$
+
+use strict;
+
+BEGIN {
+	use lib 't/lib';
+    use BioperlTest;
+    
+    test_begin(-tests               => 8,
+			   -requires_modules    => [],
+			   -requires_networking => 0,
+			  );
+	
+	use_ok('Bio::SeqIO::agave');
+}
+
+my $verbose = test_debug();
+
+TODO: {
+	my $format = 'agave';
+	todo_skip "No tests for $format format -- no sample file to test against", 7, if 1;
+
+	my $seqio_obj = Bio::SeqIO->new(-file   => test_input_file("test.$format"),
+							        -format => $format);
+	
+	isa_ok($seqio_obj, 'Bio::SeqIO');
+	
+	my @methods = qw(next_seq write_seq);
+	foreach my $method (@methods) {
+		can_ok($seqio_obj, $method) || 
+			diag "$method method not implemented for $format";	
+	}
+	
+	# checking the first sequence object
+	my $seq_obj = $seqio_obj->next_seq();
+	isa_ok($seq_obj, 'Bio::Seq');
+	my %expected = ('seq'         => '' .
+					'length'      => '',
+					'primary_id'  => '',
+					'description' => qr(),
+				   );
+	is   ($seq_obj->seq(),         $expected{'seq'},         'sequence');
+	is   ($seq_obj->length(),      $expected{'length'},      'length');
+	is   ($seq_obj->primary_id(),  $expected{'primary_id'},  'primary_id');
+	like ($seq_obj->description(), $expected{'description'}, 'description');
+}
\ No newline at end of file


Property changes on: bioperl-live/trunk/t/SeqIO/agave.t
___________________________________________________________________
Name: svn:keywords
   + "Author Date Id Rev URL"

Added: bioperl-live/trunk/t/SeqIO/alf.t
===================================================================
--- bioperl-live/trunk/t/SeqIO/alf.t	                        (rev 0)
+++ bioperl-live/trunk/t/SeqIO/alf.t	2008-11-27 16:48:01 UTC (rev 15035)
@@ -0,0 +1,47 @@
+# -*-Perl-*- Test Harness script for Bioperl
+# $Id$
+
+use strict;
+
+BEGIN {
+	use lib 't/lib';
+    use BioperlTest;
+    
+    test_begin(-tests               => 8,
+			   -requires_modules    => [],
+			   -requires_networking => 0,
+			  );
+	
+	use_ok('Bio::SeqIO::alf');
+}
+
+my $verbose = test_debug();
+
+TODO: {
+	my $format = 'alf';
+	todo_skip "No tests for $format format -- no sample file to test against", 7, if 1;
+
+	my $seqio_obj = Bio::SeqIO->new(-file   => test_input_file("test.$format"),
+							        -format => $format);
+	
+	isa_ok($seqio_obj, 'Bio::SeqIO');
+	
+	my @methods = qw(next_seq write_seq);
+	foreach my $method (@methods) {
+		can_ok($seqio_obj, $method) || 
+			diag "$method method not implemented for $format";	
+	}
+	
+	# checking the first sequence object
+	my $seq_obj = $seqio_obj->next_seq();
+	isa_ok($seq_obj, 'Bio::Seq');
+	my %expected = ('seq'         => '' .
+					'length'      => '',
+					'primary_id'  => '',
+					'description' => qr(),
+				   );
+	is   ($seq_obj->seq(),         $expected{'seq'},         'sequence');
+	is   ($seq_obj->length(),      $expected{'length'},      'length');
+	is   ($seq_obj->primary_id(),  $expected{'primary_id'},  'primary_id');

@@ Diff output truncated at 10000 characters. @@



More information about the Bioperl-guts-l mailing list