maint: remove Travis stuff which has been replaced with Github actions (#325)
[bioperl-live.git] / t / SeqFeature / Primer.t
blob0f10b3eeaa2463e0c76ef6b8af73e5bdff1c5a00
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
5 use strict;
7 BEGIN {
8     use Bio::Root::Test;
9     test_begin(-tests => 47);
10     use_ok('Bio::SeqFeature::Primer');
11     use_ok('Bio::PrimarySeq');
14 my ($primer, $primer_seq, $location, $start, $end, $strand, $id, $tm, $tme, $template, $seq);
16 # Implied primer sequence
17 $template = Bio::Seq->new( -seq => 'AAAAACCCCCGGGGGTTTTT' );
18 ok $primer = Bio::SeqFeature::Primer->new( -start => 6, -end => 10 ), 'Implied primer sequence';
19 isa_ok $primer, 'Bio::SeqFeature::Primer';
20 isa_ok $primer, 'Bio::SeqFeature::SubSeq';
21 ok $template->add_SeqFeature($primer); # $primer->attach_seq($template);
22 ok $primer_seq = $primer->seq;
23 isa_ok $primer_seq, 'Bio::PrimarySeqI';
24 is $primer_seq->seq, 'CCCCC';
27 # Bio::PrimarySeq primer
28 $template = Bio::Seq->new( -seq => 'AAAAACCCCCGGGGGTTTTT' );
29 $seq = Bio::PrimarySeq->new(-seq => 'CTTTTCATTCTGACTGCAACG');
30 ok $primer = Bio::SeqFeature::Primer->new(-seq => $seq), 'PrimarySeq primer';
31 ok $template->add_SeqFeature($primer); # $primer->attach_seq($template);
32 ok $primer_seq = $primer->seq;
33 isa_ok $primer_seq, 'Bio::PrimarySeqI';
34 is $primer_seq->seq, 'CTTTTCATTCTGACTGCAACG';
37 # Initialize with a sequence string
38 ok $primer = Bio::SeqFeature::Primer->new(
39     -seq    => 'CTTTTCATTCTGACTGCAACG',
40     -start  => 3,
41     -id     => 'myid',
43 is $primer->start, 3;
44 ok $primer_seq = $primer->seq;
45 is $primer_seq->isa('Bio::PrimarySeqI'), 1;
46 is $primer_seq->seq, 'CTTTTCATTCTGACTGCAACG';
47 is $primer_seq->id, 'myid';
48 is $primer->primary_tag, 'Primer';
49 ok $primer->display_name('test');
50 is $primer->display_name, 'test';
53 # Coordinates
54 ok $primer->start(2);
55 is $primer->start, 2;
56 ok $primer->end(19);
57 is $primer->end, 19;
58 ok $primer->strand(-1);
59 is $primer->strand, -1;
60 ok $location = $primer->location;
61 isa_ok $location, 'Bio::LocationI';
64 # Melting temperatures
65 ok $tm = $primer->Tm;
66 is int($tm), 52;
67 ok $tm = $primer->Tm(-salt => 0.05, -oligo => 0.0000001);
68 ok $tme = $primer->Tm_estimate;
69 is int($tme), 58;
70 ok $tm = $primer->Tm_estimate(-salt => 0.05);
73 # Legacy
74 #   * initializing with -sequence
75 #   * passing a string to location()
77    local $SIG{'__WARN__'} = sub {  }; # Silence deprecation warnings
78    ok $primer = Bio::SeqFeature::Primer->new(
79        -sequence => 'CTTTTCATTCTGACTGCAACG',
80    );
81    ok $location = $primer->location('3,25');
82    is $location, '3,25';
86 # Chad's tests
87 $seq = Bio::Seq->new(
88     -seq => 'gcatcgatctagctagcta' ,
89     -id  => 'chads_nifty_sequence',
91 $primer = Bio::SeqFeature::Primer->new(
92     -seq => $seq,
93     -TARGET => '5,3'
95 isa_ok $primer, 'Bio::SeqFeature::Primer';
96 is $primer->seq->display_id, 'chads_nifty_sequence';
97 is $primer->seq->seq, 'gcatcgatctagctagcta';
98 $primer = Bio::SeqFeature::Primer->new(
99     -seq => 'aaaaaacgatcgatcgtagctagct',
100     -id => 'chads_nifty_primer',
101     -TARGET => '5,3',
103 isa_ok $primer, 'Bio::SeqFeature::Primer';
104 isa_ok $primer->seq(), 'Bio::PrimarySeq';
105 is $primer->seq->id, 'chads_nifty_primer';
106 is $primer->seq->seq, 'aaaaaacgatcgatcgtagctagct';