Skip to content

Commit

Permalink
Rewrite patch for more safety
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens authored and hexylena committed Jan 31, 2024
1 parent 701b506 commit 57aca48
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions apollo/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,25 @@ def _yieldGeneData(gene, disable_cds_recalculation=False, use_name=False):

if 'children' in current and gene.type == 'gene':
# Only sending mRNA level as apollo is more comfortable with orphan mRNAs
for child1 in current['children']:
exon_regions = []
for child1 in current['children']:
for child in child1['children']:
print(child)
if child['type']['name'] == 'exon':
exon_regions.append(__floc(child['location']))
new_current_children = []
for child in child1['children']:
if child['type']['name'] == 'CDS':
continue
nnn = __floc(child['location'])
if nnn not in exon_regions:
new_current_children.append(child)
for mRNA in current['children']:
new_mRNA_children = []
new_cds = None
for feature in mRNA['children']:
if feature['type']['name'] == 'CDS':
if new_cds:
new_cds_start = new_cds['location']['fmin']
new_cds_end = new_cds['location']['fmax']
this_cds_start = feature['location']['fmin']
this_cds_end = feature['location']['fmax']
new_cds['location']['fmin'] = min(new_cds_start, this_cds_start)
new_cds['location']['fmax'] = max(new_cds_end, this_cds_end)
else:
new_cds = feature
else:
new_current_children.append(child)
child1['children'] = new_current_children
print(exon_regions)
new_mRNA_children.append(feature)
if new_cds:
mRNA['children'] = new_mRNA_children
mRNA['children'].append(new_cds)

return current['children']
else:
Expand Down

0 comments on commit 57aca48

Please sign in to comment.