1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 14);
12 use_ok('Bio::Matrix::PSM::IO');
15 # Test psiblast reading functionality.
16 my $psmIO = Bio::Matrix::PSM::IO->new(-format => 'psiblast',
17 -file => test_input_file('atp1.matrix'));
20 my $psm = $psmIO->next_psm;
23 # Verify that getting IUPAC sequence is functional
24 my $IUPAC = 'MEMSINPSEISSIIKEQIENYDTKAEVSEVGTVLSVGDGIARVYGLDNVMAGEMVEFPSGVKGMALNLEEDNVGVVLLGDDTGIKEGDLVKRTGKIVEVPVGEALLGRVVDPLGNPIDAKGPIKTDERRPVEVKAPGIIPRKSVHEPLQTGLKAIDSLVPIGRGQRELIIGDRQTGKTAIAIDTIINQKRINDESTDEGKKVYCIYVAIGQKRSTVAQVVQTLREAGALEYTIIVAATAAAPAPAQYLSAYAGCAIGEAFADNGAAACIIHDDLSRQAVAYAIISLLLRRPPGREAYPGDVFYLHSRLLERAAKLSDELGGGSLTALPIIETQAGDVSAYIPTNVISITDGQIFLETDLFNSGIRPAINVGLSVSRVGSAAQIKAMKKVAGSLKLELAQYRELAAFAQFGSDLDAATQAQLNRGARLTELLKQPQYSPLPVEEQVVILYAGVNGYLDDIPVEDIRDFEKELLEYLKSNHPEILESIRTGKLSDEIEKALKEAIKEFV';
25 is $psm->IUPAC, $IUPAC;
27 ## Lets try to compress and uncompress the log odds and the
28 ## frequencies, see if there is no considerable loss of data.
30 skip('TODO: Module incomplete',10);
31 my $fA=$psm->get_compressed_freq('A');
32 my @check=Bio::Matrix::PSM::SiteMatrix::_uncompress_string($fA,1,1);
33 my @A=$psm->get_array('A');
34 my ($var,$max) = (0,0);
36 for (my $i = 0; $i<@check;$i++) {
37 my $diff=abs(abs($check[$i])-abs($A[$i]));
39 $max=$diff if ($diff>$max);
42 cmp_ok $avg,'<',0.01; #Loss of data under 1 percent
43 is $psm->sequence_match_weight('CAGAAAAATAAAATGGCCACCACCC'),2015;
45 my $lA=$psm->get_compressed_logs('A');
46 @check=Bio::Matrix::PSM::SiteMatrix::_uncompress_string($lA,1000,2);
47 @A=$psm->get_logs_array('A');
49 for (my $i = 0;$i<@check;$i++) {
50 my $diff=abs(abs($check[$i])-abs($A[$i]));
52 $max=$diff if ($diff>$max);
55 cmp_ok $avg,'<',10; #Loss of data under 1 percent
57 my $matrix=$psm->matrix;
60 $psm2->matrix($matrix);
63 is $IUPAC,'CAGAAAAATWVAATYCCCACCHCCC';
64 is $IUPAC,$psm2->IUPAC;
65 is $IUPAC,$matrix->IUPAC;
67 my $instances=$psm->instances;
70 foreach my $instance (@{$instances}) {
71 my $id=$instance->primary_id;
72 is $instance->strand,1;