| 1 | use Test; |
| 2 | use TFBS::Ext::pwmsearch; |
| 3 | use TFBS::Matrix::PFM; |
| 4 | plan(tests=>2); |
| 5 | |
| 6 | |
| 7 | my $matrixstring = |
| 8 | "0 0 0 0 0 0 0 0\n". |
| 9 | "0 12 12 0 12 0 12 12\n". |
| 10 | "0 0 0 12 0 12 0 0\n". |
| 11 | "12 0 0 0 0 0 0 0"; |
| 12 | |
| 13 | my $pfm = TFBS::Matrix::PFM->new(-matrix=>$matrixstring, |
| 14 | -name=>"MyMatrix"); |
| 15 | |
| 16 | my $pwm = $pfm->to_PWM; |
| 17 | my $seq = Bio::SeqIO->new(-file=>"t/test.fa", -format=>"fasta")->next_seq(); |
| 18 | |
| 19 | my $siteset1 = TFBS::Ext::pwmsearch::pwmsearch($pwm, $seq, "60%"); |
| 20 | my $siteset2 = TFBS::Ext::pwmsearch::pwmsearch($pwm, $seq, "60%"); |
| 21 | ok($siteset1->size(), 194); |
| 22 | |
| 23 | #print STDERR "SIZE::".$siteset1->size()."\n"; |
| 24 | |
| 25 | |
| 26 | my $it = $siteset2->Iterator(); |
| 27 | my $startsum = 0; |
| 28 | while (my $site = $it->next()) { |
| 29 | $startsum += $site->start; |
| 30 | } |
| 31 | #print STDERR "STARTSUM::".$startsum."\n"; |
| 32 | |
| 33 | ok($startsum, 457608); |