From 38b8eff4900e9bb7336fb2ede99dc26f98f45f00 Mon Sep 17 00:00:00 2001
From: Martijn Vermaat <martijn@vermaat.name>
Date: Sun, 27 Sep 2015 18:12:40 +0200
Subject: [PATCH] Fix bug in transcript-protein link query

---
 mutalyzer/db/queries.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/mutalyzer/db/queries.py b/mutalyzer/db/queries.py
index ab4e814e..d457b60c 100644
--- a/mutalyzer/db/queries.py
+++ b/mutalyzer/db/queries.py
@@ -87,17 +87,13 @@ def get_transcript_protein_link(accession, reverse=False):
         # Lookup by protein accession instead of transcript accession.
         query_column, other_column = other_column, query_column
 
-    return TranscriptProteinLink.query \
-        .filter_by(transcript_accession=accession) \
-        .filter(
-            query_column == accession,
-            or_(
-                and_(other_column.isnot(None),
-                     TranscriptProteinLink.added >= link_datetime),
-                and_(other_column.is_(None),
-                     TranscriptProteinLink.added >= negative_link_datetime))
-        ) \
-        .first()
+    return TranscriptProteinLink.query.filter(
+        query_column == accession,
+        or_(and_(other_column.isnot(None),
+                 TranscriptProteinLink.added >= link_datetime),
+            and_(other_column.is_(None),
+                 TranscriptProteinLink.added >= negative_link_datetime))
+    ).first()
 
 
 def update_transcript_protein_link(transcript_accession=None,
-- 
GitLab