[Bioperl-guts-l] bioperl-live/t Annotation.t,1.20,1.21

Weigang Qiu weigang at dev.open-bio.org
Wed Jan 10 17:01:18 EST 2007


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

Modified Files:
	Annotation.t 
Log Message:
6 tests added for Bio::Annotation::Tree

Index: Annotation.t
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/t/Annotation.t,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** Annotation.t	29 Nov 2006 10:48:35 -0000	1.20
--- Annotation.t	10 Jan 2007 22:01:16 -0000	1.21
***************
*** 19,23 ****
      }
      use Test::More;
!     plan tests => ($NUMTESTS = 101);
  	use_ok('Bio::Annotation::Collection');
  	use_ok('Bio::Annotation::DBLink');
--- 19,23 ----
      }
      use Test::More;
!     plan tests => ($NUMTESTS = 108);
  	use_ok('Bio::Annotation::Collection');
  	use_ok('Bio::Annotation::DBLink');
***************
*** 28,31 ****
--- 28,32 ----
  	use_ok('Bio::Annotation::AnnotationFactory');
  	use_ok('Bio::Annotation::StructuredValue');
+ 	use_ok('Bio::Annotation::Tree');
  	use_ok('Bio::Seq');
  	use_ok('Bio::SeqFeature::Generic');
***************
*** 238,239 ****
--- 239,273 ----
  					  -tagname => 'cellular component')));
  like(ref $ann, qr(Bio::Annotation::OntologyTerm));
+ 
+ # tree
+ my $tree_filename = Bio::Root::IO->catfile("t","data","longnames.dnd");
+ my $tree=Bio::TreeIO->new(-file=>$tree_filename)->next_tree();
+ my $ann_tree = Bio::Annotation::Tree->new(
+ 					  -tagname => 'tree',
+ 					  -tree_obj   => $tree,
+ 					 );
+ 
+ isa_ok($ann_tree, 'Bio::AnnotationI');
+ $ann_tree->tree_id('test');
+ is $ann_tree->tree_id(), 'test', "tree_id()";
+ $ann_tree->tagname('tree'); 
+ is $ann_tree->tagname(), 'tree', "tagname()";
+ my $aln_filename = Bio::Root::IO->catfile("t","data","longnames.aln");
+ use Bio::AlignIO;
+ $aln = Bio::AlignIO->new(-file=>$aln_filename, -format=>'clustalw')->next_aln();
+ isa_ok($aln, 'Bio::AnnotatableI');
+ $ac = Bio::Annotation::Collection->new();
+ $ac->add_Annotation('tree',$ann_tree);
+ $aln->annotation($ac);
+ foreach my $treeblock ( $aln->annotation->get_Annotations('tree') ) {
+     my $treeref=$treeblock->tree();
+     my @nodes = sort { defined $a->id && 
+ 		      defined $b->id &&
+ 			$a->id cmp $b->id } $treeref->get_nodes();
+     is $nodes[12]->id, '183.m01790', "add tree to AlignI";
+     my $str;
+     foreach my $seq ($aln->each_seq_with_id($nodes[12]->id)) { $str=$seq->subseq(1,20)}
+     is $str, "MDDKELEIPVEHSTAFGQLV", "get seq from node id";
+ }
+ 
+ 



More information about the Bioperl-guts-l mailing list