Bio::DB::Expression: move to defunct bioperl-microarray
[bioperl-live.git] / t / SeqFeature / SeqAnalysisParser.t
blob30e3f108c9a0a9371d2458db0c8a9037fa4b1460
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN { 
7         use lib '.';
8     use Bio::Root::Test;
9     
10     test_begin(-tests => 14);
11         
12         use_ok('Bio::Factory::SeqAnalysisParserFactory');
13         use_ok('Bio::SeqIO');
16 my ($seqio,$seq,$factory,$parser, $gene_seen, $exon_seen);
18 $seqio = Bio::SeqIO->new('-format'=>'fasta', '-file' => test_input_file('genomic-seq.fasta'));
19 isa_ok $seqio, 'Bio::SeqIO';
20 $seq = $seqio->next_seq;
21 isa_ok $seq, 'Bio::PrimarySeqI';
23 $factory = Bio::Factory::SeqAnalysisParserFactory->new();
25 # let's test the genscan factory
26 $parser = $factory->get_parser(-input => test_input_file('genomic-seq.genscan'),
27                                   -method => 'genscan');
28 isa_ok $parser, 'Bio::SeqAnalysisParserI';
29 while( my $feat = $parser->next_feature() ){
30     $seq->add_SeqFeature($feat);
32 ($gene_seen, $exon_seen)  = (0,0);
33 foreach my $feat (  $seq->top_SeqFeatures() ) {
34     if( $feat->isa("Bio::Tools::Prediction::Gene") ) {
35         foreach my $exon ( $feat->exons ) {
36             $exon_seen++;
37         }
38         $gene_seen++;
39     } 
41 is $exon_seen, 37;
42 is $gene_seen, 3;
44 # let's test the mzef factory
45 $parser = $factory->get_parser(-input => test_input_file('genomic-seq.mzef'),
46                                -method=> 'mzef');
47 $seqio = Bio::SeqIO->new('-format'=>'fasta', '-file' => test_input_file('genomic-seq.fasta'));
48 ok $seq = $seqio->next_seq();
49 isa_ok $seq, 'Bio::PrimarySeqI';
51 isa_ok $parser, 'Bio::SeqAnalysisParserI';
52 while( my $feat = $parser->next_feature() ){
53     $seq->add_SeqFeature($feat);
55 ($gene_seen, $exon_seen)  = (0,0);
56 foreach my $feat (  $seq->top_SeqFeatures() ) {
57     if( $feat->isa("Bio::Tools::Prediction::Gene") ) {
58         foreach my $exon ( $feat->exons ) { 
59             $exon_seen++;
60         }
61         $gene_seen++;
62     } 
64 is $exon_seen, 23;
65 is $gene_seen, 1;
67 # let's test the ePCR factory
69 $parser = $factory->get_parser(-input => test_input_file('genomic-seq.epcr'),
70                                -method => 'epcr');
72 $seq->flush_SeqFeatures;
74 isa_ok $parser, 'Bio::SeqAnalysisParserI';
75 while( my $feat = $parser->next_feature() ){
76     $seq->add_SeqFeature($feat);
79 is $seq->top_SeqFeatures(), 7;