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