1 # -*-Perl-*- Test Harness script for Bioperl
11 test_begin(-tests => 14);
13 use_ok('Bio::Matrix::PSM::IO');
16 # Test psiblast reading functionality.
17 my $psmIO = Bio::Matrix::PSM::IO->new(-format => 'psiblast',
18 -file => test_input_file('atp1.matrix'));
21 my $psm = $psmIO->next_psm;
24 # Verify that getting IUPAC sequence is functional
25 my $IUPAC = 'MEMSINPSEISSIIKEQIENYDTKAEVSEVGTVLSVGDGIARVYGLDNVMAGEMVEFPSGVKGMALNLEEDNVGVVLLGDDTGIKEGDLVKRTGKIVEVPVGEALLGRVVDPLGNPIDAKGPIKTDERRPVEVKAPGIIPRKSVHEPLQTGLKAIDSLVPIGRGQRELIIGDRQTGKTAIAIDTIINQKRINDESTDEGKKVYCIYVAIGQKRSTVAQVVQTLREAGALEYTIIVAATAAAPAPAQYLSAYAGCAIGEAFADNGAAACIIHDDLSRQAVAYAIISLLLRRPPGREAYPGDVFYLHSRLLERAAKLSDELGGGSLTALPIIETQAGDVSAYIPTNVISITDGQIFLETDLFNSGIRPAINVGLSVSRVGSAAQIKAMKKVAGSLKLELAQYRELAAFAQFGSDLDAATQAQLNRGARLTELLKQPQYSPLPVEEQVVILYAGVNGYLDDIPVEDIRDFEKELLEYLKSNHPEILESIRTGKLSDEIEKALKEAIKEFV';
26 is $psm->IUPAC, $IUPAC;
28 ## Lets try to compress and uncompress the log odds and the
29 ## frequencies, see if there is no considerable loss of data.
31 skip('TODO: Module incomplete',10);
32 my $fA=$psm->get_compressed_freq('A');
33 my @check=Bio::Matrix::PSM::SiteMatrix::_uncompress_string($fA,1,1);
34 my @A=$psm->get_array('A');
35 my ($var,$max) = (0,0);
37 for (my $i = 0; $i<@check;$i++) {
38 my $diff=abs(abs($check[$i])-abs($A[$i]));
40 $max=$diff if ($diff>$max);
43 cmp_ok $avg,'<',0.01; #Loss of data under 1 percent
44 is $psm->sequence_match_weight('CAGAAAAATAAAATGGCCACCACCC'),2015;
46 my $lA=$psm->get_compressed_logs('A');
47 @check=Bio::Matrix::PSM::SiteMatrix::_uncompress_string($lA,1000,2);
48 @A=$psm->get_logs_array('A');
50 for (my $i = 0;$i<@check;$i++) {
51 my $diff=abs(abs($check[$i])-abs($A[$i]));
53 $max=$diff if ($diff>$max);
56 cmp_ok $avg,'<',10; #Loss of data under 1 percent
58 my $matrix=$psm->matrix;
61 $psm2->matrix($matrix);
64 is $IUPAC,'CAGAAAAATWVAATYCCCACCHCCC';
65 is $IUPAC,$psm2->IUPAC;
66 is $IUPAC,$matrix->IUPAC;
68 my $instances=$psm->instances;
71 foreach my $instance (@{$instances}) {
72 my $id=$instance->primary_id;
73 is $instance->strand,1;