| 1 | #!/usr/bin/env perl -w |
| 2 | |
| 3 | |
| 4 | use TFBS::PatternGen::Elph; |
| 5 | use TFBS::PatternGen::SimplePFM; |
| 6 | |
| 7 | use Test; |
| 8 | plan(tests => 5); |
| 9 | my $gibbspath; |
| 10 | eval {$gibbspath = `which elph 2> /dev/null`;}; |
| 11 | if (!$gibbspath or ($gibbspath =~ / /)) { # if space, then error message :) |
| 12 | print "ok # Skipped: (no elph executable found)\n"x5; |
| 13 | exit(0); |
| 14 | } |
| 15 | |
| 16 | my $fastafile = "t/test_meme.fa"; |
| 17 | #my $fastafile = $ARGV[0]; |
| 18 | |
| 19 | for (1..5) { |
| 20 | my $elph = |
| 21 | TFBS::PatternGen::Elph->new |
| 22 | (-motif_length=>7, |
| 23 | |
| 24 | -seq_file=>$fastafile, |
| 25 | -additional_params=>'-l -x -b -g -v' |
| 26 | |
| 27 | ); |
| 28 | # print Dumper $elph; |
| 29 | my $pfm_elph = $elph->pattern(); |
| 30 | my @pfms=$elph->all_patterns; |
| 31 | my @motifs=$elph->all_motifs; |
| 32 | if (@motifs>0){ |
| 33 | ok(1); |
| 34 | my @sites=$motifs[0]->get_sites; |
| 35 | ok(1,($sites[0]->seq->seq ne '')); |
| 36 | my @matrix; |
| 37 | foreach my $site(@sites){ |
| 38 | push @matrix,$site->seq->seq; |
| 39 | |
| 40 | } |
| 41 | my $patt=TFBS::PatternGen::SimplePFM->new(-seq_list=>\@matrix); |
| 42 | my $col_sum=$elph->pattern->matrix->[0]->[0]; |
| 43 | my $check_sum=$patt->pattern->matrix->[0]->[0]; |
| 44 | |
| 45 | ok(1,$col_sum==$check_sum); |
| 46 | } |
| 47 | # } |
| 48 | if (@pfms>0) { |
| 49 | ok(1); |
| 50 | # ok(1,($pfms[0]->tag("MAP_score")>0)); |
| 51 | last; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | ok(1); |
| 56 |