6 test_begin(-tests => 37);
8 use_ok 'Bio::PrimarySeq';
9 use_ok 'Bio::SeqFeature::SubSeq';
12 my ($subseq, $subseq_seq, $subsubseq, $subsubseq_seq, $template);
17 $subseq = Bio::SeqFeature::SubSeq->new();
18 isa_ok $subseq, 'Bio::SeqFeature::SubSeq';
19 isa_ok $subseq, 'Bio::SeqFeature::Generic';
20 is $subseq->length, undef;
23 # SubSeq with explicit sequence (sequence string)
25 ok $subseq = Bio::SeqFeature::SubSeq->new(
26 -seq => 'CCCCCAAAAAGGGGGTTTTT',
28 is $subseq->length, 20;
29 ok $subseq_seq = $subseq->seq;
30 isa_ok $subseq_seq, 'Bio::PrimarySeq';
31 is $subseq_seq->seq, 'CCCCCAAAAAGGGGGTTTTT';
34 # SubSeq with explicit sequence (sequence object)
36 ok $subseq = Bio::SeqFeature::SubSeq->new(
37 -seq => Bio::PrimarySeq->new( -seq => 'CCCCCAAAAAGGGGGTTTTT' ),
39 is $subseq->length, 20;
40 ok $subseq_seq = $subseq->seq;
41 isa_ok $subseq_seq, 'Bio::PrimarySeq';
42 is $subseq_seq->seq, 'CCCCCAAAAAGGGGGTTTTT';
45 # SubSeq with explicit sequence and coordinates
47 ok $subseq = Bio::SeqFeature::SubSeq->new(
48 -seq => Bio::PrimarySeq->new( -seq => 'CCCCCAAAAAGGGGGTTTTT' ),
53 is $subseq->length, 30;
54 ok $subseq_seq = $subseq->seq;
55 isa_ok $subseq_seq, 'Bio::PrimarySeq';
56 is $subseq_seq->seq, 'CCCCCAAAAAGGGGGTTTTT';
59 # Subseq with implicit sequence
61 $template = Bio::Seq->new( -seq => 'ATCGATCGATCCCCCAAAAAGGGGGTTTTTAGCTAGCTAT');
63 ok $subseq = Bio::SeqFeature::SubSeq->new(
68 is $subseq->length, 20;
70 ok $template->add_SeqFeature($subseq);
71 ok $subseq_seq = $subseq->seq;
72 isa_ok $subseq_seq, 'Bio::PrimarySeq';
73 is $subseq_seq->seq, 'AAAAACCCCCTTTTTGGGGG';
76 # Subseq with implicit sequence
78 $template = Bio::Seq->new( -seq => 'ATCGATCGATCCCCCAAAAAGGGGGTTTTTAGCTAGCTAT');
80 ok $subseq = Bio::SeqFeature::SubSeq->new(
84 -template => $template,
86 is $subseq->length, 20;
87 ok $subseq_seq = $subseq->seq;
88 isa_ok $subseq_seq, 'Bio::PrimarySeq';
89 is $subseq_seq->seq, 'AAAAACCCCCTTTTTGGGGG';
94 ok $subsubseq = Bio::SeqFeature::SubSeq->new(
100 is $subsubseq->length, 5;
101 ok $subsubseq_seq = $subsubseq->seq;
102 isa_ok $subsubseq_seq, 'Bio::PrimarySeq';
103 is $subsubseq_seq->seq, 'CCCCC';
108 is( Bio::SeqFeature::SubSeq->new(-start=>11,-end=>30,-strand=>1,-template=>$template)->seq->seq, 'CCCCCAAAAAGGGGGTTTTT' );