diff --git a/lib/SGN/Controller/motifs_finder.pm b/lib/SGN/Controller/motifs_finder.pm
index 91715048f5..62cbe455c3 100644
--- a/lib/SGN/Controller/motifs_finder.pm
+++ b/lib/SGN/Controller/motifs_finder.pm
@@ -52,240 +52,240 @@ sub name_var :Path('/test/') :Args(0) {
my @errors;
# to generate temporary file name for the analysis
- my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/static/documents/tempfiles/motifs_finder/");
+ my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
#my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
-
+
print STDERR Dumper($filename);
- if ($sequence !~ /^>/ && $seq_file eq '') {
- push ( @errors , "Please, paste sequences or attach sequence file.
Ensure your sequence conform with 'usage help' description.\n");
+ if ($sequence !~ /^>/ && $seq_file eq '') {
+ push ( @errors , "Please, paste sequences or attach sequence file.
Ensure your sequence conform with 'usage help' description.\n");
+ }
+
+ # To send error file to index.mas
+ if (scalar (@errors) > 0){
+ my $user_errors = join("
", @errors);
+ $c->stash->{error_msg} = join("
", @errors);
+ $c->stash->{template} = '/tools/motifs_finder/index.mas';
+ return;
+ }
+ else {
+ # If no error prepare the sequence file for sampling
+ if ($sequence =~ /^>/) {
+ $sequence =~ s/[ \,\-\.\#\(\)\%\'\"\[\]\{\}\:\;\=\+\\\/]/_/gi;
+ @seq = split(/\s/,$sequence);
+
+ #to open and write and print the input file
+ open (my $out_fh, ">", $filename."_input.txt") || die ("\nERROR: the file ".$filename."_input.txt could not be found\n");
+ print $out_fh join("\n",@seq);
+
+ # to run Gibbs motifs sampler
+ my $err = system("$cluster_shared_bindir/Gibbs.linux ".$filename."_input.txt $widths_of_motifs $numbers_of_sites -W 0.8 -w 0.1 -p 50 -j 5 -i 500 $fragmentation $rev_complement -Z -S $no_of_seeds -C 0.5 -y -nopt -o ".$filename."_output -n");
+ print STDOUT "print $err\n";
+ }
+ elsif ($seq_file) {
+ my $err = system("$cluster_shared_bindir/Gibbs.linux $seq_file $widths_of_motifs $numbers_of_sites -W 0.8 -w 0.1 -p 50 -j 5 -i 500 $fragmentation $rev_complement -Z -S $no_of_seeds -C 0.5 -y -nopt -o ".$filename."_output -n");
+ print STDOUT "print $err\n";
+ }
+
+ open (my $output_fh, "<", $filename."_output") || die ("\nERROR: the file ".$filename."_output could not be found\n"); # open sampler output file and write into a FH
+
+ # Creating motifs fasta file for weblogo use and other files that are made into tables in the output.mas
+
+ my $switch = 0;
+ my $motif = 0;
+ my $switch_logo = 0;
+ my $logo = 0;
+ my @string_result;
+ my $logo_file;
+ my $wl_out_fh;
+ my @motif_element;
+ my @logo_image;
+ my @logofile_id;
+ my $lf_id;
+ my @motif_width;
+ my @aa;
+ my @motif_table_file;
+ my $motif_tab_fh;
+ my $motif_tab;
+ my $freq_tab_switch = 0;
+ my $freq_tab_fh;
+ my $freq_tab = 0;
+ my $freq_tab_file;
+ my @freq_tab;
+ my $prob_tab_switch = 0;
+ my $prob_tab_fh;
+ my $prob_tab = 0;
+ my $prob_tab_file;
+ my @prob_tab;
+ my $BGPM_tab_switch = 0;
+ my $BGPM_tab_fh;
+ my $BGPM_tab = 0;
+ my $BGPM_tab_file;
+ my @BGPM_tab;
+ my $sum_indv_tab_switch = 0;
+ my $sum_indv_tab_fh;
+ my $sum_indv_tab = 0;
+ my $sum_indv_tab_file;
+ my @sum_indv_tab;
+ my $sum = 0;
+ my $switch_sum = 0;
+ my @sum;
+
+ while (my $line = <$output_fh>) {
+ chomp $line;
+ push @string_result, $line;
+ if ($line =~ m/^Log\sBackground\sportion\sof\sMap\s\=\s/){
+ $sum = 1;
+ }
+ if ($sum == 1) {
+ $switch_sum++;
+ push @sum, $line;
+ if ($line =~ m/^Elapsed\stime:\s+/) {
+ $sum = 0;
+ }
+ }
+ if ($motif == 1){
+ $switch++;
+ if ($logo == 1 && $line !~ m/^\s+\*+/ ) {
+ $switch_logo++;
+ my @a = split(/\s+/,$line);
+ print $wl_out_fh ">seq_$switch_logo\n$a[5]\n";
+ @aa = split(/\s+/,$line);
+ print $motif_tab_fh "$line\n";
+ }
+ if ($line =~ m/^Num\sMotifs/ ) {
+ $logo = 1;
+ open ($wl_out_fh, ">", $logo_file) || die ("\nERROR: the file $logo_file could not be found\n");
+ push @motif_element, $logo_file;
+ push @logofile_id, $lf_id;
+ @motif_width = split (/,/,$widths_of_motifs);
+ print "logo file ID: @logofile_id\n";
+ print "motif lenght: @motif_width\n";
+ open ($motif_tab_fh, ">", $motif_tab) || die ("\nERROR: the file $motif_tab could not be found\n");
+ push @motif_table_file, $motif_tab;
+ }
+ elsif ($line =~ m/^\s+\*+/ ) {
+ $logo = 0;
+ my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
+ #my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
+ }
+ if ($freq_tab == 1) {
+ $freq_tab_switch++;
+ print $freq_tab_fh "$line\n";
+ }
+ if ($line =~ m/^Motif\smodel/ ) {
+ $freq_tab = 1;
+ open ($freq_tab_fh, ">", $freq_tab_file) || die ("\nERROR: the file $freq_tab could not be found\n");
+ push @freq_tab, $freq_tab_file;
+ print "FREQ TABLE: $freq_tab[0]\n";
+ }
+ elsif ($line =~ m/^site\s+/ ) {
+ $freq_tab = 0;
+ my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
+ #my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
+ }
+ if ($prob_tab == 1 && $line !~ m/^Background\sprobability\smodel/) {
+ $prob_tab_switch++;
+ print $prob_tab_fh "$line\n";
+ }
+ if ($line =~ m/^Motif\sprobability\smodel/ ) {
+ $prob_tab = 1;
+ open ($prob_tab_fh, ">", $prob_tab_file) || die ("\nERROR: the file $prob_tab_file could not be found\n");
+ push @prob_tab, $prob_tab_file;
+ }
+ elsif ($line =~ m/^Background\sprobability\smodel/ ) {
+ $prob_tab = 0;
+ #my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
+ my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
+ }
+ if ($BGPM_tab == 1) {
+ $BGPM_tab_switch++;
+ print $BGPM_tab_fh "$line\n";
+ }
+ if ($line =~ m/^Background\sprobability\smodel/ ) {
+ $BGPM_tab = 1;
+ open ($BGPM_tab_fh, ">", $BGPM_tab_file) || die ("\nERROR: the file $BGPM_tab_file could not be found\n");
+ push @BGPM_tab, $BGPM_tab_file;
+ }
+ elsif ($line =~ m/^\s+\d\.\d+\s\d\.\d+\s/ ) {
+ $BGPM_tab = 0;
+ my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
+ #my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
+ }
+ if ($sum_indv_tab == 1 ) {
+ $sum_indv_tab_switch++;
+ print $sum_indv_tab_fh "$line\n";
+ print "FREQ LINES: $line\n";
+ }
+ if ($line =~ m/^Column\s\d\s:\s+Sequence\sDescription\sfrom\s/ ) {
+ $sum_indv_tab = 1;
+ open ($sum_indv_tab_fh, ">", $sum_indv_tab_file) || die ("\nERROR: the file $sum_indv_tab_file could not be found\n");
+ push @sum_indv_tab, $sum_indv_tab_file;
+ }
+ elsif ($line =~ m/^Log\sFragmentation\sportion\sof\sMAP\sfor\smotif\s/ ) {
+ $sum_indv_tab = 0;
+ my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
+ #my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
+ }
+ }
+ if ($line =~ m/^\s+MOTIF\s+([a-z])/){
+ $motif = 1;
+ $logo_file = $filename."_".$1."_wl_input.fasta";
+ $lf_id = $1;
+ $motif_tab = $filename."_".$1;
+ $freq_tab_file = $filename."_freq_".$1;
+ $prob_tab_file = $filename."_prob_".$1;
+ $BGPM_tab_file = $filename."_BGPM_".$1;
+ $sum_indv_tab_file = $filename."_sum_indv_".$1;
+ }
+ elsif ($line =~ m/^Log\s+Fragmentation\s+portion\s+/ ) {
+ $motif = 0;
+ close $wl_out_fh;
+ close $motif_tab_fh;
+ close $freq_tab_fh;
+ close $prob_tab_fh;
+ close $BGPM_tab_fh;
+ close $sum_indv_tab_fh;
+ }
}
- # To send error file to index.mas
- if (scalar (@errors) > 0){
- my $user_errors = join("
", @errors);
- $c->stash->{error_msg} = join("
", @errors);
- $c->stash->{template} = '/tools/motifs_finder/index.mas';
- return;
+ my @values_motif;
+ my $motif_table_value;
+ foreach my $filename (@motif_table_file){
+ $motif_table_value = get_result_table($filename);
+ push @values_motif, $motif_table_value;
+ }
+ my $freq_tab_value;
+ my @value_freq_tab;
+ foreach my $filename (@freq_tab) {
+ $freq_tab_value = get_freq_table($filename);
+ push @value_freq_tab, $freq_tab_value;
}
- else {
- # If no error prepare the sequence file for sampling
- if ($sequence =~ /^>/) {
- $sequence =~ s/[ \,\-\.\#\(\)\%\'\"\[\]\{\}\:\;\=\+\\\/]/_/gi;
- @seq = split(/\s/,$sequence);
-
- #to open and write and print the input file
- open (my $out_fh, ">", $filename."_input.txt") || die ("\nERROR: the file ".$filename."_input.txt could not be found\n");
- print $out_fh join("\n",@seq);
-
- # to run Gibbs motifs sampler
- my $err = system("$cluster_shared_bindir/Gibbs.linux ".$filename."_input.txt $widths_of_motifs $numbers_of_sites -W 0.8 -w 0.1 -p 50 -j 5 -i 500 $fragmentation $rev_complement -Z -S $no_of_seeds -C 0.5 -y -nopt -o ".$filename."_output -n");
- print STDOUT "print $err\n";
- }
- elsif ($seq_file) {
- my $err = system("$cluster_shared_bindir/Gibbs.linux $seq_file $widths_of_motifs $numbers_of_sites -W 0.8 -w 0.1 -p 50 -j 5 -i 500 $fragmentation $rev_complement -Z -S $no_of_seeds -C 0.5 -y -nopt -o ".$filename."_output -n");
- print STDOUT "print $err\n";
- }
-
- open (my $output_fh, "<", $filename."_output") || die ("\nERROR: the file ".$filename."_output could not be found\n"); # open sampler output file and write into a FH
-
- # Creating motifs fasta file for weblogo use and other files that are made into tables in the output.mas
-
- my $switch = 0;
- my $motif = 0;
- my $switch_logo = 0;
- my $logo = 0;
- my @string_result;
- my $logo_file;
- my $wl_out_fh;
- my @motif_element;
- my @logo_image;
- my @logofile_id;
- my $lf_id;
- my @motif_width;
- my @aa;
- my @motif_table_file;
- my $motif_tab_fh;
- my $motif_tab;
- my $freq_tab_switch = 0;
- my $freq_tab_fh;
- my $freq_tab = 0;
- my $freq_tab_file;
- my @freq_tab;
- my $prob_tab_switch = 0;
- my $prob_tab_fh;
- my $prob_tab = 0;
- my $prob_tab_file;
- my @prob_tab;
- my $BGPM_tab_switch = 0;
- my $BGPM_tab_fh;
- my $BGPM_tab = 0;
- my $BGPM_tab_file;
- my @BGPM_tab;
- my $sum_indv_tab_switch = 0;
- my $sum_indv_tab_fh;
- my $sum_indv_tab = 0;
- my $sum_indv_tab_file;
- my @sum_indv_tab;
- my $sum = 0;
- my $switch_sum = 0;
- my @sum;
-
- while (my $line = <$output_fh>) {
- chomp $line;
- push @string_result, $line;
- if ($line =~ m/^Log\sBackground\sportion\sof\sMap\s\=\s/){
- $sum = 1;
- }
- if ($sum == 1) {
- $switch_sum++;
- push @sum, $line;
- if ($line =~ m/^Elapsed\stime:\s+/) {
- $sum = 0;
- }
- }
- if ($motif == 1){
- $switch++;
- if ($logo == 1 && $line !~ m/^\s+\*+/ ) {
- $switch_logo++;
- my @a = split(/\s+/,$line);
- print $wl_out_fh ">seq_$switch_logo\n$a[5]\n";
- @aa = split(/\s+/,$line);
- print $motif_tab_fh "$line\n";
- }
- if ($line =~ m/^Num\sMotifs/ ) {
- $logo = 1;
- open ($wl_out_fh, ">", $logo_file) || die ("\nERROR: the file $logo_file could not be found\n");
- push @motif_element, $logo_file;
- push @logofile_id, $lf_id;
- @motif_width = split (/,/,$widths_of_motifs);
- print "logo file ID: @logofile_id\n";
- print "motif lenght: @motif_width\n";
- open ($motif_tab_fh, ">", $motif_tab) || die ("\nERROR: the file $motif_tab could not be found\n");
- push @motif_table_file, $motif_tab;
- }
- elsif ($line =~ m/^\s+\*+/ ) {
- $logo = 0;
- my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/static/documents/tempfiles/motifs_finder/");
- #my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
- }
- if ($freq_tab == 1) {
- $freq_tab_switch++;
- print $freq_tab_fh "$line\n";
- }
- if ($line =~ m/^Motif\smodel/ ) {
- $freq_tab = 1;
- open ($freq_tab_fh, ">", $freq_tab_file) || die ("\nERROR: the file $freq_tab could not be found\n");
- push @freq_tab, $freq_tab_file;
- print "FREQ TABLE: $freq_tab[0]\n";
- }
- elsif ($line =~ m/^site\s+/ ) {
- $freq_tab = 0;
- my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/static/documents/tempfiles/motifs_finder/");
- #my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
- }
- if ($prob_tab == 1 && $line !~ m/^Background\sprobability\smodel/) {
- $prob_tab_switch++;
- print $prob_tab_fh "$line\n";
- }
- if ($line =~ m/^Motif\sprobability\smodel/ ) {
- $prob_tab = 1;
- open ($prob_tab_fh, ">", $prob_tab_file) || die ("\nERROR: the file $prob_tab_file could not be found\n");
- push @prob_tab, $prob_tab_file;
- }
- elsif ($line =~ m/^Background\sprobability\smodel/ ) {
- $prob_tab = 0;
- #my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
- my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/static/documents/tempfiles/motifs_finder/");
- }
- if ($BGPM_tab == 1) {
- $BGPM_tab_switch++;
- print $BGPM_tab_fh "$line\n";
- }
- if ($line =~ m/^Background\sprobability\smodel/ ) {
- $BGPM_tab = 1;
- open ($BGPM_tab_fh, ">", $BGPM_tab_file) || die ("\nERROR: the file $BGPM_tab_file could not be found\n");
- push @BGPM_tab, $BGPM_tab_file;
- }
- elsif ($line =~ m/^\s+\d\.\d+\s\d\.\d+\s/ ) {
- $BGPM_tab = 0;
- my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/static/documents/tempfiles/motifs_finder/");
- #my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
- }
- if ($sum_indv_tab == 1 ) {
- $sum_indv_tab_switch++;
- print $sum_indv_tab_fh "$line\n";
- print "FREQ LINES: $line\n";
- }
- if ($line =~ m/^Column\s\d\s:\s+Sequence\sDescription\sfrom\s/ ) {
- $sum_indv_tab = 1;
- open ($sum_indv_tab_fh, ">", $sum_indv_tab_file) || die ("\nERROR: the file $sum_indv_tab_file could not be found\n");
- push @sum_indv_tab, $sum_indv_tab_file;
- }
- elsif ($line =~ m/^Log\sFragmentation\sportion\sof\sMAP\sfor\smotif\s/ ) {
- $sum_indv_tab = 0;
- my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/static/documents/tempfiles/motifs_finder/");
- #my ($fh, $filename) =tempfile("XXXXX", DIR => "$basePath/motifs_finder/");
- }
- }
- if ($line =~ m/^\s+MOTIF\s+([a-z])/){
- $motif = 1;
- $logo_file = $filename."_".$1."_wl_input.fasta";
- $lf_id = $1;
- $motif_tab = $filename."_".$1;
- $freq_tab_file = $filename."_freq_".$1;
- $prob_tab_file = $filename."_prob_".$1;
- $BGPM_tab_file = $filename."_BGPM_".$1;
- $sum_indv_tab_file = $filename."_sum_indv_".$1;
- }
- elsif ($line =~ m/^Log\s+Fragmentation\s+portion\s+/ ) {
- $motif = 0;
- close $wl_out_fh;
- close $motif_tab_fh;
- close $freq_tab_fh;
- close $prob_tab_fh;
- close $BGPM_tab_fh;
- close $sum_indv_tab_fh;
- }
- }
-
- my @values_motif;
- my $motif_table_value;
- foreach $filename (@motif_table_file){
- $motif_table_value = get_result_table($filename);
- push @values_motif, $motif_table_value;
- }
- my $freq_tab_value;
- my @value_freq_tab;
- foreach $filename (@freq_tab) {
- $freq_tab_value = get_freq_table($filename);
- push @value_freq_tab, $freq_tab_value;
- }
- my $prob_tab_value;
- my @value_prob_tab;
-
- foreach $filename (@prob_tab) {
- $prob_tab_value = get_prob_table($filename);
- push @value_prob_tab, $prob_tab_value;
- }
- my $BGPM_tab_value;
- my @value_BGPM_tab;
- foreach $filename (@BGPM_tab) {
+ my $prob_tab_value;
+ my @value_prob_tab;
+
+ foreach my $filename (@prob_tab) {
+ $prob_tab_value = get_prob_table($filename);
+ push @value_prob_tab, $prob_tab_value;
+ }
+ my $BGPM_tab_value;
+ my @value_BGPM_tab;
+ foreach my $filename (@BGPM_tab) {
$BGPM_tab_value = get_BGPM_table($filename);
- push @value_BGPM_tab, $BGPM_tab_value;
- }
- my $sum_indv_tab_value;
- my @value_sum_indv_tab;
- foreach $filename (@sum_indv_tab) {
- $sum_indv_tab_value = get_sum_indv_table($filename);
- push @value_sum_indv_tab, $sum_indv_tab_value;
- }
+ push @value_BGPM_tab, $BGPM_tab_value;
+ }
+ my $sum_indv_tab_value;
+ my @value_sum_indv_tab;
+ foreach my $filename (@sum_indv_tab) {
+ $sum_indv_tab_value = get_sum_indv_table($filename);
+ push @value_sum_indv_tab, $sum_indv_tab_value;
+ }
# To run weblogo
my $cmd;
- foreach $filename (@motif_element){
- $cmd = "$cluster_shared_bindir/weblogo/seqlogo -F PNG -d 0.5 -T 1 -b -e -B 2 -h 5 -w 18 -y bits -a -M -n -Y -c -f $filename -o ".$filename."_weblogo";
- push (@logo_image, basename($filename."_weblogo.png"));
- my $error = system($cmd);
+ foreach my $filename (@motif_element){
+ $cmd = "$cluster_shared_bindir/weblogo/seqlogo -F PNG -d 0.5 -T 1 -b -e -B 2 -h 5 -w 18 -y bits -a -M -n -Y -c -f $filename -o ".$filename."_weblogo";
+ push (@logo_image, basename($filename."_weblogo.png"));
+ my $error = system($cmd);
}
print STDERR Dumper(\@logo_image);
@@ -305,208 +305,208 @@ sub name_var :Path('/test/') :Args(0) {
$c->stash->{template} = 'tools/motifs_finder/motif_output.mas';
}
+}
+sub download_file :Path('/result/') :Args(0) {
+ my ($self, $c) = @_;
+ my $params = $c->req->body_params();
+ my $filename = $c->req->param("file_name");
+ my $result_file = $c->req->param("output_file");
- sub download_file :Path('/result/') :Args(0) {
- my ($self, $c) = @_;
- my $params = $c->req->body_params();
- my $filename = $c->req->param("file_name");
- my $result_file = $c->req->param("output_file");
+ if ($result_file) {
+ $result_file =~ s/
/\n/gi;
+ }
- if ($result_file) {
- $result_file =~ s/
/\n/gi;
- }
+ #----------------------------------- send file
+ $c->res->content_type('text/plain');
+ $c->res->header('Content-Disposition', qq[attachment; filename="$filename"]);
+ $c->res->body($result_file);
+ #$c->stash->{template} = '/output.mas';
+}
- #----------------------------------- send file
- $c->res->content_type('text/plain');
- $c->res->header('Content-Disposition', qq[attachment; filename="$filename"]);
- $c->res->body($result_file);
- #$c->stash->{template} = '/output.mas';
+sub get_result_table {
+ my $motif_table_file = shift;
+ my $motif_table_path = $motif_table_file;
+
+ #print "MOTIF TAB1 PATH: $motif_table_path\n";
+ open (my $tab_fh, "<", $motif_table_path) || die ("\nERROR: the file $motif_table_path could not be found\n");
+ my $html_table .= "
\n";
+ $html_table .= "
\n";
+ $html_table .= "";
+ $html_table .= "\n";
+ $html_table .= "| Seq Num | \t";
+ $html_table .= "Site Num | \t";
+ $html_table .= "Left Loc | \t";
+ # $html_table .= " | \t";
+ $html_table .= "Motifs | \t";
+ # $html_table .= " | \t";
+ $html_table .= "Right Loc | \t";
+ $html_table .= "Motif Prob | \t";
+ $html_table .= "F/R Motif | \t";
+ $html_table .= " Seq Desc | \t";
+ $html_table .= "
\n";
+
+ while (my $inpbuf = <$tab_fh>){
+ chomp $inpbuf;
+ $inpbuf =~ s/,//g;
+ my ($kk,$seq_num,$site_num,$left_loc,$emty1,$motif,$emty2,$right_loc,$prob,$f_motif,$seq_desc) = split(/\s+/,$inpbuf);
+ $html_table .= "\n";
+ $html_table .= "| $seq_num | \t";
+ $html_table .= "$site_num | \t";
+ $html_table .= "$left_loc | \t";
+ # $html_table .= "$emty1 | \t";
+ $html_table .= "$motif | \t";
+ # $html_table .= "$emty2 | \t";
+ $html_table .= "$right_loc | \t";
+ $html_table .= "$prob | \t";
+ $html_table .= "$f_motif | \t";
+ $html_table .= " $seq_desc | \t";
+ $html_table .= "
\n";
}
- sub get_result_table {
- my $motif_table_file = shift;
- my $motif_table_path = $motif_table_file;
-
- #print "MOTIF TAB1 PATH: $motif_table_path\n";
- open (my $tab_fh, "<", $motif_table_path) || die ("\nERROR: the file $motif_table_path could not be found\n");
- my $html_table .= "\n";
- $html_table .= "
\n";
- $html_table .= "";
- $html_table .= "\n";
- $html_table .= "| Seq Num | \t";
- $html_table .= "Site Num | \t";
- $html_table .= "Left Loc | \t";
- # $html_table .= " | \t";
- $html_table .= "Motifs | \t";
- # $html_table .= " | \t";
- $html_table .= "Right Loc | \t";
- $html_table .= "Motif Prob | \t";
- $html_table .= "F/R Motif | \t";
- $html_table .= " Seq Desc | \t";
- $html_table .= "
\n";
-
- while (my $inpbuf = <$tab_fh>){
- chomp $inpbuf;
- $inpbuf =~ s/,//g;
- my ($kk,$seq_num,$site_num,$left_loc,$emty1,$motif,$emty2,$right_loc,$prob,$f_motif,$seq_desc) = split(/\s+/,$inpbuf);
- $html_table .= "\n";
- $html_table .= "| $seq_num | \t";
- $html_table .= "$site_num | \t";
- $html_table .= "$left_loc | \t";
- # $html_table .= "$emty1 | \t";
- $html_table .= "$motif | \t";
- # $html_table .= "$emty2 | \t";
- $html_table .= "$right_loc | \t";
- $html_table .= "$prob | \t";
- $html_table .= "$f_motif | \t";
- $html_table .= " $seq_desc | \t";
- $html_table .= "
\n";
- }
+ close $tab_fh;
+ $html_table .= "
\n";
+ $html_table .= "";
+}
- close $tab_fh;
- $html_table .= "
\n";
- $html_table .= "
";
+sub get_freq_table {
+ my $freq_tab = shift;
+ my $freq_table_path = $freq_tab;
+ open (my $tab_fh, "<", $freq_table_path) || die ("\nERROR: the file $freq_table_path could not be found\n");
+ my $html_freq_table .= "\n";
+ $html_freq_table .= "
\n";
+ $html_freq_table .= "";
+ #$html_freq_table .= "";
+ #$html_freq_table .= "
";
+ $html_freq_table .= "\n";
+ $html_freq_table .= "| Position # | \t";
+ $html_freq_table .= "A | \t";
+ $html_freq_table .= "T | \t";
+ $html_freq_table .= "C | \t";
+ $html_freq_table .= "G | \t";
+ $html_freq_table .= "Info | \t";
+ $html_freq_table .= "
\n";
+
+ while (my $inpbuf = <$tab_fh>){
+ chomp $inpbuf;
+ $inpbuf =~ s/_//g;
+ $inpbuf =~ s/\|//g;
+ $inpbuf =~ s/^\s+//g;
+ if ($inpbuf =~ m/^\S+/ && $inpbuf !~ m/^Pos.\s+/){
+ my ($pos_num,$A,$T,$C,$G,$info,) = split(/\s+/,$inpbuf);
+ $html_freq_table .= "\n";
+ $html_freq_table .= " | $pos_num | \t";
+ $html_freq_table .= " $A | \t";
+ $html_freq_table .= " $T | \t";
+ $html_freq_table .= " $C | \t";
+ $html_freq_table .= " $G | \t";
+ $html_freq_table .= " $info | \t";
+ $html_freq_table .= "
\n";
+ }
}
- sub get_freq_table {
- my $freq_tab = shift;
- my $freq_table_path = $freq_tab;
- open (my $tab_fh, "<", $freq_table_path) || die ("\nERROR: the file $freq_table_path could not be found\n");
- my $html_freq_table .= "\n";
- $html_freq_table .= "
\n";
- $html_freq_table .= "";
- #$html_freq_table .= "";
- #$html_freq_table .= "
";
- $html_freq_table .= "\n";
- $html_freq_table .= "| Position # | \t";
- $html_freq_table .= "A | \t";
- $html_freq_table .= "T | \t";
- $html_freq_table .= "C | \t";
- $html_freq_table .= "G | \t";
- $html_freq_table .= "Info | \t";
- $html_freq_table .= "
\n";
-
- while (my $inpbuf = <$tab_fh>){
- chomp $inpbuf;
- $inpbuf =~ s/_//g;
- $inpbuf =~ s/\|//g;
- $inpbuf =~ s/^\s+//g;
- if ($inpbuf =~ m/^\S+/ && $inpbuf !~ m/^Pos.\s+/){
- my ($pos_num,$A,$T,$C,$G,$info,) = split(/\s+/,$inpbuf);
- $html_freq_table .= "\n";
- $html_freq_table .= " | $pos_num | \t";
- $html_freq_table .= " $A | \t";
- $html_freq_table .= " $T | \t";
- $html_freq_table .= " $C | \t";
- $html_freq_table .= " $G | \t";
- $html_freq_table .= " $info | \t";
- $html_freq_table .= "
\n";
- }
- }
-
- close $tab_fh;
- $html_freq_table .= "
\n";
- $html_freq_table .= "
\n";
- }
+ close $tab_fh;
+ $html_freq_table .= "
\n";
+ $html_freq_table .= "\n";
+}
- sub get_prob_table {
- my $prob_tab = shift;
- my $prob_table_path = $prob_tab;
- open (my $tab_fh, "<", $prob_table_path) || die ("\nERROR: the file $prob_table_path could not be found\n");
- my $html_prob_table .= "\n";
- $html_prob_table .= "
\n";
- $html_prob_table .= "";
- $html_prob_table .= "";
- $html_prob_table .= "
\n";
- $html_prob_table .= "| Position # | \t";
- $html_prob_table .= "A | \t";
- $html_prob_table .= "T | \t";
- $html_prob_table .= "C | \t";
- $html_prob_table .= "G | \t";
- $html_prob_table .= "
\n";
-
- while (my $inpbuf = <$tab_fh>){
- chomp $inpbuf;
- $inpbuf =~ s/_//g;
- $inpbuf =~ s/\|//g;
- $inpbuf =~ s/^\s+//g;
- if ($inpbuf =~ m/^\S+/ && $inpbuf !~ m/^Pos.\s+/){
- #if ($inpbuf =~ m/^Background\sprobability\smodel/){
- #$inpbuf =~ s/\s//g;
- #$inpbuf =~ s/Backgroundprobabilitymodel/BP-Model/g;
- #}
- my ($pos_num,$A,$T,$C,$G) = split(/\s+/,$inpbuf);
- $html_prob_table .= " \n";
- $html_prob_table .= " | $pos_num | \t";
- $html_prob_table .= " $A | \t";
- $html_prob_table .= " $T | \t";
- $html_prob_table .= " $C | \t";
- $html_prob_table .= " $G | \t";
- $html_prob_table .= "
\n";
- }
- }
-
- close $tab_fh;
- $html_prob_table .= "
\n";
- $html_prob_table .= "\n";
+sub get_prob_table {
+ my $prob_tab = shift;
+ my $prob_table_path = $prob_tab;
+ open (my $tab_fh, "<", $prob_table_path) || die ("\nERROR: the file $prob_table_path could not be found\n");
+ my $html_prob_table .= "\n";
+ $html_prob_table .= "
\n";
+ $html_prob_table .= "";
+ $html_prob_table .= "";
+ $html_prob_table .= "
\n";
+ $html_prob_table .= "| Position # | \t";
+ $html_prob_table .= "A | \t";
+ $html_prob_table .= "T | \t";
+ $html_prob_table .= "C | \t";
+ $html_prob_table .= "G | \t";
+ $html_prob_table .= "
\n";
+
+ while (my $inpbuf = <$tab_fh>){
+ chomp $inpbuf;
+ $inpbuf =~ s/_//g;
+ $inpbuf =~ s/\|//g;
+ $inpbuf =~ s/^\s+//g;
+ if ($inpbuf =~ m/^\S+/ && $inpbuf !~ m/^Pos.\s+/){
+ #if ($inpbuf =~ m/^Background\sprobability\smodel/){
+ #$inpbuf =~ s/\s//g;
+ #$inpbuf =~ s/Backgroundprobabilitymodel/BP-Model/g;
+ #}
+ my ($pos_num,$A,$T,$C,$G) = split(/\s+/,$inpbuf);
+ $html_prob_table .= " \n";
+ $html_prob_table .= " | $pos_num | \t";
+ $html_prob_table .= " $A | \t";
+ $html_prob_table .= " $T | \t";
+ $html_prob_table .= " $C | \t";
+ $html_prob_table .= " $G | \t";
+ $html_prob_table .= "
\n";
+ }
}
+ close $tab_fh;
+ $html_prob_table .= "
\n";
+ $html_prob_table .= "\n";
+}
+
- sub get_BGPM_table {
- my $BGPM_tab = shift;
- my $BGPM_table_path = $BGPM_tab;
- open (my $tab_fh, "<", $BGPM_table_path) || die ("\nERROR: the file $BGPM_table_path could not be found\n");
- my $html_BGPM_table .= "\n";
- $html_BGPM_table .= "
\n";
- $html_BGPM_table .= "";
- $html_BGPM_table .= "";
- $html_BGPM_table .= " \n";
- $html_BGPM_table .= "| A | \t";
- $html_BGPM_table .= " T | \t";
- $html_BGPM_table .= " C | \t";
- $html_BGPM_table .= " G | \t";
- $html_BGPM_table .= "
\n";
- $html_BGPM_table .= " \n";
-
- while (my $inpbuf = <$tab_fh>){
- chomp $inpbuf;
- $inpbuf =~ s/^\s+//g;
- my ($A,$T,$C,$G) = split(/\s+/,$inpbuf);
- $html_BGPM_table .= "\n";
- $html_BGPM_table .= "\n";
- $html_BGPM_table .= "| $A | \t";
- $html_BGPM_table .= "$T | \t";
- $html_BGPM_table .= "$C | \t";
- $html_BGPM_table .= "$G | \t";
- $html_BGPM_table .= "
\n";
- $html_BGPM_table .= "
\n";
- }
-
- close $tab_fh;
- $html_BGPM_table .= "
\n";
- $html_BGPM_table .= "";
+sub get_BGPM_table {
+ my $BGPM_tab = shift;
+ my $BGPM_table_path = $BGPM_tab;
+ open (my $tab_fh, "<", $BGPM_table_path) || die ("\nERROR: the file $BGPM_table_path could not be found\n");
+ my $html_BGPM_table .= "\n";
+ $html_BGPM_table .= "
\n";
+ $html_BGPM_table .= "";
+ $html_BGPM_table .= "";
+ $html_BGPM_table .= " \n";
+ $html_BGPM_table .= "| A | \t";
+ $html_BGPM_table .= " T | \t";
+ $html_BGPM_table .= " C | \t";
+ $html_BGPM_table .= " G | \t";
+ $html_BGPM_table .= "
\n";
+ $html_BGPM_table .= " \n";
+
+ while (my $inpbuf = <$tab_fh>){
+ chomp $inpbuf;
+ $inpbuf =~ s/^\s+//g;
+ my ($A,$T,$C,$G) = split(/\s+/,$inpbuf);
+ $html_BGPM_table .= "\n";
+ $html_BGPM_table .= "\n";
+ $html_BGPM_table .= "| $A | \t";
+ $html_BGPM_table .= "$T | \t";
+ $html_BGPM_table .= "$C | \t";
+ $html_BGPM_table .= "$G | \t";
+ $html_BGPM_table .= "
\n";
+ $html_BGPM_table .= "
\n";
}
- sub get_sum_indv_table {
- my $sum_indv_tab = shift;
- my $sum_indv_table_path = $sum_indv_tab;
- open (my $tab_fh, "<", $sum_indv_table_path) || die ("\nERROR: the file $sum_indv_table_path could not be found\n");
- my $html_sum_indv_table;
- while ( my $inpbuf = <$tab_fh>){
- chomp $inpbuf;
- if ($inpbuf =~ m/^\S+/ ){
- my $html_inpbuf = join("
", $inpbuf);
- $html_sum_indv_table .= "$html_inpbuf
\n";
- }
- }
-
- close $tab_fh;
- $html_sum_indv_table;
+ close $tab_fh;
+ $html_BGPM_table .= "
\n";
+ $html_BGPM_table .= "";
+}
+
+sub get_sum_indv_table {
+ my $sum_indv_tab = shift;
+ my $sum_indv_table_path = $sum_indv_tab;
+ open (my $tab_fh, "<", $sum_indv_table_path) || die ("\nERROR: the file $sum_indv_table_path could not be found\n");
+ my $html_sum_indv_table;
+ while ( my $inpbuf = <$tab_fh>){
+ chomp $inpbuf;
+ if ($inpbuf =~ m/^\S+/ ){
+ my $html_inpbuf = join("
", $inpbuf);
+ $html_sum_indv_table .= "$html_inpbuf
\n";
+ }
}
+ close $tab_fh;
+ $html_sum_indv_table;
}
+
+
=encoding utf8
=head1 AUTHOR
diff --git a/mason/tools/motifs_finder/motif_output.mas b/mason/tools/motifs_finder/motif_output.mas
index 44ae85e7ce..a980eb5681 100644
--- a/mason/tools/motifs_finder/motif_output.mas
+++ b/mason/tools/motifs_finder/motif_output.mas
@@ -25,7 +25,7 @@ $sum => ""
#print "Motif Sequence logo $logoID[$i], for Length $logowidth[$i]\n
";
print "Motif Sequence logo $logoID[$i]\n
";
#print "
";
- print "
";
+ print "
";
print "Motif Table
$motif_tab[$i]\n
" ;
print "Motif Model (residue frequence x 100)
$freq_tab[$i]\n
";
print "Motif Probabilty Model
$prob_tab[$i]\n
" ;
diff --git a/sgn.conf b/sgn.conf
index 99706449c8..34c166caca 100644
--- a/sgn.conf
+++ b/sgn.conf
@@ -28,7 +28,7 @@ composable_cvs trait,object,tod,toy,unit,method
composable_cvs_allowed_combinations Agronomic|trait+toy,Metabolic|trait+object+tod+toy+unit+method
composable_cvterm_delimiter |
composable_cvterm_format concise
-composable_variables 1 #display only variable terms in the post composing tool
+composable_variables 1 #display only variable terms in the post composing tool
composable_tod_root_cvterm "time of day|TIME:0000001"
composable_toy_root_cvterm "time of year|TIME:0000005"
composable_gen_root_cvterm "generation|TIME:0000072"
@@ -279,7 +279,10 @@ support_data_subdir /support_data
#stock tempfiles (for downloading phenotype and genotype raw data)
stock_tempfiles /static/documents/tempfiles/stock
#weblogo tempfiles for motifs finder tools
+
tmp_weblogo_path /static/documents/tempfiles/
+tempfiles_base_motifs_finder /home/production/tmp
+cluster_motifs_finder /home/production/cluster/bin
#
#currently our cookies encrypt stuff, so this is just a random string to use to do that
cookie_encryption_key bo9yie2JeeVee6ouAhch9aomeesieJ3iShae8aa8