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