1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 47);
11 use_ok('Bio::SeqFeature::Primer');
12 use_ok('Bio::PrimarySeq');
15 my ($primer, $primer_seq, $location, $start, $end, $strand, $id, $tm, $tme, $template, $seq);
17 # Implied primer sequence
18 $template = Bio::Seq->new( -seq => 'AAAAACCCCCGGGGGTTTTT' );
19 ok $primer = Bio::SeqFeature::Primer->new( -start => 6, -end => 10 ), 'Implied primer sequence';
20 isa_ok $primer, 'Bio::SeqFeature::Primer';
21 isa_ok $primer, 'Bio::SeqFeature::SubSeq';
22 ok $template->add_SeqFeature($primer); # $primer->attach_seq($template);
23 ok $primer_seq = $primer->seq;
24 isa_ok $primer_seq, 'Bio::PrimarySeqI';
25 is $primer_seq->seq, 'CCCCC';
28 # Bio::PrimarySeq primer
29 $template = Bio::Seq->new( -seq => 'AAAAACCCCCGGGGGTTTTT' );
30 $seq = Bio::PrimarySeq->new(-seq => 'CTTTTCATTCTGACTGCAACG');
31 ok $primer = Bio::SeqFeature::Primer->new(-seq => $seq), 'PrimarySeq primer';
32 ok $template->add_SeqFeature($primer); # $primer->attach_seq($template);
33 ok $primer_seq = $primer->seq;
34 isa_ok $primer_seq, 'Bio::PrimarySeqI';
35 is $primer_seq->seq, 'CTTTTCATTCTGACTGCAACG';
38 # Initialize with a sequence string
39 ok $primer = Bio::SeqFeature::Primer->new(
40 -seq => 'CTTTTCATTCTGACTGCAACG',
45 ok $primer_seq = $primer->seq;
46 is $primer_seq->isa('Bio::PrimarySeqI'), 1;
47 is $primer_seq->seq, 'CTTTTCATTCTGACTGCAACG';
48 is $primer_seq->id, 'myid';
49 is $primer->primary_tag, 'Primer';
50 ok $primer->display_name('test');
51 is $primer->display_name, 'test';
59 ok $primer->strand(-1);
60 is $primer->strand, -1;
61 ok $location = $primer->location;
62 isa_ok $location, 'Bio::LocationI';
65 # Melting temperatures
68 ok $tm = $primer->Tm(-salt => 0.05, -oligo => 0.0000001);
69 ok $tme = $primer->Tm_estimate;
71 ok $tm = $primer->Tm_estimate(-salt => 0.05);
75 # * initializing with -sequence
76 # * passing a string to location()
78 local $SIG{'__WARN__'} = sub { }; # Silence deprecation warnings
79 ok $primer = Bio::SeqFeature::Primer->new(
80 -sequence => 'CTTTTCATTCTGACTGCAACG',
82 ok $location = $primer->location('3,25');
89 -seq => 'gcatcgatctagctagcta' ,
90 -id => 'chads_nifty_sequence',
92 $primer = Bio::SeqFeature::Primer->new(
96 isa_ok $primer, 'Bio::SeqFeature::Primer';
97 is $primer->seq->display_id, 'chads_nifty_sequence';
98 is $primer->seq->seq, 'gcatcgatctagctagcta';
99 $primer = Bio::SeqFeature::Primer->new(
100 -seq => 'aaaaaacgatcgatcgtagctagct',
101 -id => 'chads_nifty_primer',
104 isa_ok $primer, 'Bio::SeqFeature::Primer';
105 isa_ok $primer->seq(), 'Bio::PrimarySeq';
106 is $primer->seq->id, 'chads_nifty_primer';
107 is $primer->seq->seq, 'aaaaaacgatcgatcgtagctagct';