1
# This is -*-Perl-*- code
2
## Bioperl Test Harness Script for Modules
4
# $Id: Assembly.t,v 1.7.2.1 2006/10/02 23:10:39 sendu Exp $
6
# Before `make install' is performed this script should be runnable with
7
# `make test'. After `make install' it should work as `perl test.t'
10
use vars qw($NUMTESTS $DEBUG);
11
$DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
16
# to handle systems with no installed Test module
17
# we include the t dir (where a copy of Test.pm is located)
19
eval { require Test; };
27
plan tests => $NUMTESTS;
28
eval { require DB_File };
30
print STDERR "DB_File not installed. This means the Assembly modules are not available. Skipping tests.\n";
32
skip("DB_File not installed",1);
40
foreach ( $Test::ntest..$NUMTESTS) {
41
skip('unable to run all of the DB tests',1);
51
require Bio::Assembly::IO;
52
require Bio::Assembly::Scaffold;
53
require Bio::Assembly::Contig;
54
require Bio::Assembly::ContigAnalysis;
64
# -file => ">".Bio::Root::IO->catfile("t","data","primaryseq.embl")
66
ok my $in = Bio::Assembly::IO->new
67
(-file=>Bio::Root::IO->catfile
68
("t","data","consed_project","edit_dir","test_project.phrap.out"));
70
ok my $sc = $in->next_assembly;
79
ok $sc->id('test'), "test";
82
skip "no annotations in Annotation collection?", $sc->annotation->get_all_annotation_keys, 0;
83
ok $sc->get_nof_contigs, 1;
84
ok $sc->get_nof_sequences_in_contigs, 2;
85
skip "should return a number", $sc->get_nof_singlets, 0;
86
skip $sc->get_seq_ids, 2;
87
skip $sc->get_contig_ids, 1;
88
skip "nothing to test", $sc->get_singlet_ids;
96
# Testing ContigAnalysis
103
my $aio = Bio::Assembly::IO->new(
104
-file=>Bio::Root::IO->catfile
105
("t","data","consed_project","edit_dir","test_project.fasta.screen.ace.2"),
109
my $assembly = $aio->next_assembly();
110
my @contigs = $assembly->all_contigs();
112
my $direction = $contigs[0]->strand;
115
my $features = $contigs[0]->get_features_collection;
116
my @contig_features = $features->get_all_features;
117
ok @contig_features, 8;
119
my @annotations = grep {$_->primary_tag eq 'Annotation'} @contig_features;
122
foreach my $an (@annotations) {
123
if ($an->has_tag('extra_info')) {
125
ok (($an->get_tag_values('extra_info'))[0], "contig extra\ninfo\n");
127
elsif ($an->has_tag('comment')){
129
ok (($an->get_tag_values('comment'))[0], "contig tag\ncomment\n");
b'\\ No newline at end of file'