7 test_begin(-tests => 23);
8 # -----------------------------------------------
9 # REQUIREMENTS TESTED: (not yet!)
10 # unknown start/end (eg like we find in SP)
11 # must be handled gracefully
13 # -----------------------------------------------
14 use_ok('DBTestHarness');
18 $biosql = DBTestHarness->new("biosql");
19 $db = $biosql->get_DBAdaptor();
22 my $seqio = Bio::SeqIO->new('-format' => 'embl',
23 '-file' => test_input_file('AB030700.embl'));
24 my $seq = $seqio->next_seq();
26 my $pseq = $db->create_persistent($seq);
27 $pseq->namespace("mytestnamespace");
29 ok $pseq->primary_key();
31 my $seqadp = $db->get_object_adaptor($seq);
35 my $sequk = Bio::Seq::RichSeq->new(-accession_number => "AB030700",
37 -namespace => "mytestnamespace");
38 $dbseq = $seqadp->find_by_unique_key($sequk);
41 is ($dbseq->display_id, $seq->display_id);
42 is ($dbseq->accession, $seq->accession);
43 is ($dbseq->subseq(3,10), $seq->subseq(3,10) );
44 is ($dbseq->subseq(1,15), $seq->subseq(1,15) );
45 is ($dbseq->length, $seq->length);
46 is ($dbseq->seq, $seq->seq);
47 is ($dbseq->desc, $seq->desc);
50 $a->primary_id cmp $b->primary_id
51 } $dbseq->annotation->get_Annotations('dblink');
53 $a->primary_id cmp $b->primary_id
54 } $seq->annotation->get_Annotations('dblink');
56 ok (scalar(@dblinks));
57 is (scalar(@dblinks), scalar(@stdlinks));
59 for(my $i = 0; $i < @dblinks; $i++) {
60 is($dblinks[$i]->database, $stdlinks[$i]->database);
61 is($dblinks[$i]->primary_id, $stdlinks[$i]->primary_id);
63 local $TODO = 'optional_id() for dblinks is not working yet';
64 is($dblinks[$i]->optional_id, $stdlinks[$i]->optional_id);
69 print STDERR $@ if $@;
72 is ($pseq->remove(), 1);
73 my $ns = Bio::DB::Persistent::BioNamespace->new(-identifiable => $pseq);
74 ok $ns = $db->get_object_adaptor($ns)->find_by_unique_key($ns);
75 ok $ns->primary_key();
76 is ($ns->remove(), 1);