#!/bin/env python import glob import os baseurl = 'bigDataUrl="http://cbi-asang-009.pmacs.upenn.edu/NGS/ucsc/trackhubs/ChIP-Seq/Pomerantz_2015_NatGenetics/' bwloc = '/BIGWIG/Aligned.sortedByCoord.out.bw"' colors = {'normal':'129,129,129','tumor':'253,33,3'} bwfile = {'normal': glob.glob('normal_*'), 'tumor':glob.glob('tumor_*')} fp=open('./ucsc_tracks_v1.txt','w') for _xx,_yy in bwfile.items(): for _yyy in _yy: desc = str(_yyy.split('/')[0]) _tempstr = 'track type=bigWig name="'+desc+'" description="'+desc+'" '+baseurl+_yyy+bwloc _tempstr += 'visibility="full" alwaysZero="off"' _tempstr += 'color="'+colors[_xx]+'"' _tempstr += 'autoScale="off" maxHeightPixels="25:20:10" db="hg19"' _tempstr += ' viewLimits=0:6 windowingFunction="maximum" smoothingWindow=3' fp.write(_tempstr+'\n') fp.close()