meme2html.pl
来自「EM算法的改进」· PL 代码 · 共 566 行 · 第 1/2 页
PL
566 行
#!@WHICHPERL@## $Id: meme2html.pl 1339 2006-09-21 19:46:28Z tbailey $# $Log$# Revision 1.7 2005/12/01 03:38:44 tbailey# Add new button to MEME DNA output to submit PSPM to JASPAR database for# searching against known DNA motifs.## Revision 1.6 2005/10/13 21:15:52 nadya# move meme-explanation.html to etc/ to allow html conversion without installing web site## Revision 1.5 2005/09/13 18:52:56 nadya# rm "web" from url string## Revision 1.4 2005/08/30 22:39:19 nadya# fix link path## Revision 1.3 2005/08/23 23:57:56 nadya# change use of convert2html from module to perl file# update regexpr string that makes a tag# update doc string to get file locally## Revision 1.2 2005/08/12 17:52:20 nadya# rename 2html into convert2html. Perl needs module name start with alpha char,# not numeric## Revision 1.1.1.1 2005/07/30 02:13:51 nadya# Importing from meme-3.0.14, and adding configure/make##use lib qw(@PERLMODDIR@);use Globals;require "@PERLMODDIR@/convert2html.pl";$pgm = $0; # name of program$pgm =~ s#.*/##; # remove part up to last slash@args = @ARGV; # arguments to program$status = 0; # exit status$SIG{'INT'} = 'cleanup'; # interrupt handler## get url; set during install in GLobals.pm#$url = "$SITE_URL";$usage = <<USAGE; # usage message USAGE: $pgm USAGE# Starting with standard MEME output:# format in html# add internal navigation links# add html motif diagrams# add documentation## adapted from the earlier diagram program mast2html# v1.00 23 August 2000 Tim Bailey## get input arguments#while ($#ARGV >= 0) { if ($ARGV[0] eq "-h") { print $usage; exit(0); } else { print $usage; exit(1); } shift;} # input argument# Define buttons for next and previous motifs$MBPSUB = "XXX---XXX";%buttons = ( "next", "<A HREF=\"\#summary$MBPSUB\"><B>N</B></A>!#FFFFOO!#000000", "prev", "<A HREF=\"\#summary$MBPSUB\"><B>P</B></A>!#OOFFFF!#000000", "summary", "<A HREF=\"\#motif-summary\"><B>P</B></A>!#OOFFFF!#000000", "command", "<A HREF=\"\#command\"><B>Command line</B></A>!#DDDDFF!#000000", "tset", "<A HREF=\"\#sequences\"><B>Training Set</B></A>!#00FFFF!#000000", "first", "<A HREF=\"\#summary1\"><B>First Motif</B></A>!#DDFFDD!#000000", "msum","<A HREF=\"\#motif-summary\"><B>Summary of Motifs</B></A>!#FFDDFF!#000000", "stop", "<A HREF=\"\#stopped\"><B>Termination</B></A>!#00FF00!#000000", "explain", "<A HREF=\"\#explanation\"><B>Explanation</B></A>!#FFFF00!#000000", "top", "<A HREF=\"\#top_buttons\"><B>Go to top</B></A>!#DDDDFF!#000000");# header#print "<HTML>\n<HEAD>\n<TITLE>MEME</TITLE>\n</HEAD>\n<BODY BGCOLOR="$BODY">\n";print_header("MEME");# top button panel$button = make_button_panel("!", \%buttons, "command", "tset", "first", "msum", "stop", "explain");print "<A NAME='top_buttons'></A><HR>\n$button\n<BR CLEAR=LEFT>\n";# make it a formprint "\n<FORM ENCTYPE = \"application/x-www-form-urlencoded\" METHOD = POST\n";print "TARGET = \"_new\"\n";print "ACTION = \"$url/cgi-bin/process_request.cgi\">\n";# submit buttons at top# mast submit$line = "<B>\n";$line .= "<BR><INPUT TYPE = 'SUBMIT' NAME = 'action' VALUE = 'MAST'>";$line .= " Search sequence databases with these motifs using ";$line .= "<A HREF='$url/mast-intro.html'>MAST.</A>\n";# all blocks submit$line .= "<BR><INPUT TYPE = 'SUBMIT' NAME = 'action' VALUE = 'BLOCKS'>";$line .= " Submit these motifs to <A HREF='http://blocks.fhcrc.org/blocks/process_blocks.html'>BLOCKS multiple alignment processor.</A>\n";# metameme submit$line .= "<BR><INPUT TYPE = 'SUBMIT' NAME = 'action' VALUE = 'MetaMEME'>";$line .= " Build and use a motif-based hidden Markov model (HMM) using ";$line .= "<A HREF='http://metameme.sdsc.edu'>Meta-MEME.</A>\n";# print the buttonsprint "$line</B><BR CLEAR=LEFT>\n";# title$line = &next_section();$line = &format_section( "", $line, "", "version");print "$line\n";$line = &next_block();$line =~ s/(http:.*)/<A HREF=\"\1\">\1<\/A>/g; # make links to MEME$line = &format_para( $line );print "$line\n";# reference$line = &next_section();$line = &format_section( "", $line, "", "reference" );print "$line\n";$line = &next_block();$line = &format_para( $line );print "$line\n";# training set$line = &next_section();$line = &format_section( "", $line, "", "sequences" );print "$line\n";$line = &next_block();$line = &format_training_set( $line );# get the datafile name and alphabet and make hidden fields$line =~ /^DATAFILE= (.+)$/m; $datafile = $1;$line =~ /^ALPHABET= (\S+)$/m; $alphabet = $1; $line .= "<INPUT TYPE = HIDDEN NAME = name VALUE = \"$datafile\" >\n";$line .= "<INPUT TYPE = HIDDEN NAME = alphabet VALUE = \"$alphabet\" >\n";$line .= "<INPUT TYPE = HIDDEN NAME = url VALUE = \"$url\" >\n";print "$line\n";# command line summary$line = &next_section();$line = &format_section( "", $line, "", "command" );print "$line\n";$line = &next_block();$line =~ /^Background letter frequencies.+\:$/m; $bgfreq = $';$line = &format_pre( $line );$line .= "<INPUT TYPE = HIDDEN NAME = bgfreq VALUE = \"$bgfreq\" >\n";print "$line\n";# figure DB type out how are DNA strands are scoredif ($line =~ /strands: + -/) { $db = "dna"; $stype = "c"; # combined} elsif ($line =~ /strands: +/) { $db = "dna"; $stype = "n"; # noic} else { $db = "protein"; $stype = "p"; # protein}$xlate = 0; # not translating DNA## read motif sections, summary section and "stopped" section#$f = +4; # font size$sp = " ";@section_names = ("description", "sites", "diagrams", "BLOCKS", "pssm", "pspm", "regular_expression");$n_sections = $#section_names+1; $motif_num = 1;while (($line = &next_section())) { $mm1 = $motif_num - 1; # previous motif $mp1 = $motif_num + 1; # next motif $button = ""; # determine what type of section: MOTIF, SUMMARY OF MOTIFS, STOPPED if ($line =~ /^\s*(MOTIF\s+\d+)\s+width =\s+(\d+)/) { # motif start $name = "summary"; $ext = $motif_num; $link = $1; # motif number $width{$motif_num} = $2; # save width in global $rest = "width = $2 $'<BR CLEAR=LEFT>"; # make a button panel for going to next motif (and back) if ($motif_num == 1) { # first motif $button = make_button_panel("!", \%buttons, "summary", "next!$mp1"); } else { # not first $button = make_button_panel("!", \%buttons, "prev!$mm1", "next!$mp1"); } #$link = "$button\n$link\n"; } elsif ($line =~ /SUMMARY/) { # summary of motifs $name = "motif-summary"; $ext = ""; print "<A NAME='summary$motif_num'></A>"; # make like a motif $button = make_button_panel("!", \%buttons, "prev!$mm1", "next!1"); $link = "$line"; $rest = "<BR CLEAR=LEFT>"; } elsif ($line =~ /Stopped/) { # stopped line $line = &format_section( "", $&, $', "stopped" ); print "$line\n"; $line = &next_block(); $line = &format_pre( $line ); print "$line\n"; last; } $line = &format_section( $button, $link, $rest, $name, $ext ); # put spaces between the "nam=val" pairs in the summary lines $line =~ s/([\w\-]+\s+=\s+\w+)/ $sp \1/g unless ($line =~ /Stopped/); print "$line\n"; if ($line =~ /MOTIF/ ) { # motif|summary section for ($i=0; $i<$n_sections; $i++) { $name = &next_section($SUBDIV); $section_name = $section_names[$i]; unless ($name =~ /Description|sorted|Combined/) { $line = &format_section( "", $name, "", $section_name, $motif_num ); print "$line\n"; } $line = &next_block($SUBDIV); if ($name =~ /block diagrams/) { # block diagrams $hdr = ($name =~ /Combined/) ? "Combined<BR>p-value" : "Lowest<BR>p-value"; $line = &format_diagrams($SCALE, $MAX_DIAGRAM, $line, $db, $stype, $xlate, 0, $hdr, 0, ' '); if ($name =~ /Combined/) { # hidden combined summary $line .= &format_hidden( "motif-summary", $META ); $nmotifs = $motif_num - 1; $line .= "<INPUT TYPE = HIDDEN NAME = nmotifs VALUE = $nmotifs>"; $line .= "<BR><INPUT TYPE = 'SUBMIT' NAME = 'action' VALUE = 'View motif summary'>"; $line .= " <B>Motif summary in machine readable format.</B>"; $line .= "\n"; } if ($name =~ /Combined/) { $tmp = &format_section( "", $name, "", "" ); print $tmp; print $line; last; } # combined diagrams } elsif ($name =~ /Motif \d+ Description/) { # motif description $line = &format_description( $line, $motif_num, $f ); } elsif ($name =~ /Motif \d+ sites sorted/) { # sorted/aligned sites $line = &format_sorted_sites( $line, $motif_num, $f ); } elsif ($name =~ /Motif \d+ in BLOCKS/) { # BLOCK $line1 = &format_hidden( "$section_name$motif_num", $line ); $line = $line1 . "<INPUT TYPE = 'SUBMIT' NAME = 'action' VALUE = 'View BLOCK $motif_num'>\n"; $line .= "<INPUT TYPE = 'SUBMIT' NAME = 'action' VALUE = 'View FASTA $motif_num'>\n"; $line .= "<INPUT TYPE = 'SUBMIT' NAME = 'action' VALUE = 'View RAW $motif_num'>\n"; $line .= "<BR><INPUT TYPE = 'SUBMIT' NAME = 'action' VALUE = 'Submit BLOCK $motif_num'>\n"; $line .= "<B>to <A HREF='http://www.blocks.fhcrc.org/blocks/process_blocks.html'>BLOCKS multiple alignment processor.</A></B>"; } elsif ($name =~ /Motif \d+ position-specific s/) { # pssm $line1 = &format_hidden( "$section_name$motif_num", $line ); $line = $line1 . "<INPUT TYPE = 'SUBMIT' NAME = 'action' VALUE = 'View PSSM $motif_num'>\n"; } elsif ($name =~ /Motif \d+ position-specific p/) { # pspm $line1 = &format_hidden( "$section_name$motif_num", $line ); $line = $line1 . "<INPUT TYPE = 'SUBMIT' NAME = 'action' VALUE = 'View PSPM $motif_num'>\n"; if ($db eq "dna") { $line .= "<BR><INPUT TYPE = 'SUBMIT' NAME = 'action' VALUE = 'COMPARE PSPM $motif_num'>\n"; $line .= "<B>to known motifs in <A HREF='http://mordor.cgb.ki.se/cgi-bin/jaspar2005/jaspar_db.pl'>JASPAR database:</A></B>\n"; $line .= "<SELECT SIZE=3 NAME=\"motif_db_$motif_num\">\n"; $line .= " <OPTION VALUE='JASPAR CORE' SELECTED>JASPAR CORE </OPTION>\n"; $line .= " <OPTION VALUE='JASPAR PHYLOFACTS'>JASPAR PHYLOFACTS </OPTION>\n"; $line .= " <OPTION VALUE='JASPAR FAM'>JASPAR FAM </OPTION>\n";
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?