~ubuntu-branches/ubuntu/trusty/bioperl/trusty-proposed

« back to all changes in this revision

Viewing changes to t/Assembly.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# This is -*-Perl-*- code
2
 
## Bioperl Test Harness Script for Modules
3
 
##
4
 
# $Id: Assembly.t,v 1.7.2.1 2006/10/02 23:10:39 sendu Exp $
5
 
 
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'
8
 
 
9
 
use strict;
10
 
use vars qw($NUMTESTS $DEBUG);
11
 
$DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
12
 
 
13
 
my $error;
14
 
 
15
 
BEGIN {
16
 
    # to handle systems with no installed Test module
17
 
    # we include the t dir (where a copy of Test.pm is located)
18
 
    # as a fallback
19
 
    eval { require Test; };
20
 
    $error = 0;
21
 
    if( $@ ) {
22
 
        use lib 't';
23
 
    }
24
 
    use Test;
25
 
 
26
 
    $NUMTESTS = 19;
27
 
    plan tests => $NUMTESTS;
28
 
    eval { require DB_File };
29
 
    if( $@ ) {
30
 
                 print STDERR "DB_File not installed. This means the Assembly modules are not available.  Skipping tests.\n";
31
 
                 for( 1..$NUMTESTS ) {
32
 
                         skip("DB_File not installed",1);
33
 
                 }
34
 
                 $error = 1; 
35
 
    }
36
 
}
37
 
 
38
 
 
39
 
END {
40
 
        foreach ( $Test::ntest..$NUMTESTS) {
41
 
                skip('unable to run all of the DB tests',1);
42
 
        }
43
 
}
44
 
 
45
 
if( $error ==  1 ) {
46
 
    exit(0);
47
 
}
48
 
 
49
 
#syntax test
50
 
 
51
 
require Bio::Assembly::IO;
52
 
require Bio::Assembly::Scaffold;
53
 
require Bio::Assembly::Contig;
54
 
require Bio::Assembly::ContigAnalysis;
55
 
 
56
 
use Data::Dumper;
57
 
 
58
 
ok 1;
59
 
 
60
 
#
61
 
# Testing IO
62
 
#
63
 
 
64
 
# -file => ">".Bio::Root::IO->catfile("t","data","primaryseq.embl")
65
 
 
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"));
69
 
 
70
 
ok my $sc = $in->next_assembly;
71
 
#print Dumper $sc;
72
 
 
73
 
#
74
 
# Testing Scaffold
75
 
#
76
 
 
77
 
 
78
 
ok $sc->id, "NoName";
79
 
ok $sc->id('test'), "test";
80
 
 
81
 
ok $sc->annotation;
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;
89
 
 
90
 
 
91
 
#
92
 
# Testing Contig
93
 
#
94
 
 
95
 
#
96
 
# Testing ContigAnalysis
97
 
#
98
 
 
99
 
#
100
 
# Testing Ace 
101
 
#
102
 
 
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"),
106
 
    -format=>'ace',
107
 
);
108
 
 
109
 
my $assembly = $aio->next_assembly();
110
 
my @contigs = $assembly->all_contigs();
111
 
 
112
 
my $direction = $contigs[0]->strand;
113
 
ok $direction, 1;
114
 
 
115
 
my $features =  $contigs[0]->get_features_collection;
116
 
my @contig_features = $features->get_all_features;
117
 
ok @contig_features, 8;
118
 
 
119
 
my @annotations = grep {$_->primary_tag eq 'Annotation'} @contig_features;
120
 
ok @annotations, 2;
121
 
my $had_tag = 0;
122
 
foreach my $an (@annotations) {
123
 
        if ($an->has_tag('extra_info')) {
124
 
                $had_tag++;
125
 
                ok (($an->get_tag_values('extra_info'))[0], "contig extra\ninfo\n");
126
 
        }
127
 
        elsif ($an->has_tag('comment')){
128
 
                $had_tag++;
129
 
                ok (($an->get_tag_values('comment'))[0], "contig tag\ncomment\n");
130
 
        }
131
 
}
132
 
ok $had_tag, 2;
 
 
b'\\ No newline at end of file'