1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 33,
11 -requires_module => 'Graph');
13 use_ok('Bio::FeatureIO');
22 ################################################################################
24 # use FeatureIO::gff to read a FASTA file.
29 ok( $io = Bio::FeatureIO->new( -file => test_input_file('dna1.fa') ) );
32 while($f = $io->next_feature()){
38 #then try to read sequences again. should get seqs now
39 while($s = $io->next_seq()){
44 ################################################################################
46 # use FeatureIO::gff to read a GFF3 file.
51 ok( $io = Bio::FeatureIO->new( -file => test_input_file('knownGene.gff3') ) );
53 #try to read sequences first. should be undef
54 while($s = $io->next_seq()){
60 while($f = $io->next_feature()){
65 #then try to read sequences again. should still be undef
66 while($s = $io->next_seq()){
71 ################################################################################
73 # use FeatureIO::gff to read a GFF3 file w/ directivized FASTA tail
78 ok( $io = Bio::FeatureIO->new( -file => test_input_file('hybrid1.gff3') ) );
80 #try to read sequences first. should be undef
81 while($s = $io->next_seq()){
87 while($f = $io->next_feature()){
92 #then try to read sequences again.
93 while($s = $io->next_seq()){
98 ################################################################################
100 # use FeatureIO::gff to read a GFF3 file w/ non-directivized FASTA tail
105 ok( $io = Bio::FeatureIO->new( -file => test_input_file('hybrid2.gff3') ) );
107 #try to read sequences first. should be undef
108 while($s = $io->next_seq()){
114 while($f = $io->next_feature()){
119 ################################################################################
121 # use FeatureIO::gff to read a GFF3 file of directives
126 ok( $io = Bio::FeatureIO->new(-file => test_input_file('directives.gff3'),
127 -verbose => test_debug() ? test_debug() : -1));
130 while($f = $io->next_feature()){
133 is($fcount , 1); #sequence-region
135 ################################################################################
137 # use FeatureIO::gff to read a GFF3 file as aggregated feature groups
142 ok( $io = Bio::FeatureIO->new( -file => test_input_file('hybrid1.gff3') ) );
144 #try to read sequences first. should be undef
145 while($s = $io->next_seq()){
151 $f = $io->next_feature_group();
153 $f = $io->next_feature_group();
156 #then try to read sequences again.
157 while($s = $io->next_seq()){
162 ################################################################################
164 # use FeatureIO::gff to read a PTT file.
168 my $ptt_in = Bio::FeatureIO->new(
169 -file => test_input_file('test.ptt'),
174 while (my $f = $ptt_in->next_feature) {
177 # 2491..3423 + 310 24217063 metF LB002 - COG0685E 5,10-methylenetetrahydrofolate reductase
178 is( $f->start , 2491 );
179 is( $f->end , 3423 );
180 cmp_ok( $f->strand, '>', 0 );
181 is( ($f->get_tag_values('PID'))[0],'24217063' );
182 is( ($f->get_tag_values('Gene'))[0], 'metF' );
183 is( ($f->get_tag_values('Synonym'))[0], 'LB002' );
184 ok( ! $f->has_tag('Code') );
185 is( ($f->get_tag_values('COG'))[0],'COG0685E' );
186 is( ($f->get_tag_values('Product'))[0], '5,10-methylenetetrahydrofolate reductase' );