Skip to content

Commit

Permalink
small refactor / cleanup of old code in get_features
Browse files Browse the repository at this point in the history
  • Loading branch information
gpratt committed Sep 24, 2014
1 parent a9bde44 commit 8cec45e
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions clipper/src/get_genomic_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,33 +356,27 @@ def get_feature_locations(self, limit_genes=False, flush_cashe=False):

except ValueError:
pass

five_prime_ends = []
three_prime_ends = []
poly_a_sites = []
stop_codons = []
start_codons = []
transcription_start_sites = []

for i, gene_id in enumerate(self._db.features_of_type('gene')):
if i % 2000 == 0:
print "processed %d genes" % (i)
if i == 2000 and limit_genes:
break

gene = { "five_prime_ends" : [],
"three_prime_ends" : [],
"poly_a_sites" : [],
"stop_codons" : [],
"start_codons" : [],
"transcription_start_sites" : []}
gene = { "five_prime_ends": [],
"three_prime_ends": [],
"poly_a_sites": [],
"stop_codons": [],
"start_codons": [],
"transcription_start_sites": []}
try:
for exon in self._db.children(gene_id, featuretype='exon'):
exon_start = copy.deepcopy(exon)
exon_start.start = exon.start + 1

exon_stop = copy.deepcopy(exon)
exon_stop.start = exon_stop.stop
exon_stop.stop = exon_stop.stop + 1
exon_stop.stop += 1

if exon.strand == "-":
exon_start, exon_stop = exon_stop, exon_start
Expand All @@ -397,7 +391,7 @@ def get_feature_locations(self, limit_genes=False, flush_cashe=False):

transcript_stop = copy.deepcopy(transcript)
transcript_stop.start = transcript_stop.stop
transcript_stop.stop = transcript_stop.stop + 1
transcript_stop.stop += 1

if transcript.strand == "-":
transcript_start, transcript_stop = transcript_stop, transcript_start
Expand Down

0 comments on commit 8cec45e

Please sign in to comment.