1 # -*-Perl-*- Test Harness script for Bioperl
11 test_begin(-tests => 65);
14 use_ok('Bio::Seq::PrimedSeq');
17 my ($seqio, $seq, $left, $right, $primed_seq, $left_test, $right_test, $annseq, $amplicon, $returnedseq);
19 $seqio = Bio::SeqIO->new(-file => test_input_file('primedseq.fa'));
20 $seq = $seqio->next_seq;
22 my $expected_amplicon_seq = 'cttttcattctgactgcaacgGGCAATATGTCTCTGTGTGGATTAAAAA'.
23 'AAGAGTGTCTGATAGCAGCTTCTGAACTGGTTACCTGCCGTGAGTAAATTAAAATTTTATTGACTTAGGTCACTAAA'.
24 'TACTTTAACCAATATAGGCATAGCGCACAGACAGATAAAAATTACAGAGTACACAACATCCATGAAacgcattagca'.
27 my $expected_amplicon_seq2 = 'cttttcattctgactgcaacgTGTCTCTGTGTGGATTAAAAA'.
28 'AAGAGTGTCTGATAGCAGCTTCTGAACTGGTTACCTGCCGTGAGTAAATTAAAATTTTATTGACTTAGGTCACTAAA'.
29 'TACTTTAACCAATATAGGCATAGCGCACAGACAGATAAAAATTACAGAGTACACAACATCCATGAAacgcattagca'.
32 # Prime with Bio::PrimarySeqI objects and have the primer positions calculated
33 $left = Bio::PrimarySeq->new(-id => 123, -seq => 'CTTTTCATTCTGACTGCAACG');
34 $right = Bio::Seq->new(-seq => 'GGTGGTGCTAATGCGT');
35 ok $primed_seq = Bio::Seq::PrimedSeq->new(
37 -left_primer => $left,
38 -right_primer => $right,
39 ), 'Priming the target with sequence objects';
41 is $primed_seq->isa('Bio::SeqFeature::Generic'), 1;
43 ok $annseq = $primed_seq->annotated_sequence; # should I check that this is what I think it is, or just be happy?
45 ok $amplicon = $primed_seq->amplicon;
46 is $amplicon->seq, $expected_amplicon_seq;
47 is $amplicon->id, 'Amplicon_from_Test1';
48 ok $returnedseq = $primed_seq->seq;
49 is $returnedseq->seq, $seq->seq;
50 ok $left_test = $primed_seq->get_primer('-left_primer');
51 isa_ok $left_test, 'Bio::SeqFeature::Primer';
52 is $left_test->seq->seq, 'CTTTTCATTCTGACTGCAACG';
53 ok $right_test = $primed_seq->get_primer('-r');
54 isa_ok $right_test, 'Bio::SeqFeature::Primer';
55 is $right_test->seq->seq, 'GGTGGTGCTAATGCGT';
56 ok( ($left_test, $right_test) = $primed_seq->get_primer() );
57 is $left_test->seq->seq, 'CTTTTCATTCTGACTGCAACG';
58 is $right_test->seq->seq, 'GGTGGTGCTAATGCGT';
59 is $left_test->strand, 1;
60 is $left_test->start, 3;
61 is $left_test->end, 23;
62 is $right_test->strand, -1;
63 is $right_test->start, 195;
64 is $right_test->end, 210;
67 # Prime the sequence with Bio::SeqFeature::Primer objects
68 $left = Bio::SeqFeature::Primer->new(-id => 123, -seq => 'CTTTTCATTCTGACTGCAACG');
69 $right = Bio::SeqFeature::Primer->new(-seq => 'GGTGGTGCTAATGCGT');
70 ok $primed_seq = Bio::Seq::PrimedSeq->new(
72 -left_primer => $left,
73 -right_primer => $right,
74 ), 'Priming the target with primer objects';
75 ok $annseq = $primed_seq->annotated_sequence;
76 ok $amplicon = $primed_seq->amplicon;
77 is $amplicon->seq, $expected_amplicon_seq;
78 is $amplicon->id, 'Amplicon_from_Test1';
79 ok $returnedseq = $primed_seq->seq;
80 is $returnedseq->seq, $seq->seq;
81 ok $left_test = $primed_seq->get_primer('left');
82 is_deeply $left_test, $left;
83 ok $right_test = $primed_seq->get_primer('r');
84 is_deeply $right_test, $right;
85 ok( ($left_test, $right_test) = $primed_seq->get_primer('-both') );
86 is_deeply $left_test, $left;
87 is_deeply $right_test, $right;
88 is $left_test->strand, 1;
89 is $left_test->start, 3;
90 is $left_test->end, 23;
91 is $right_test->strand, -1;
92 is $right_test->start, 195;
93 is $right_test->end, 210;
96 # Prime the sequence with Bio::SeqFeature::Primer objects
97 $left = Bio::SeqFeature::Primer->new(
99 -seq => 'CTTTTCATTCTGACTGCAACG',
104 $right = Bio::SeqFeature::Primer->new(
105 -seq => 'GGTGGTGCTAATGCGT',
110 ok $primed_seq = Bio::Seq::PrimedSeq->new(
112 -left_primer => $left,
113 -right_primer => $right,
114 ), 'Priming the target with located primer objects';
115 ok $annseq = $primed_seq->annotated_sequence;
116 ok $amplicon = $primed_seq->amplicon;
117 is $amplicon->seq, $expected_amplicon_seq2;
118 is $amplicon->id, 'Amplicon_from_Test1';
119 ok $returnedseq = $primed_seq->seq;
120 is $returnedseq->seq, $seq->seq;
121 ok $left_test = $primed_seq->get_primer('left');
122 is_deeply $left_test, $left;
123 ok $right_test = $primed_seq->get_primer('r');
124 is_deeply $right_test, $right;
125 ok( ($left_test, $right_test) = $primed_seq->get_primer('-both') );
126 is_deeply $left_test, $left;
127 is_deeply $right_test, $right;
128 is $left_test->strand, 1;
129 is $left_test->start, 10;
130 is $left_test->end, 30;
131 is $right_test->strand, -1;
132 is $right_test->start, 195;
133 is $right_test->end, 210;