maint: remove Travis stuff which has been replaced with Github actions (#325)
[bioperl-live.git] / t / SeqFeature / SeqAnalysisParser.t
blob486afac943bfdc0f849f660ee9bf0b035ca45788
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN { 
7     use Bio::Root::Test;
8     
9     test_begin(-tests => 14);
10         
11         use_ok('Bio::Factory::SeqAnalysisParserFactory');
12         use_ok('Bio::SeqIO');
15 my ($seqio,$seq,$factory,$parser, $gene_seen, $exon_seen);
17 $seqio = Bio::SeqIO->new('-format'=>'fasta', '-file' => test_input_file('genomic-seq.fasta'));
18 isa_ok $seqio, 'Bio::SeqIO';
19 $seq = $seqio->next_seq;
20 isa_ok $seq, 'Bio::PrimarySeqI';
22 $factory = Bio::Factory::SeqAnalysisParserFactory->new();
24 # let's test the genscan factory
25 $parser = $factory->get_parser(-input => test_input_file('genomic-seq.genscan'),
26                                   -method => 'genscan');
27 isa_ok $parser, 'Bio::SeqAnalysisParserI';
28 while( my $feat = $parser->next_feature() ){
29     $seq->add_SeqFeature($feat);
31 ($gene_seen, $exon_seen)  = (0,0);
32 foreach my $feat (  $seq->top_SeqFeatures() ) {
33     if( $feat->isa("Bio::Tools::Prediction::Gene") ) {
34         foreach my $exon ( $feat->exons ) {
35             $exon_seen++;
36         }
37         $gene_seen++;
38     } 
40 is $exon_seen, 37;
41 is $gene_seen, 3;
43 # let's test the mzef factory
44 $parser = $factory->get_parser(-input => test_input_file('genomic-seq.mzef'),
45                                -method=> 'mzef');
46 $seqio = Bio::SeqIO->new('-format'=>'fasta', '-file' => test_input_file('genomic-seq.fasta'));
47 ok $seq = $seqio->next_seq();
48 isa_ok $seq, 'Bio::PrimarySeqI';
50 isa_ok $parser, 'Bio::SeqAnalysisParserI';
51 while( my $feat = $parser->next_feature() ){
52     $seq->add_SeqFeature($feat);
54 ($gene_seen, $exon_seen)  = (0,0);
55 foreach my $feat (  $seq->top_SeqFeatures() ) {
56     if( $feat->isa("Bio::Tools::Prediction::Gene") ) {
57         foreach my $exon ( $feat->exons ) { 
58             $exon_seen++;
59         }
60         $gene_seen++;
61     } 
63 is $exon_seen, 23;
64 is $gene_seen, 1;
66 # let's test the ePCR factory
68 $parser = $factory->get_parser(-input => test_input_file('genomic-seq.epcr'),
69                                -method => 'epcr');
71 $seq->flush_SeqFeatures;
73 isa_ok $parser, 'Bio::SeqAnalysisParserI';
74 while( my $feat = $parser->next_feature() ){
75     $seq->add_SeqFeature($feat);
78 is $seq->top_SeqFeatures(), 7;