File: 07_AnnSpec.t

package info (click to toggle)
libtfbs-perl 0.7.1%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,992 kB
  • sloc: perl: 10,728; ansic: 1,228; makefile: 560; sh: 9
file content (51 lines) | stat: -rw-r--r-- 1,317 bytes parent folder | download | duplicates (8)
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
#!/usr/bin/env perl -w

use TFBS::PatternGen::AnnSpec;
use TFBS::PatternGen::SimplePFM;
use Test;
plan(tests => 7);
my $annspecpath;
eval {$annspecpath = `which ann-spec 2> /dev/null`;};
if (!$annspecpath or ($annspecpath =~ / /)) { # if space, then error message :)
    print "ok # Skipped: (no AnnSpec executable found)\n"x7;
	exit(0);
}

my $fastafile = "t/test_meme.fa";
#my $fastafile=$ARGV[0];

for (1..5) {
    my $patterngen=TFBS::PatternGen::AnnSpec->new(-seq_file=>$fastafile,
                                            #-binary=>'ann-spec',
                                            -additional_params=>'-P 5 -c'
                                             );
   
    my @pfms = $patterngen->all_patterns();
    
    my @motifs=$patterngen->all_motifs;
    if (@motifs>0){
	ok(1);
	my @sites=$motifs[0]->get_sites;
	ok(1,($sites[0]->seq->seq ne ''));
	my @seqs;
	
        foreach my $site(@sites){
            push @seqs,$site->seq->seq;
        }
        print $pfms[0]->rawprint;
        my $seq=$sites[0]->seq->seq;
        my $patt=TFBS::PatternGen::SimplePFM->new(-seq_list=>\@seqs);
	my $col_sum=$pfms[0]->matrix->[0]->[0];
	my $check_sum=$patt->pattern->matrix->[0]->[0];
	
	ok(1,$col_sum==$check_sum);
    }
    if (@pfms>0) {
	ok(1);
	ok(1,($pfms[0]->tag("score")>0));
	last;
    }
}

ok(1);