File: PrositeScan.t

package info (click to toggle)
bioperl 1.7.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 35,788 kB
  • sloc: perl: 94,019; xml: 14,811; makefile: 20
file content (43 lines) | stat: -rw-r--r-- 1,431 bytes parent folder | download | duplicates (2)
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
use strict;

BEGIN {
    use Bio::Root::Test;

    test_begin(-tests => 3);

    use_ok('Bio::Tools::PrositeScan');
    use_ok('Bio::SeqFeature::FeaturePair');
}

# Note: data generated by running
#
#   ./ps_scan.pl --pfscan ./pfscan -d prosite.dat -o fasta \
#       t/data/test.fasta > t/data/ps_scan/out.PrositeScan
#
# followed by a manual removal of some of the output to simplify the test.

subtest "Predictions" => sub {
    my $factory = Bio::Tools::PrositeScan->new(
          '-file'   => test_input_file('ps_scan/out.PrositeScan'),
          '-format' => 'fasta'
    );

    my $expected_matches = [
        { seq_id => 'roa1_drome', coords => [253, 256], psac => 'PS00001', subseq => 'NNSF' },
        { seq_id => 'roa1_drome', coords => [270, 273], psac => 'PS00001', subseq => 'NNSW' },
        { seq_id => 'roa2_drome', coords => [344, 349], psac => 'PS00008', subseq => 'GNNQGF' },
        { seq_id => 'roa2_drome', coords => [217, 355], psac => 'PS50321', subseq => re(qr/NR.{135}NN/) },
    ];

    my $actual_matches = [];
    while( my $match = $factory->next_prediction ) {
        push @$actual_matches, {
            seq_id  =>   $match->seq_id,
            coords  => [ $match->start, $match->end ],
            psac    =>   $match->hseq_id,
            subseq  =>   $match->feature1->seq->seq,
        };
    }

    cmp_deeply( $actual_matches, $expected_matches, 'Comparing parsed prediction input' );
};