Skip to content

Commit

Permalink
Grab GTF tags from exons
Browse files Browse the repository at this point in the history
  • Loading branch information
mdshw5 committed Nov 17, 2021
1 parent 0218188 commit 14d0c22
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pisces/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,17 +297,17 @@ def features_to_string(features, fasta_in, masked=True, strand=True):
total=db.count_features_of_type('gene'),
unit='gene') as pbar:
for gene in db.features_of_type('gene'):
first_transcript = next(
first_exon = next(
db.children(
gene,
featuretype='transcript',
featuretype='exon',
order_by='start'))
try:
if options["gene_type"] == True:
type_tag = "gene_type"
else:
type_tag = options["gene_type"]
gene_type = first_transcript[type_tag][0]
gene_type = first_exon[type_tag][0]
except KeyError:
logging.info("No gene type tag found for %s", gene['gene_id'][0])
gene_type = 'NA'
Expand All @@ -316,7 +316,7 @@ def features_to_string(features, fasta_in, masked=True, strand=True):
name_tag = "gene_name"
else:
name_tag = options["gene_name"]
gene_name = first_transcript[name_tag][0]
gene_name = first_exon[name_tag][0]
except KeyError:
logging.info("No gene name tag found for %s", gene['gene_id'][0])
gene_name = 'NA'
Expand Down

0 comments on commit 14d0c22

Please sign in to comment.