[Bioperl-guts-l] bioperl-live/t DBFasta.t, 1.8, 1.9 Domcut.t, 1.13, 1.14 dblink.t, 1.1, 1.2

Christopher John Fields cjfields at dev.open-bio.org
Thu Mar 8 11:26:11 EST 2007


Update of /home/repository/bioperl/bioperl-live/t
In directory dev.open-bio.org:/tmp/cvs-serv16314

Modified Files:
	DBFasta.t Domcut.t dblink.t 
Log Message:
D* tests to Test::More

Index: dblink.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/t/dblink.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dblink.t	30 Nov 2006 02:55:46 -0000	1.1
--- dblink.t	8 Mar 2007 16:26:09 -0000	1.2
***************
*** 17,27 ****
      $NTESTS = 134;
      plan tests => $NTESTS; 
  }
  
- use_ok('Bio::Annotation::DBLink');
- use_ok('Bio::SeqIO::genbank');
- use_ok('Bio::SeqIO::swiss');
- use_ok('Bio::Root::IO');
- 
  my @genbank_files = qw/BK000016-tpa.gbk ay116458.gb ay149291.gb NC_006346.gb ay007676.gb dq519393.gb P35527.gb/;
  
--- 17,26 ----
      $NTESTS = 134;
      plan tests => $NTESTS; 
+     use_ok('Bio::Annotation::DBLink');
+     use_ok('Bio::SeqIO::genbank');
+     use_ok('Bio::SeqIO::swiss');
+     use_ok('Bio::Root::IO');
  }
  
  my @genbank_files = qw/BK000016-tpa.gbk ay116458.gb ay149291.gb NC_006346.gb ay007676.gb dq519393.gb P35527.gb/;
  

Index: Domcut.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/t/Domcut.t,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Domcut.t	29 Nov 2006 11:25:01 -0000	1.13
--- Domcut.t	8 Mar 2007 16:26:09 -0000	1.14
***************
*** 12,121 ****
      # we include the t dir (where a copy of Test.pm is located)
      # as a fallback
!     eval { require Test; };
      $ERROR = 0;
      if( $@ ) {
! 	use lib 't';
      }
!     use Test;
  
!     $NUMTESTS = 25;
      plan tests => $NUMTESTS;
  
!     eval {
! 		 require IO::String; 
! 		 require LWP::UserAgent;
!     };
!     if( $@ ) {
!         warn("IO::String or LWP::UserAgent not installed. This means that the module is not usable. Skipping tests");
! 	$ERROR = 1;
!     }
! 	#check this is available, set error flag if not.
! 	eval {
! 		require Bio::Seq::Meta::Array;
! 		};
! 	if ($@) {
! 		warn ("Bio::Seq::Meta::Array not installed - will skip tests using meta sequences");
! 		$METAERROR = 1;
! 		}
  }
  
