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 52 53 54 55 56 57
|
#!/usr/bin/env perl
use strict;
use warnings;
use Carp;
use Getopt::Long qw(:config posix_default no_ignore_case bundling pass_through);
use FindBin;
use lib ("$FindBin::Bin/../PerlLib");
use PWM;
my $usage = <<__EOUSAGE__;
#####################################################################
#
# --pwm <string> pwm file
#
# --num_features <int> number of features to simulate
#
#####################################################################
__EOUSAGE__
;
my $help_flag;
my $pwm_file;
my $num_features;
&GetOptions ( 'h' => \$help_flag,
'pwm=s' => \$pwm_file,
'num_features=i' => \$num_features,
);
if ($help_flag) {
die $usage;
}
unless ($pwm_file && $num_features) {
die $usage;
}
main: {
my $pwm = new PWM();
$pwm->load_pwm_from_file($pwm_file);
for (1..$num_features) {
my $feature_seq = $pwm->simulate_feature();
print "$feature_seq\n";
}
exit(0);
}
|