File: UCSCParsers.t

package info (click to toggle)
bioperl 1.4-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 20,336 kB
  • ctags: 8,476
  • sloc: perl: 119,890; xml: 6,001; lisp: 121; makefile: 57
file content (98 lines) | stat: -rw-r--r-- 2,366 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# -*-Perl-*-
## Bioperl Test Harness Script for Modules
##

my $error;
use strict;
BEGIN { 
    # to handle systems with no installed Test module
    # we include the t dir (where a copy of Test.pm is located)
    # as a fallback
    $error = 0; 
    eval { require Test; };
    if( $@ ) {
	use lib 't';
    }
    use Test;
    use vars qw($TESTCOUNT);
    $TESTCOUNT = 38;
    plan tests => $TESTCOUNT;
}

use Bio::SearchIO;
use Bio::Root::IO;

my $pslparser = new Bio::SearchIO(-format => 'psl',
				  -file   => Bio::Root::IO->catfile
				  (qw(t data sbay_c545-yeast.BLASTZ.PSL)));

my $result = $pslparser->next_result;
ok($result->query_name, 'I');
ok($result->query_length, 230203);

my $hit    = $result->next_hit;
ok($hit->name, 'sbay_c545');
ok($hit->length, 28791);
my $hsp    = $hit->next_hsp;
ok($hsp->query->start,139871);
ok($hsp->query->end,141473);
my $q_gapblocks = $hsp->gap_blocks('query');
ok(scalar @$q_gapblocks, 24);
ok($q_gapblocks->[0]->[1],45);
ok($q_gapblocks->[1]->[1],10);
ok($q_gapblocks->[1]->[0],139921);


$hsp       = $hit->next_hsp;
$hsp       = $hit->next_hsp;
ok($hsp->hit->start,27302);
ok($hsp->hit->end,27469);
ok($hsp->query->start, 123814);
ok($hsp->query->end, 123973);
ok($hsp->query->strand,-1);

$q_gapblocks = $hsp->gap_blocks('query');
ok(scalar @$q_gapblocks, 4);
ok($q_gapblocks->[0]->[1],116);
ok($q_gapblocks->[1]->[1],4);
ok($q_gapblocks->[1]->[0],123856);


#-----------------------------------


$pslparser = new Bio::SearchIO(-format => 'psl',
			       -file   => Bio::Root::IO->catfile
			       (qw(t data blat.psLayout3)));

$result = $pslparser->next_result;
ok($result->query_name, 'sequence_10');
ok($result->query_length, 1775);

$hit    = $result->next_hit;
ok($hit->name, 'sequence_10');
ok($hit->length, 1775);
$hsp    = $hit->next_hsp;
ok($hsp->query->start,1);
ok($hsp->query->end,1776);
$q_gapblocks = $hsp->gap_blocks('query');
ok(scalar @$q_gapblocks, 1);
ok($q_gapblocks->[0]->[1],1775);
ok($q_gapblocks->[1]->[1],undef);
ok($q_gapblocks->[1]->[0],undef);


$hsp       = $hit->next_hsp;
ok($hsp->hit->start,841);
ok($hsp->hit->end,1245);
ok($hsp->query->start, 841);
ok($hsp->query->end, 1245);
ok($hsp->query->strand,-1);

$q_gapblocks = $hsp->gap_blocks('query');
ok(scalar @$q_gapblocks, 4);
ok($q_gapblocks->[0]->[1],14);
ok($q_gapblocks->[1]->[1],21);
ok($q_gapblocks->[1]->[0],1152);