From 4053afe344924e7151f064cdaf49571af2ee8ac4 Mon Sep 17 00:00:00 2001
From: Jakob Rien <jakobj.rien@stud.unibas.ch>
Date: Mon, 16 Jan 2023 07:31:22 +0000
Subject: [PATCH] Replace find_representative_transcripts.py

---
 scripts/find_representative_transcripts.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/find_representative_transcripts.py b/scripts/find_representative_transcripts.py
index f378f31..ee0dbc6 100644
--- a/scripts/find_representative_transcripts.py
+++ b/scripts/find_representative_transcripts.py
@@ -191,10 +191,13 @@ def gtf_file_writer (original_file, output_file):
                     if type_ == 'gene':
                         gene_id = find_in_attributs(attributes, 'gene_id')
                         output.append(entry)
-                    if type_ != 'gene':
+                    else:
                         transcript_id = find_in_attributs(attributes, 'transcript_id')
-                        if rep_transcript_dict[gene_id] == transcript_id:
-                            output.append(entry)
+                        try:
+                            if rep_transcript_dict[gene_id] == transcript_id:
+                                output.append(entry)
+                        except:
+                            print("error")
 
     with open(output_file, 'w') as last_file:
         last_file.write(output)
-- 
GitLab