Skip to content

Commit

Permalink
consider mRNA feature types, fix for GFF3
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewprzh committed May 21, 2021
1 parent 70f2dc0 commit 47d3c0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/assignment_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def find_closests_tsts(self, read_assignment):

dists_to_gene_tss = []
dists_to_gene_tts = []
for t in gene_info.db.children(gene_info.db[gene_id], featuretype='transcript', order_by='start'):
for t in gene_info.db.children(gene_info.db[gene_id], featuretype=('transcript', 'mRNA'), order_by='start'):
dists_to_gene_tss.append(self.count_tss_dist(read_assignment, t.id))
dists_to_gene_tts.append(self.count_tts_dist(read_assignment, t.id))
dist_to_gene_tss = dists_to_gene_tss[argmin([abs(x) for x in dists_to_gene_tss])]
Expand Down
8 changes: 4 additions & 4 deletions src/gene_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@ def get_gene_regions(self):
def set_isoform_strands(self):
self.isoform_strands = {}
for gene_db in self.gene_db_list:
for t in self.db.children(gene_db, featuretype='transcript'):
for t in self.db.children(gene_db, featuretype=('transcript', 'mRNA')):
self.isoform_strands[t.id] = t.strand

# set isoform_id -> gene_id map
def set_gene_ids(self):
self.gene_id_map = {}
for gene_db in self.gene_db_list:
for t in self.db.children(gene_db, featuretype='transcript'):
for t in self.db.children(gene_db, featuretype=('transcript', 'mRNA')):
self.gene_id_map[t.id] = gene_db.id

# assigns an ordered list of all known exons and introns to self.exons and self.introns
Expand All @@ -233,7 +233,7 @@ def set_introns_and_exons(self):
all_isoforms_exons = {}

for gene_db in self.gene_db_list:
for t in self.db.children(gene_db, featuretype='transcript', order_by='start'):
for t in self.db.children(gene_db, featuretype=('transcript', 'mRNA'), order_by='start'):
all_isoforms_exons[t.id] = []
for e in self.db.children(t, order_by='start'):
if e.featuretype == 'exon':
Expand Down Expand Up @@ -370,7 +370,7 @@ def split_exons(self, exons):
# calculate junction profiles for known isoforms
def set_junction_profiles(self, all_isoforms_introns, all_isoforms_exons):
for gene_db in self.gene_db_list:
for t in self.db.children(gene_db, featuretype='transcript', order_by='start'):
for t in self.db.children(gene_db, featuretype=('transcript', 'mRNA'), order_by='start'):
transcript_region = self.transcript_region(t.id)
# setting up intron profiles for current isoform
self.intron_profiles.set_profiles(t.id, all_isoforms_introns[t.id], transcript_region,
Expand Down

0 comments on commit 47d3c0e

Please sign in to comment.