desc[ens]=lst[7] ucsc,tkname=sys.argv[1:] # dump fout=open(tkname,'w') fout2=open(tkname+'_load','w') id=1 with open(ucsc) as fin: for line in fin: lst=line.rstrip().split('\t') g=parseUcscgenestruct.parse(lst,True) name=lst[1] fout.write('{0}\t{1}\t{2}\tname:"{3}",id:{4},strand:"{5}",'.format( g['chrom'], g['start'], g['stop'], name, id, g['strand'])) id+=1 if 'thin' in g or 'thick' in g: fout.write('struct:{') if 'thin' in g: fout.write('thin:[') for x in g['thin']: fout.write('[{0},{1}],'.format(x[0],x[1]))
desc[lst[2]] = w desc[lst[3]] = w symbol[lst[2]] = lst[0] symbol[lst[3]] = lst[0] i += 1 print 'refLink: ' + str(i) # dump fout = open(tkname, 'w') fout2 = open(tkname + '_load', 'w') id = 1 with open(ucsc) as fin: for line in fin: lst = line.rstrip().split('\t') g = parseUcscgenestruct.parse(lst, True) name = lst[1] fout.write('{0}\t{1}\t{2}\tname:"{3}",id:{4},strand:"{5}",'.format( g['chrom'], g['start'], g['stop'], name, id, g['strand'])) id += 1 if 'thin' in g or 'thick' in g: fout.write('struct:{') if 'thin' in g: fout.write('thin:[') for x in g['thin']: fout.write('[{0},{1}],'.format(x[0], x[1])) fout.write('],') if 'thick' in g: fout.write('thick:[') for x in g['thick']: fout.write('[{0},{1}],'.format(x[0], x[1]))
# dump fout=open(tkname,'w') fout2=open(tkname+'_load','w') id=1 with open('wgEncodeGencodeAttrsV17.txt') as fin: for line in fin: lst=line.rstrip().split('\t') transcript=lst[4] if transcript not in genes: continue g=parseUcscgenestruct.parse(genes[transcript],True) fout.write('{0}\t{1}\t{2}\tname:"{3}",id:{4},strand:"{5}",'.format( g['chrom'], g['start'], g['stop'], lst[1] if len(lst[1])>0 else transcript, id, g['strand'])) id+=1 if 'thin' in g or 'thick' in g: fout.write('struct:{') if 'thin' in g: fout.write('thin:[') for x in g['thin']: fout.write('[{0},{1}],'.format(x[0],x[1])) fout.write('],')