From c0a4dd1dde9ca09787823bc06c7efd6fda643758 Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Tue, 10 May 2022 15:39:40 +0200
Subject: [PATCH] enable nucleotide as query prop =>
 prot.Select("nucleotide=true")

---
 modules/mol/base/doc/query.rst      | 3 +++
 modules/mol/base/src/property_id.cc | 5 ++++-
 modules/mol/base/src/property_id.hh | 6 +++---
 modules/mol/base/src/query_state.cc | 4 ++++
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/modules/mol/base/doc/query.rst b/modules/mol/base/doc/query.rst
index 16e9a3a02..99c2392fe 100644
--- a/modules/mol/base/doc/query.rst
+++ b/modules/mol/base/doc/query.rst
@@ -219,6 +219,9 @@ This index is the same for views and handles.
 **peptide** (bool): Whether the residue is :attr:`peptide linking
 <ResidueHandle.peptide_linking>`.
 
+**nucleotide** (bool): Whether the residue is :attr:`nucleotide linking
+<ResidueHandle.nucleotide_linking>`.
+
 **protein** (bool): Whether the residue is considered to be
 :attr:`part of a connected protein <ResidueHandle.is_protein>`.
 
diff --git a/modules/mol/base/src/property_id.cc b/modules/mol/base/src/property_id.cc
index 467227294..ad2f90333 100644
--- a/modules/mol/base/src/property_id.cc
+++ b/modules/mol/base/src/property_id.cc
@@ -50,6 +50,7 @@ struct Properties : public boost::spirit::symbols<Prop> {
       ("abfac", Prop(Prop::ABFAC, Prop::FLOAT, Prop::ATOM))
       ("rbfac", Prop(Prop::RBFAC, Prop::FLOAT, Prop::RESIDUE))
       ("peptide", Prop(Prop::PEPTIDE, Prop::INT, Prop::RESIDUE))
+      ("nucleotide", Prop(Prop::NUCLEOTIDE, Prop::INT, Prop::RESIDUE))
       ("rindex", Prop(Prop::RINDEX, Prop::INT, Prop::RESIDUE))
       ("protein", Prop(Prop::PROTEIN, Prop::INT, Prop::RESIDUE))
       ("ligand", Prop(Prop::LIGAND, Prop::INT, Prop::RESIDUE))
@@ -111,7 +112,9 @@ String Prop::GetName() const
     case ABFAC:
       return "abfac";
     case PEPTIDE:
-      return "peptide";      
+      return "peptide";
+    case NUCLEOTIDE:
+      return "nucleotide";
     case ACHARGE:
       return "acharge";
     case RINDEX:
diff --git a/modules/mol/base/src/property_id.hh b/modules/mol/base/src/property_id.hh
index 7fec20853..a3b24ac42 100644
--- a/modules/mol/base/src/property_id.hh
+++ b/modules/mol/base/src/property_id.hh
@@ -39,9 +39,9 @@ public:
   /// the GenericProp 'propname' at the atom, residue and chain level
   /// respectively.
   typedef enum {
-    RNAME, ANAME, CNAME, ELE, RNUM, ANUM, AX, AY, AZ, OCC, AINDEX, RTYPE, ISHETATM,
-    RBFAC, ABFAC, PEPTIDE, ACHARGE, RINDEX, PROTEIN, LIGAND, WATER, WITHIN, 
-    UNDEF, CUSTOM
+    RNAME, ANAME, CNAME, ELE, RNUM, ANUM, AX, AY, AZ, OCC, AINDEX, RTYPE,
+    ISHETATM, RBFAC, ABFAC, PEPTIDE, NUCLEOTIDE, ACHARGE, RINDEX, PROTEIN,
+    LIGAND, WATER, WITHIN, UNDEF, CUSTOM
   } ID;
   
   typedef enum {
diff --git a/modules/mol/base/src/query_state.cc b/modules/mol/base/src/query_state.cc
index 2b18845d3..40e09a53d 100644
--- a/modules/mol/base/src/query_state.cc
+++ b/modules/mol/base/src/query_state.cc
@@ -204,6 +204,10 @@ boost::logic::tribool QueryState::EvalResidue(const ResidueImplPtr& r) {
       case Prop::PEPTIDE:
         int_value=r->GetChemClass().IsPeptideLinking();
         s_[*i] = cmp_num<int>(ss.comp_op,int_value,boost::get<int>(ss.param));        
+        break; 
+      case Prop::NUCLEOTIDE:
+        int_value=r->GetChemClass().IsNucleotideLinking();
+        s_[*i] = cmp_num<int>(ss.comp_op,int_value,boost::get<int>(ss.param));        
         break;        
       case Prop::RBFAC:
         // This is ugly! Outcome is the same for a prefiltered view as it is for
-- 
GitLab