1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 450,
11 -requires_module => 'IO::Scalar');
13 use_ok('Bio::Tools::CodonTable');
37 my @num_anns = (5, 5, 5, 5, 6, 7, 7, 7, 7, 7);
38 my @psg = (0, 0, 1, 1, 0, 0, 0, 0, 0, 0);
39 my @rs = (0, 0, 0, 0, 1, 1, 1, 1, 1, 1);
41 ok my $seqin = Bio::SeqIO->new(-file => test_input_file("kinases.tsv"),
43 -species => "Homo sapiens",
47 -accession_number => 2,
51 run_tests([@names],[@accs],[@num_anns],[@psg],[@rs]);
55 ok $seqin = Bio::SeqIO->new(-file => test_input_file("kinases.tsv"),
57 -species => "Homo sapiens",
61 -accession_number => 2,
63 -colnames => "[Family,Subfamily,Pseudogene?,Protein,Novelty]",
65 run_tests([@names],[@accs],[4,4,4,4,4,5,5,5,5,5],[@psg],[@rs]);
69 ok $seqin = Bio::SeqIO->new(-file => test_input_file("kinases.tsv"),
71 -species => "Homo sapiens",
75 -accession_number => 2,
77 -annotation => "[4,5,6,8,10]",
79 run_tests([@names],[@accs],[4,4,4,4,4,5,5,5,5,5],[@psg],[@rs]);
83 # need Spreadsheet::ParseExcel installed for testing Excel format
85 test_skip(-tests => 112, -requires_module => 'Spreadsheet::ParseExcel');
87 ok $seqin = Bio::SeqIO->new(-file => test_input_file("kinases.xls"),
89 -species => "Homo sapiens",
92 -accession_number => 2,
96 run_tests([@names],[@accs],[@num_anns],[@psg],[@rs]);
102 my ($names_,$accs_,$num_anns_,$psg_,$rs_) = @_;
104 my @names = @$names_;
106 my @num_anns = @$num_anns_;
111 my $translator = Bio::Tools::CodonTable->new(-id => 1);
112 while (my $seq = $seqin->next_seq()) {
114 is ($seq->display_id, shift(@names));
115 is ($seq->accession_number, shift(@accs));
117 is ($seq->species->binomial, "Homo sapiens");
118 my @anns = $seq->annotation->get_Annotations();
119 is (scalar(@anns), shift(@num_anns));
120 @anns = grep { $_->value eq "Y";
121 } $seq->annotation->get_Annotations("Pseudogene?");
122 is (scalar(@anns), shift(@psg));
124 # check sequences and that they translate to what we expect
125 if (($n >= 5) && ($seq->display_id ne "MARK3")) {
129 while ($frame <= 2) {
130 my $inframe = substr($dna,$frame);
131 # translate to protein
132 my $protseq = $translator->translate($inframe);
133 # chop off everything after the stop and before the first Met
134 while ($protseq =~ /(M[^\*]+)/g) {
135 $protein = $1 if length($1) > length($protein);
139 # retrieve expected result from annotation and compare
140 my ($protann) = $seq->annotation->get_Annotations("Protein");
141 ok (defined $protann);
142 is ($protein, $protann->value);
145 @anns = grep { $_->value eq "Known - Refseq";
146 } $seq->annotation->get_Annotations("Novelty");
147 is (scalar(@anns), shift(@rs));
148 @anns = $seq->annotation->get_Annotations("Subfamily");
149 is (scalar(@anns), ($n <= 5) ? 0 : 1);
150 @anns = $seq->annotation->get_Annotations("Family");
151 is (scalar(@anns), 1);
152 is (substr($anns[0]->value,0,4), ($n <= 4) ? "A6" : "CAMK");