# IPython log file from csv import DictReader reader = DictReader(open('pigeon.filtered_lite_classification.txt'),delimiter='\t') f = open('pigeon.for_subsampling.txt', 'w') f.write('pbid\tpbgene\tlength\trefisoform\trefgene\tcategory\tfl_count\n') for r in reader: f.write(r['isoform']+'\t') f.write(r['isoform'].split('.')[1]+'\t') f.write(r['length']+'\t') f.write(r['associated_transcript']+'\t') f.write(r['associated_gene']+'\t') f.write(r['structural_category']+'\t') f.write(r['fl_assoc']+'\n') f.close()