Advertisement
Guest User

fasta alignment

a guest
Jun 1st, 2010
958
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.11 KB | None | 0 0
  1. #!c:/Python26/python.exe
  2. import os
  3. import cgi, cgitb
  4. cgitb.enable()
  5. print 'Content-type: text/html\n\n'
  6. print "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/msa.css\" >"
  7.  
  8. class HtmlTemplate:
  9.  
  10.     def Header(self):
  11.         print '''
  12.        <html><head>
  13.        <title>Multiple Sequence alignment</title>
  14.        </head>
  15.        '''
  16.     def Body(self):
  17.         print '''
  18.        <body>
  19.        <p align="center"><img src='images/mheader.jpg'></img></p>
  20.        <br>
  21.        <br>
  22.        '''
  23.     def Form(self):
  24.         print '''
  25.        <script language=\"javascript\" type=\"text/javascript\">
  26.  
  27.        function validate(form)
  28.        {
  29.        if ((form.dfile.value.length==0) && (form.sequence.value.length==0))
  30.        {
  31.        alert("Upload fasta file or paste sequence");
  32.        return false;
  33.        }
  34.        else if ((form.dfile.value.length>0) && (form.sequence.value.length>0))
  35.        {
  36.        alert("Only one option is available");
  37.        return false;
  38.        }
  39.  
  40.        else
  41.        {
  42.        return true;
  43.        }
  44.        }
  45.  
  46.        </script>
  47.        <table width="575" height="305" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#a1a1a1" bgcolor="#f3f3f3">
  48.         <tr>
  49.        <td width="565" height="303" valign="top">
  50.        <form method="post" action="display.py" enctype="multipart/form-data" onsubmit="return validate(this);">
  51.        <table width="544" border="0" cellspacing="0" cellpadding="0">
  52.        <tr>
  53.            <td colspan="3">&nbsp;</td>
  54.        </tr>
  55.        <tr>
  56.            <td width="156"><div align="center"><u>Upload fasta file</u></div></td>
  57.            <td colspan="2"> <input name="dfile" type="file" class="style1" size="45" />&nbsp;</td>
  58.        </tr>
  59.        <tr>
  60.            <td colspan="3"><div align="center"></div></td>
  61.        </tr>
  62.        <tr>
  63.            <td colspan="3"><div align="center">******OR******</div></td>
  64.        </tr>
  65.        <tr>
  66.            <td valign="top"><div align="center"><u>Paste your sequence</u></div></td>
  67.            <td colspan="2"><textarea name="sequence" cols="45" rows="10" class="style2" id="sequence"></textarea>&nbsp;</td>
  68.        </tr>
  69.        <tr>
  70.            <td height="39">&nbsp;</td>
  71.            <td width="309" height="39">&nbsp;</td>
  72.            <td width="79"><INPUT TYPE = hidden NAME = "action" VALUE ="display">
  73.                <INPUT TYPE = submit class="style2" VALUE = "Execute">
  74.            </td>
  75.        </tr>
  76.        </table>
  77.        </form>
  78.        </td>
  79.        </tr>
  80.        </table>'''
  81.  
  82.     def Footer(self):
  83.         print '''
  84.        <p align="center">
  85.        <br><br>
  86.        <table width="931" border="0" cellpadding="0" cellspacing="0" bgcolor="#cccccc">
  87.        <tr>
  88.        <td><div align="center">Thaman Chand @ 2010</div></td>
  89.        </tr>
  90.        </table>
  91.        </p>
  92.        '''
  93.  
  94.     def CloseHtml(self):
  95.         print "</body>"
  96.         print "</html>"
  97.  
  98.  
  99. ## Calling all the functions of the class template with object (objx)
  100. objx=HtmlTemplate()
  101. objx.Header()
  102. objx.Body()
  103. objx.Form()
  104. objx.Footer()
  105. objx.CloseHtml()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement