From 4cd66d6750eae7e6b8f435039988d9f35dd2d7d4 Mon Sep 17 00:00:00 2001 From: Matt Shirley Date: Thu, 19 Oct 2023 22:19:45 -0400 Subject: [PATCH] Ignore genes with no transcript models --- pisces/index.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pisces/index.py b/pisces/index.py index 2af4db0..69a5cf3 100755 --- a/pisces/index.py +++ b/pisces/index.py @@ -336,7 +336,9 @@ def features_to_string(features, fasta_in, masked=True, strand=True): logging.info("No gene name tag found for %s", gene['gene_id'][0]) gene_name = 'NA' - transcripts = db.children(gene, featuretype='transcript', order_by='start') + transcripts = tuple(db.children(gene, featuretype='transcript', order_by='start')) + if len(transcripts) == 0: # gene that has no transcripts + continue # gene will have no transcript sequence or exons for transcript in transcripts: # Write entry in the transcripts to genes table gene2tx.write("{txp}\t{gene}\n".format( @@ -371,10 +373,6 @@ def features_to_string(features, fasta_in, masked=True, strand=True): length=sum(len(exon) for exon in merged_exons), frac_masked=str(frac_masked))) - transcripts = db.children( - gene, - featuretype='transcript', - order_by='start') pbar.update(1) if options["intergenes"]: