Retire SeqHound support.
[bioperl-live.git] / t / SeqFeature / Primer.t
blobc5e3bc73291374677f89bf56f41b0bd8ceb28569
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
5 use strict;
7 BEGIN {
8     use lib '.';
9     use Bio::Root::Test;
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',
41     -start  => 3,
42     -id     => 'myid',
44 is $primer->start, 3;
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';
54 # Coordinates
55 ok $primer->start(2);
56 is $primer->start, 2;
57 ok $primer->end(19);
58 is $primer->end, 19;
59 ok $primer->strand(-1);
60 is $primer->strand, -1;
61 ok $location = $primer->location;
62 isa_ok $location, 'Bio::LocationI';
65 # Melting temperatures
66 ok $tm = $primer->Tm;
67 is int($tm), 52;
68 ok $tm = $primer->Tm(-salt => 0.05, -oligo => 0.0000001);
69 ok $tme = $primer->Tm_estimate;
70 is int($tme), 58;
71 ok $tm = $primer->Tm_estimate(-salt => 0.05);
74 # Legacy
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',
81    );
82    ok $location = $primer->location('3,25');
83    is $location, '3,25';
87 # Chad's tests
88 $seq = Bio::Seq->new(
89     -seq => 'gcatcgatctagctagcta' ,
90     -id  => 'chads_nifty_sequence',
92 $primer = Bio::SeqFeature::Primer->new(
93     -seq => $seq,
94     -TARGET => '5,3'
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',
102     -TARGET => '5,3',
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';