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

« back to all changes in this revision

Viewing changes to t/LocalDB/SeqFeature.t

  • Committer: Package Import Robot
  • Author(s): Charles Plessy
  • Date: 2013-09-22 13:39:48 UTC
  • mfrom: (3.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20130922133948-c6z62zegjyp7ztou
Tags: 1.6.922-1
* New upstream release.
* Replaces and Breaks grinder (<< 0.5.3-3~) because of overlaping contents.
  Closes: #722910
* Stop Replacing and Breaking bioperl ( << 1.6.9 ): not needed anymore. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
BEGIN {
8
8
    use lib '.','..','./t/lib';
9
9
    use Bio::Root::Test;
10
 
        
 
10
 
11
11
    test_begin(-tests => TEST_COUNT);
12
 
    
 
12
 
13
13
    $ENV{ORACLE_HOME} ||= '/home/oracle/Home';
14
 
    use_ok('Bio::SeqFeature::Generic'); 
 
14
    use_ok('Bio::SeqFeature::Generic');
15
15
    use_ok('Bio::DB::SeqFeature::Store');
16
16
    use_ok('Bio::DB::SeqFeature::Store::GFF3Loader');
17
17
    use_ok('Bio::Root::IO');
30
30
 
31
31
SKIP: {
32
32
my $db = eval { Bio::DB::SeqFeature::Store->new(@args) };
33
 
skip "DB load failed? Skipping all! $@", (TEST_COUNT - 5) if $@;
 
33
skip "DB load failed? Skipping all! $@", (TEST_COUNT - 6) if $@;
34
34
ok($db);
35
35
 
36
36
is( $db->isa('Bio::SeqFeature::CollectionI'), 1 );
43
43
SKIP: {
44
44
#    skip("skipping memory adaptor-specific tests",27)
45
45
#       unless $db->isa('Bio::DB::SeqFeature::Store::memory');
46
 
        
 
46
 
47
47
 
48
48
# test adding
49
49
    my $n = Bio::SeqFeature::Generic->new(
59
59
    is( scalar @f, 1 );
60
60
    $f = $f[0];
61
61
    is( $f->primary_id, $n->primary_id);
62
 
    
 
62
 
63
63
    $f2 = Bio::SeqFeature::Generic->new(
64
64
        -start        => 10,
65
65
        -end          => 100,
84
84
    ok( @f = $db->types );
85
85
    is( @f, 2 );
86
86
    isa_ok($f[0], 'Bio::DB::GFF::Typename');
87
 
    
 
87
 
88
88
# test removing features
89
89
    ok( $db->delete( $f ), 'feature deletion' );
90
90
    is( $db->fetch( $f->primary_id ), undef );
91
91
    $db->delete( $f2 );
92
92
 
93
93
    ok( $db->store($f, $f2) );
94
 
    
 
94
 
95
95
# test adding seqfeatures
96
96
    $sf1 = Bio::SeqFeature::Generic->new( -primary=>'seqfeat1', -start=>23, -end=>512 );
97
97
    $sf2 = Bio::SeqFeature::Generic->new( -primary=>'seqfeat2', -start=>23, -end=>512 );
100
100
    is $db->add_SeqFeature($f, $sf1), 1;
101
101
    is $db->add_SeqFeature($f, $sf2, $sf3), 2;
102
102
    is $db->add_SeqFeature($f, $sf1, $sf2, $sf3), 3;
103
 
    
 
103
 
104
104
# test fetching seqfeatures
105
105
    is $db->fetch_SeqFeatures($f), 3;
106
106
    is $db->fetch_SeqFeatures($f, 'seqfeat2'), 1;
275
275
 
276
276
 SKIP: {
277
277
     test_skip(-tests => 2, -excludes_os => 'mswin');
278
 
        
 
278
 
279
279
     if (my $child = open(F,"-|")) { # parent reads from child
280
280
         cmp_ok(scalar <F>,'>',0);
281
281
         close F;
338
338
 
339
339
 SKIP: {
340
340
     my $adaptor;
341
 
    
 
341
 
342
342
     for (my $i=0; $i < @args; $i++) {
343
343
         if ($args[$i] eq '-adaptor') {
344
344
             $adaptor = $args[$i+1];
345
345
             last;
346
346
         }
347
347
     }
348
 
        
 
348
 
349
349
     skip "Namespaces only supported for DBI::mysql and DBI::Pg adaptors", 6, if ($adaptor ne 'DBI::mysql' && $adaptor ne 'DBI::Pg');
350
350
 
351
351
     push(@args, ('-namespace', 'bioperl_seqfeature_t_test_schema'));
365
365
     # there should be three subfeatures of type "exon" and three of type "CDS"
366
366
     is($f->get_SeqFeatures('exon'),3);
367
367
     is($f->get_SeqFeatures('CDS'),3);
368
 
    
 
368
 
369
369
     $db->remove_namespace();
370
370
}
371
371
 
378
378
    my $tempdir = test_output_dir();
379
379
    my $test_dbdir = $io->catfile($tempdir, 'dbfa');
380
380
    mkdir($test_dbdir); # make the directory
381
 
    my $indir = test_input_file('dbfa'); 
 
381
    my $indir = test_input_file('dbfa');
382
382
    opendir(INDIR,$indir) || die("cannot open dir $indir");
383
383
    # effectively do a cp -r but only copy the files that are in there, no subdirs
384
384
    for my $file ( map { $io->catfile($indir,$_) } readdir(INDIR) ) {