! END {
! 	foreach ( $Test::ntest..$NUMTESTS) {
! 		skip('unable to complete all Domcut tests',1);
  	}
! }
! 
! exit 0 if $ERROR ==  1;
! 
! use Data::Dumper;
! 
! use Bio::PrimarySeq;
! require Bio::Tools::Analysis::Protein::Domcut;
! 
! ok 1;
! 
! my $verbose = 0;
! $verbose = 1 if $DEBUG;
! 
! ok my $tool = Bio::WebAgent->new(-verbose =>$verbose);
! 
! 
! ######## test using PrimarySeq object ##############
! my $seq = Bio::PrimarySeq->new(-seq        => 'MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQPPPPPPPPPPPPPDQRS',
! 						       -display_id => 'test2');
! 
! ok $tool = Bio::Tools::Analysis::Protein::Domcut->new( -seq=>$seq);
! if( $DEBUG ) { 
!     ok $tool->run ();
!     exit if $tool->status eq 'TERMINATED_BY_ERROR';
!     ok my $raw    = $tool->result('');
!     ok my $parsed = $tool->result('parsed');
!     ok ($parsed->[23]{'score'}, '-0.209');
!     my @res       = $tool->result('Bio::SeqFeatureI');
!     if (scalar @res > 0) {
! 	ok 1;
!     } else {
! 	skip('No network access - could not connect to Domcut server', 1);
!     }
!     ok my $meta = $tool->result('meta');
!     
!     if (!$METAERROR) { #if Bio::Seq::Meta::Array available
! 	ok($meta->named_submeta_text('Domcut', 1,2), "0.068 0.053");
! 	ok ($meta->seq, "MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQPPPPPPPPPPPPPDQRS");
!     }
!     
!     
! ########## test using Bio::Seq object ##############
!     ok my $tool2 = Bio::WebAgent->new(-verbose =>$verbose);
!     
!     ok my $seq2  = Bio::Seq->new(-seq => 'MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQDQRS',
  				 -display_id => 'test2');
!     
!     ok $tool2 = Bio::Tools::Analysis::Protein::Domcut->new( -seq=>$seq2->primary_seq);
!     ok $tool2->run ();
!     
!     ok my $parsed2 = $tool2->result('parsed');
!     ok ($parsed2->[23]{'score'}, '-0.209');
!     
!     @res = $tool2->result('Bio::SeqFeatureI');
  
!     if (scalar @res > 0) {
! 	ok 1;
!     } else {
! 	skip('No network access - could not connect to Domcut server', 1);
!     }
!     ok my $meta2 = $tool2->result('meta');
!     
!     if (!$METAERROR) { #if Bio::Seq::Meta::Array available
! 	ok($meta2->named_submeta_text('Domcut', 1,2), "0.068 0.053");
! 	ok ($meta2->seq, "MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQDQRS");
!     }
!     ok my $seq4 = new Bio::Seq;
!     ok $seq2->primary_seq($meta2);
!     ok $seq2->add_SeqFeature(@res);
!     ok $seq2->primary_seq->named_submeta_text('Domcut', 1,2);
! } else { 
!     for ( $Test::ntest..$NUMTESTS) {
! 	skip("Skipping tests which require remote servers - set env variable BIOPERLDEBUG to test",1);
!     }
! }
--- 12,98 ----
      # we include the t dir (where a copy of Test.pm is located)
      # as a fallback
!     eval { require Test::More; };
      $ERROR = 0;
      if( $@ ) {
! 	use lib 't/lib';
      }
!     use Test::More;
  
!     $NUMTESTS = 27;
      plan tests => $NUMTESTS;
  
! 	use_ok('Bio::Seq::Meta::Array');
! 	use_ok('Bio::PrimarySeq');
  }
  
