From 5c7e600e66fdc6e23470f24e6f5795a18204f329 Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Fri, 5 May 2023 08:20:33 +0200
Subject: [PATCH] WrappedTMAlign bugfix: RNA needs custom secondary structure
 assignment

---
 modules/bindings/src/wrap_tmalign.cc | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/bindings/src/wrap_tmalign.cc b/modules/bindings/src/wrap_tmalign.cc
index 8c05e0228..18eb4ad88 100644
--- a/modules/bindings/src/wrap_tmalign.cc
+++ b/modules/bindings/src/wrap_tmalign.cc
@@ -72,8 +72,13 @@ TMAlignResult WrappedTMAlign(const geom::Vec3List& pos_one,
     seqy[i] = seq2[i];
   }
 
-  make_sec(xa, xlen, secx);
-  make_sec(ya, ylen, secy);
+  if(rna) {
+    make_sec(seqx, xa, xlen, secx, " C3'");
+    make_sec(seqy, ya, ylen, secy, " C3'");
+  } else {
+    make_sec(xa, xlen, secx);
+    make_sec(ya, ylen, secy);
+  }
 
   // these variables are chosen such that running TMalign_main is the same as 
   // you would call the executable without any additional parameters
@@ -154,7 +159,7 @@ void ExtractChainInfo(const ost::mol::ChainView& chain, geom::Vec3List& pos,
       if(rna_mode) {
         std::stringstream ss;
         ss << "Error in WrappedTMAlign: Chains cannot have peptide and RNA ";
-        ss << "residues. Problematic chain: "<<chain.GetName();
+        ss << "residues in same chain. Problematic chain: "<<chain.GetName();
         throw ost::Error(ss.str());
       }
       olcs.push_back(olc);
@@ -168,7 +173,7 @@ void ExtractChainInfo(const ost::mol::ChainView& chain, geom::Vec3List& pos,
       if(rna_mode==false && !pos.empty()) {
         std::stringstream ss;
         ss << "Error in WrappedTMAlign: Chains cannot have peptide and RNA ";
-        ss << "residues. Problematic chain: "<<chain.GetName();
+        ss << "residues in same chain. Problematic chain: "<<chain.GetName();
         throw ost::Error(ss.str());
       }
       rna_mode = true;
-- 
GitLab