Created
January 28, 2016 22:50
-
-
Save ecwheele/823e725120833be26635 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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