# this works as a bash include
#
#COMM test SeqLab::MotifRunPWM
#COMM   - independent of front-end SeqMotif.pl
#COMM   - esp. method Search()
#
perl -e '
  use lib shift();  # give include precedence to code directory, perl -I would not work!
  use SeqLab::MotifPWMscan;
  use SeqLab::SeqFormat qw(&SeqentryPopFasta);
  our ($fpwm,$fseq)=@ARGV;
  # load pwm
  our $pPWM = SeqLab::MotifPWMscan->new($fpwm,-debug=>0);
  # read 1st sequence
  my $pSeq=&SeqentryPopFasta($fseq);
  my $pScan = $pPWM->Search($pSeq->{sequence},-strands=>1);
  foreach (@$pScan) {
    printf "%d\t%.3f\n", $_->{offset}+3,log($_->{ScoreExp})/log(10);
  }
  ' -- "$dircode" $dirtest/${setstamp}_search.pwm $dirtest/${setstamp}_search_seq.fa
