Advertisement
Guest User

fasta alignment

a guest
Jun 1st, 2010
526
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.24 KB | None | 0 0
  1. #!c:/Python26/python.exe
  2.  
  3. import cgi
  4. import os
  5. import cgitb; cgitb.enable()
  6. print 'Content-type: text/html\n\n'
  7. from index import HtmlTemplate
  8.  
  9. t = HtmlTemplate()
  10. t.Header()
  11. t.Body()
  12.  
  13.  
  14. form=cgi.FieldStorage()
  15. a=(form["dfile"].filename)
  16. (name,ext) = os.path.splitext(a)
  17. import sys, subprocess
  18. from Bio import AlignIO
  19. from Bio import SeqIO
  20. from Bio.Align.Applications import ClustalwCommandline
  21. cline = ClustalwCommandline("clustalw", infile=a, seqnos="ON")
  22. child = subprocess.call(str(cline), shell=(sys.platform!="win32"))
  23. alignfile=name+'.aln'
  24. alignment =AlignIO.read(alignfile, "clustal")
  25. print "<b><u> Result Analysis</u></b></br>"
  26. print "Input file name : "+a
  27. print "<br>"
  28. print "Total Number of Records: %i" % len(alignment)
  29. handle=open(alignfile,'rU')
  30. for seql in SeqIO.parse(handle, "clustal"):
  31.     seq_length = len(seql.seq)
  32. print "<br>"
  33. print "Total number of Sequences: %i" % seq_length
  34. print "<br>"
  35.  
  36.  
  37. print "<b><u> Alignment Result</u></b></br>"
  38. print "<pre>"
  39. f = open(alignfile)
  40. for line in f.readlines():
  41.     print line
  42. print "</pre>"
  43. print "</br>"
  44.  
  45. print "<b><u> Guide Tree Result</u></b></br>"
  46. print "<pre>"
  47. f = open(name + '.dnd')
  48. for line in f.readlines():
  49.     print line
  50. print "</pre>"
  51.  
  52. t.Footer()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement