Debian Codegraph @

t/07_AnnSpec.t

raw symbols SCIP
1 #!/usr/bin/env perl -w
2
3 use TFBS::PatternGen::AnnSpec;
4 use TFBS::PatternGen::SimplePFM;
5 use Test;
6 plan(tests => 7);
7 my $annspecpath;
8 eval {$annspecpath = `which ann-spec 2> /dev/null`;};
9 if (!$annspecpath or ($annspecpath =~ / /)) { # if space, then error message :)
10 print "ok # Skipped: (no AnnSpec executable found)\n"x7;
11 exit(0);
12 }
13
14 my $fastafile = "t/test_meme.fa";
15 #my $fastafile=$ARGV[0];
16
17 for (1..5) {
18 my $patterngen=TFBS::PatternGen::AnnSpec->new(-seq_file=>$fastafile,
19 #-binary=>'ann-spec',
20 -additional_params=>'-P 5 -c'
21 );
22
23 my @pfms = $patterngen->all_patterns();
24
25 my @motifs=$patterngen->all_motifs;
26 if (@motifs>0){
27 ok(1);
28 my @sites=$motifs[0]->get_sites;
29 ok(1,($sites[0]->seq->seq ne ''));
30 my @seqs;
31
32 foreach my $site(@sites){
33 push @seqs,$site->seq->seq;
34 }
35 print $pfms[0]->rawprint;
36 my $seq=$sites[0]->seq->seq;
37 my $patt=TFBS::PatternGen::SimplePFM->new(-seq_list=>\@seqs);
38 my $col_sum=$pfms[0]->matrix->[0]->[0];
39 my $check_sum=$patt->pattern->matrix->[0]->[0];
40
41 ok(1,$col_sum==$check_sum);
42 }
43 if (@pfms>0) {
44 ok(1);
45 ok(1,($pfms[0]->tag("score")>0));
46 last;
47 }
48 }
49
50 ok(1);
51