Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ecwheele/823e725120833be26635 to your computer and use it in GitHub Desktop.
Save ecwheele/823e725120833be26635 to your computer and use it in GitHub Desktop.
fout = open('/home/ecwheele/data/analysis/clip/region_annotations_basic/basic_first_exons.bed','w')
for transcript in v19_basic_db.features_of_type('transcript'):
reversers = transcript.strand == '-'
for i, exon in enumerate(v19_basic_db.children(transcript, featuretype="exon")):
if exon.strand == "+":
if exon.start == transcript.start:
line = '%s\t%s\t%s\t%s\t%s\t%s\n' % (exon.chrom,exon.start-1,exon.stop,exon.id,exon.score,exon.strand)
fout.write(line)
else:
continue
elif exon.strand == "-":
if exon.stop == transcript.stop:
line = '%s\t%s\t%s\t%s\t%s\t%s\n' % (exon.chrom,exon.start-1,exon.stop,exon.id,exon.score,exon.strand)
fout.write(line)
else:
continue
fout.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment