From f8aefb8283986d1d02be9ad6cf3e10a9c2b3dc8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A1t=C3=A9=20Balajti?= <mate.balajti@unibas.ch>
Date: Mon, 4 Sep 2023 16:50:44 +0200
Subject: [PATCH] refactor: update main.py with TSL support

---
 setup.py    |  2 +-
 tsg/main.py | 13 ++++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/setup.py b/setup.py
index 7ebb48d..638df50 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@ URL = ('https://git.scicore.unibas.ch/zavolan_group/'
 
 setup(
     name='transcript-structure-generator',
-    version='0.1.0',
+    version='0.2.0',
     url=URL,
     license='MIT',
     author='Larissa Glass, Michael Zimmermann, Andri Fraenkl',
diff --git a/tsg/main.py b/tsg/main.py
index c86c741..8307b79 100644
--- a/tsg/main.py
+++ b/tsg/main.py
@@ -55,7 +55,7 @@ def filter_df(gtf_df: pd.DataFrame, transcripts: list) -> pd.DataFrame:
         transcripts = []
     df_filter = gtf_df[
         (gtf_df["feature"] == "exon")
-        & (gtf_df["free_text"].str.contains('transcript_support_level "1"'))
+        & (gtf_df["free_text"].str.contains('transcript_support_level "1'))
     ]
     if len(transcripts) > 0:
         df_filter = df_filter[df_filter["free_text"].str.contains(
@@ -316,16 +316,15 @@ class TranscriptGenerator:
         strands = transcript_df["strand"].unique()
         if len(transcript_df) == 0:
             LOG.warning(
-                "Transcript %s can't be sampled. \
-                    Annotation is missing", transcript_id
+                "Transcript %s can't be sampled. "
+                "Annotation is missing or TSL is not 1.", transcript_id
             )
             instance = None
         elif len(strands) > 1:
             LOG.warning(
-                "Transcript %s can't be sampled. Transcript generator \
-                    is not implemented for transcripts with \
-                        exons annotated on different strands",
-                transcript_id,
+                "Transcript %s can't be sampled. Transcript generator is "
+                "not implemented for transcripts with exons annotated on "
+                "different strands", transcript_id,
             )
             instance = None
         else:
-- 
GitLab