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

« back to all changes in this revision

Viewing changes to t/Assembly/IO/bowtie.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:
9
9
    test_begin( -tests => 796,
10
10
                -requires_modules => [
11
11
                    'DB_File',
 
12
                    'Bio::DB::Sam',
12
13
                    'Bio::Tools::Run::Samtools',
13
14
                   ],
14
15
               );
23
24
 
24
25
use Bio::Root::IO;
25
26
 
26
 
my ($aio, $assembly, @contig_seq_ids, @singlet_ids, @contig_ids, @all_seq_ids);
27
 
 
28
 
my $file = 'test.bowtie';
29
 
my $refdb = 'test.ref.fas';
30
 
ok $aio = Bio::Assembly::IO->new( -file => test_input_file($file),
31
 
                  -index => test_input_file($refdb),
32
 
                  -format => 'bowtie' ), "init bowtie IO object";
33
 
isa_ok($aio, 'Bio::Assembly::IO');
34
 
$aio->_current_refseq_id( ($aio->sam->seq_ids)[0] ); # kludge
35
 
 
36
 
while (my $contig = $aio->next_contig) {
37
 
isa_ok($contig, 'Bio::Assembly::Contig');
38
 
}
39
 
ok $aio = Bio::Assembly::IO->new( -file => test_input_file($file),
40
 
                  -index => test_input_file($refdb),
41
 
                  -format => 'bowtie' ),"reopen";
42
 
ok $assembly = $aio->next_assembly, "get sam assy";
43
 
is( $assembly->get_nof_contigs, 23, "got all contigs");
44
 
 
45
 
ok(@contig_seq_ids = $assembly->get_contig_seq_ids, "get_contig_seq_ids");
46
 
is(@contig_seq_ids, 312);
47
 
for my $contig_seq_id (@contig_seq_ids) {
48
 
ok ($contig_seq_id =~ m/^SRR/i);
49
 
}
50
 
ok(@contig_ids = $assembly->get_contig_ids, "get_contig_ids");
51
 
is(@contig_ids, 23);
52
 
for my $contig_id (@contig_ids) {
53
 
ok ($contig_id =~ m/sam_assy/i);
54
 
}
55
 
ok(@singlet_ids = $assembly->get_singlet_ids, "get_singlet_ids");
56
 
is(@singlet_ids, 36);
57
 
for my $singlet_id (@singlet_ids) {
58
 
ok ($singlet_id =~ m/^sam_assy/i);
59
 
}
60
 
ok(@all_seq_ids = $assembly->get_all_seq_ids, "get_all_seq_ids");
61
 
for my $seq_id (@all_seq_ids) {
62
 
ok ($seq_id =~ m/^SRR/i);
63
 
}
64
 
is(@all_seq_ids, 348);
65
 
 
 
27
SKIP: {
 
28
    skip("SAMTOOLSDIR not set, skipping", 791) unless exists $ENV{SAMTOOLSDIR};
 
29
 
 
30
    my ($aio, $assembly, @contig_seq_ids, @singlet_ids, @contig_ids, @all_seq_ids);
 
31
 
 
32
    my $file = 'test.bowtie';
 
33
    my $refdb = 'test.ref.fas';
 
34
    ok $aio = Bio::Assembly::IO->new( -file => test_input_file($file),
 
35
                      -index => test_input_file($refdb),
 
36
                      -format => 'bowtie' ), "init bowtie IO object";
 
37
    isa_ok($aio, 'Bio::Assembly::IO');
 
38
    $aio->_current_refseq_id( ($aio->sam->seq_ids)[0] ); # kludge
 
39
 
 
40
    while (my $contig = $aio->next_contig) {
 
41
    isa_ok($contig, 'Bio::Assembly::Contig');
 
42
    }
 
43
    ok $aio = Bio::Assembly::IO->new( -file => test_input_file($file),
 
44
                      -index => test_input_file($refdb),
 
45
                      -format => 'bowtie' ),"reopen";
 
46
    ok $assembly = $aio->next_assembly, "get sam assy";
 
47
    is( $assembly->get_nof_contigs, 23, "got all contigs");
 
48
 
 
49
    ok(@contig_seq_ids = $assembly->get_contig_seq_ids, "get_contig_seq_ids");
 
50
    is(@contig_seq_ids, 312);
 
51
    for my $contig_seq_id (@contig_seq_ids) {
 
52
    ok ($contig_seq_id =~ m/^SRR/i);
 
53
    }
 
54
    ok(@contig_ids = $assembly->get_contig_ids, "get_contig_ids");
 
55
    is(@contig_ids, 23);
 
56
    for my $contig_id (@contig_ids) {
 
57
    ok ($contig_id =~ m/sam_assy/i);
 
58
    }
 
59
    ok(@singlet_ids = $assembly->get_singlet_ids, "get_singlet_ids");
 
60
    is(@singlet_ids, 36);
 
61
    for my $singlet_id (@singlet_ids) {
 
62
    ok ($singlet_id =~ m/^sam_assy/i);
 
63
    }
 
64
    ok(@all_seq_ids = $assembly->get_all_seq_ids, "get_all_seq_ids");
 
65
    for my $seq_id (@all_seq_ids) {
 
66
    ok ($seq_id =~ m/^SRR/i);
 
67
    }
 
68
    is(@all_seq_ids, 348);
 
69
 
 
70
}
66
71
exit;