2
#Some simple tests for meme and transfac parsers
7
# to handle systems with no installed Test module
8
# we include the t dir (where a copy of Test.pm is located)
10
eval { require Test; };
18
use Bio::Matrix::PSM::IO;
22
my $psmIO = new Bio::Matrix::PSM::IO(-format=>'meme',
23
-file=>Bio::Root::IO->catfile(qw(t data meme.dat)));
26
my @inputfile=grep(/datafile/i,$psmIO->unstructured);
29
my $release=$psmIO->release;
35
my %weights=$psmIO->weight;
38
my %seq = $psmIO->seq;
39
ok %seq,'0';#Meme doesn't have seq
41
ok $psmIO->version,'3.0';
43
my $psm = $psmIO->next_psm;
46
my $matrix=$psm->matrix;
49
$psm2->matrix($matrix);
52
my %psm_header=$psm->header;
53
ok $psm_header{IC},38.1;
54
ok $psm_header{sites},4;
55
ok $psm_header{width},25;
56
ok $psm_header{e_val},'1.2e-002';
59
#Quick check if returned object works
60
my $IUPAC=$psm->IUPAC;
61
ok $IUPAC,'CAGAAAAATWVAATYCCCACCHCCC';
62
ok $IUPAC,$psm2->IUPAC;
63
ok $IUPAC,$matrix->IUPAC;
65
my $instances=$psm->instances;
68
foreach my $instance (@{$instances}) {
69
my $id=$instance->primary_id;
73
ok $psm->header('e_val');
74
#Meme parser should be OK if tests passed
77
#Now we are going to try transfac
79
$psmIO = new Bio::Matrix::PSM::IO(-format=>'transfac',
80
-file=> Bio::Root::IO->catfile(qw(t data transfac.dat)));
83
my $version=$psmIO->version;
86
ok $psmIO->release, '6.4--2002-12-02';
91
$psm = $psmIO->next_psm;
94
%weights = $psmIO->weight;
98
ok scalar keys %seq, 0;
100
#Quick check if returned object works
101
$IUPAC = $psm->IUPAC;
102
ok $IUPAC,'NNNNNNNNNNNN';
104
#Now we are going to try mast
105
$psmIO = new Bio::Matrix::PSM::IO(-format=>'mast',
106
-file=>Bio::Root::IO->catfile(qw(t data mast.dat)));
109
@inputfile = grep(/datafile/i,$psmIO->unstructured);
112
ok( $psmIO->release, '2002/04/02 0:11:59');
117
%weights = $psmIO->weight;
118
ok !%weights; #Mast doesn't have weights
120
ok %seq = $psmIO->seq;
122
foreach my $id ($psmIO->hid) {
125
ok $psm=$psmIO->next_psm;
127
my %instances=$psmIO->instances;
130
ok $psmIO->version, '3.0';