#!/usr/bin/python # Read GLAM2SCAN output: write an HTML version of it import fileinput version = '' commandline = '' alignments = [] state = 0 for line in fileinput.input(): if state == 0: if line.startswith('Version'): version = line elif line.find('glam2scan') != -1: commandline = line state += 1 elif state == 1: fields = line.split() if len(fields) == 6: alignments.append(fields) # print the HTML header: print '' print '' print 'GLAM2SCAN' print '' print '' print '' print '

GLAM2SCAN

' print '

', version, '

', commandline, '

' print '

If you use this program in your research, please cite: \ MC Frith, NFW Saunders, B Kobe, TL Bailey, "Discovering sequence motifs with arbitrary insertions and deletions", PLoS Computational Biology, 4(5):e1000071, 2008. \ \ [full text]

' print '' print '' print '' print '' print '' print '' print '' print '' print '' print '' for row in alignments: print '' print '' print '' print '' print '' print '' print '' print '' # close the HTML: print '' print '
NAMESTARTSITEENDSTRANDSCORE
', row[0], '', row[1], '', row[2], '', row[3], '', row[4], '', row[5], '
' print '' print ''