! SKIP: {
! 	eval {
! 		 require IO::String; 
! 		 require LWP::UserAgent;
! 	};
! 	if( $@ ) {
! 		skip("IO::String or LWP::UserAgent not installed. This means that the module is not usable. Skipping tests", 26);
  	}
! 	require_ok 'Bio::Tools::Analysis::Protein::Domcut';
! 	
! 	my $verbose = 0;
! 	$verbose = 1 if $DEBUG;
! 	
! 	ok my $tool = Bio::WebAgent->new(-verbose =>$verbose);
! 	
! 	######## test using PrimarySeq object ##############
! 	my $seq = Bio::PrimarySeq->new(-seq        => 'MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQPPPPPPPPPPPPPDQRS',
! 								   -display_id => 'test2');
! 	
! 	ok $tool = Bio::Tools::Analysis::Protein::Domcut->new( -seq=>$seq);
! 	ok $tool->run ();
! 	if ($tool->status eq 'TERMINATED_BY_ERROR') {
! 		skip('Problem with DomCut run, check status', 21);
! 	}
! 	ok my $raw    = $tool->result('');
! 	ok my $parsed = $tool->result('parsed');
! 	is ($parsed->[23]{'score'}, '-0.209');
! 	my @res       = $tool->result('Bio::SeqFeatureI');
! 	if (scalar @res > 0) {
! 		ok 1;
! 	} else {
! 		skip('No network access - could not connect to Domcut server', 18);
! 	}
! 	ok my $meta = $tool->result('meta');
! 	
! 	if (!$METAERROR) { #if Bio::Seq::Meta::Array available
! 	is($meta->named_submeta_text('Domcut', 1,2), "0.068 0.053");
! 	is ($meta->seq, "MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQPPPPPPPPPPPPPDQRS");
! 	}
! 		
! 		
! 	########## test using Bio::Seq object ##############
! 	ok my $tool2 = Bio::WebAgent->new(-verbose =>$verbose);
! 	
! 	ok my $seq2  = Bio::Seq->new(-seq => 'MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQDQRS',
  				 -display_id => 'test2');
! 	
! 	ok $tool2 = Bio::Tools::Analysis::Protein::Domcut->new( -seq=>$seq2->primary_seq);
! 	ok $tool2->run ();
! 	
! 	@res = $tool2->result('Bio::SeqFeatureI');
  
! 	if (scalar @res > 0) {
! 		ok 1;
! 	} else {
! 		skip('No network access - could not connect to Domcut server', 10);
! 	}
! 	
! 	ok my $parsed2 = $tool2->result('parsed');
! 	is ($parsed2->[23]{'score'}, '-0.209');
! 	
! 	ok my $meta2 = $tool2->result('meta');
! 	
! 	is($meta2->named_submeta_text('Domcut', 1,2), "0.068 0.053");
! 	is ($meta2->seq, "MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQDQRS");
! 
! 	ok my $seq4 = new Bio::Seq;
! 	ok $seq2->primary_seq($meta2);
! 	ok $seq2->add_SeqFeature(@res);
! 	ok $seq2->primary_seq->named_submeta_text('Domcut', 1,2);
! }
\ No newline at end of file

Index: DBFasta.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/t/DBFasta.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** DBFasta.t	17 Sep 2005 02:11:21 -0000	1.8
--- DBFasta.t	8 Mar 2007 16:26:09 -0000	1.9
***************
*** 15,81 ****
      # we include the t dir (where a copy of Test.pm is located)
      # as a fallback
!     eval { require Test; };
      if( $@ ) {
!         use lib 't';
      }
!     use Test;
      eval {
! 	require Bio::DB::Fasta;
      };
      if ( $@ ) {
! 	warn("A depedendancy for Bio::DB::Fasta is not installed - skipping tests. $@\n") if $DEBUG;
! 	$exit = 1;
      }
-     plan test => ($NUMTESTS = 12);
- }
- require Bio::DB::Fasta;
- use Bio::Root::IO;
- 
- # this obfuscation is to deal with lockfiles by GDBM_File which can
- # only be created on local filesystems apparently so will cause test
- # to block and then fail when the testdir is on an NFS mounted system
  
! use File::Copy;
! my $io = Bio::Root::IO->new(-verbose => $DEBUG);
! my $tempdir = $io->tempdir('CLEANUP' => 1);
! my $test_dbdir = $io->catfile($tempdir, 'dbfa');
! mkdir($test_dbdir); # make the directory
! my $indir = $io->catfile(qw(. t data dbfa)); 
! opendir(INDIR,$indir) || die("cannot open dir $indir");
! # effectively do a cp -r but only copy the files that are in there, no subdirs
! for my $file ( map { $io->catfile($indir,$_) } readdir(INDIR) ) {
!     next unless (-f $file );
!     copy($file, $test_dbdir);
! }
! closedir(INDIR);
! 
! # now use this temporary dir for the db file
! my $db = Bio::DB::Fasta->new($test_dbdir, -reindex => 1);
! ok($db);
! ok($db->length('CEESC13F') > 0);
! ok(length $db->seq('CEESC13F:1,10') == 10);
! ok(length $db->seq('AW057119',1,10) == 10);
! my $primary_seq = $db->get_Seq_by_id('AW057119');
! ok($primary_seq);
! ok(length($primary_seq->seq) > 0);
! ok(!defined $db->get_Seq_by_id('foobarbaz'));
! undef $db;
! undef $primary_seq;
! 
! my (%h,$dna1,$dna2);
! ok(tie(%h,'Bio::DB::Fasta',$test_dbdir));
! ok($h{'AW057146'});
! ok($dna1 = $h{'AW057146:1,10'});
! ok($dna2 = $h{'AW057146:10,1'});
! 
! my $revcom = reverse $dna1;
! $revcom =~ tr/gatcGATC/ctagCTAG/;
! ok($dna2 eq $revcom);
! 
! 
! END {
! 	foreach ( $Test::ntest..$NUMTESTS) {
! 		skip('Unable to complete DBFasta tests',1);
  	}
! 	# test dir is cleaned up automagically by tempdir(CLEANUP => 1)
  }
--- 15,78 ----
      # we include the t dir (where a copy of Test.pm is located)
      # as a fallback
!     eval { require Test::More; };
      if( $@ ) {
!         use lib 't/lib';
      }
!     use Test::More;
! 	$NUMTESTS = 15;
!     plan tests => $NUMTESTS;
! }
! 
! SKIP: {
      eval {
! 		require Bio::DB::Fasta;
      };
      if ( $@ ) {
! 		skip("A dependency for Bio::DB::Fasta is not installed - skipping tests. $@",$NUMTESTS);
      }
  
! 	require_ok('Bio::DB::Fasta');
! 	use_ok('Bio::Root::IO');
! 	
! 	# this obfuscation is to deal with lockfiles by GDBM_File which can
! 	# only be created on local filesystems apparently so will cause test
! 	# to block and then fail when the testdir is on an NFS mounted system
! 	
! 	use_ok('File::Copy');
! 	my $io = Bio::Root::IO->new(-verbose => $DEBUG);
! 	my $tempdir = $io->tempdir('CLEANUP' => 1);
! 	my $test_dbdir = $io->catfile($tempdir, 'dbfa');
! 	mkdir($test_dbdir); # make the directory
! 	my $indir = $io->catfile(qw(. t data dbfa)); 
! 	opendir(INDIR,$indir) || die("cannot open dir $indir");
! 	# effectively do a cp -r but only copy the files that are in there, no subdirs
! 	for my $file ( map { $io->catfile($indir,$_) } readdir(INDIR) ) {
! 		next unless (-f $file );
! 		copy($file, $test_dbdir);
  	}
! 	closedir(INDIR);
! 	
! 	# now use this temporary dir for the db file
! 	my $db = Bio::DB::Fasta->new($test_dbdir, -reindex => 1);
! 	ok($db);
! 	cmp_ok($db->length('CEESC13F'), '>', 0);
! 	is(length $db->seq('CEESC13F:1,10'), 10);
! 	is(length $db->seq('AW057119',1,10), 10);
! 	my $primary_seq = $db->get_Seq_by_id('AW057119');
! 	ok($primary_seq);
! 	cmp_ok(length($primary_seq->seq), '>', 0);
! 	ok(!defined $db->get_Seq_by_id('foobarbaz'));
! 	undef $db;
! 	undef $primary_seq;
! 	
! 	my (%h,$dna1,$dna2);
! 	ok(tie(%h,'Bio::DB::Fasta',$test_dbdir));
! 	ok($h{'AW057146'});
! 	ok($dna1 = $h{'AW057146:1,10'});
! 	ok($dna2 = $h{'AW057146:10,1'});
! 	
! 	my $revcom = reverse $dna1;
! 	$revcom =~ tr/gatcGATC/ctagCTAG/;
! 	is($dna2, $revcom);
  }
+ 



More information about the Bioperl-guts-l mailing list