Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions include/BALL/KERNEL/residue.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,14 @@ namespace BALL
NO_VARIANT_EXTENSIONS,
/// Add the residue variant extensions (e.g. '-C' for C-terminal residues)
ADD_VARIANT_EXTENSIONS,
// Add the residue ID separated by a colon
ADD_RESIDUE_ID,
// Add the residue ID and the residue extension
ADD_VARIANT_EXTENSIONS_AND_ID
/// Add the residue ID, expected to be numeric, directly following the residue name
ADD_RESIDUE_ID,
/// Add the residue ID right after the residue extension (if available) or the name (otherwise).
ADD_VARIANT_EXTENSIONS_AND_ID,
/// After the residue ID show the insertion code
ADD_RESIDUE_ID_AND_INSERTION_CODE,
/// All: show the residue name with its optional extension, then the ID with its optional insertion code and the residue extension
ADD_VARIANT_EXTENSIONS_AND_ID_AND_INSERTION_CODE
};

//@}
Expand Down
5 changes: 5 additions & 0 deletions source/KERNEL/residue.C
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,11 @@ namespace BALL
{
full_name += String(getID());
}
if (BALL_RESIDUE_DEFAULT_INSERTION_CODE != insertion_code_ &&
(type == ADD_RESIDUE_ID_AND_INSERTION_CODE || type == ADD_VARIANT_EXTENSIONS_AND_ID_AND_INSERTION_CODE))
{
full_name += String(getInsertionCode());
}

return full_name;
}
Expand Down
15 changes: 11 additions & 4 deletions source/PYTHON/EXTENSIONS/BALL/residue.sip
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ class Residue
PROPERTY__CYCLIC,
NUMBER_OF_PROPERTIES
};
// following the definition of FullNameType in BALL/KERNEL/residue.h
enum FullNameType
{
NO_VARIANT_EXTENSIONS,
ADD_VARIANT_EXTENSIONS
ADD_VARIANT_EXTENSIONS,
ADD_RESIDUE_ID,
ADD_VARIANT_EXTENSIONS_AND_ID,
ADD_RESIDUE_ID_AND_INSERTION_CODE,
ADD_VARIANT_EXTENSIONS_AND_ID_AND_INSERTION_CODE
};
Residue();
Residue(const Residue&, bool deep = true);
Expand All @@ -41,7 +46,7 @@ class Residue
// Residue& operator = (const Residue& residue);
void get(Residue&, bool deep = true) const;
void swap(Residue&);
String getFullName(FullNameType type = ADD_VARIANT_EXTENSIONS) const;
String getFullName(FullNameType type = ADD_VARIANT_EXTENSIONS_AND_ID_AND_INSERTION_CODE) const;
bool hasTorsionPhi() const;
Angle getTorsionPhi() const;
bool hasTorsionPsi() const;
Expand Down Expand Up @@ -86,7 +91,9 @@ class Residue

SIP_PYOBJECT __str__();
%MethodCode
sipRes = PyString_FromString(String(String("Residue ") + sipCpp->getName() + sipCpp->getID()
+ " { " + String(sipCpp->countAtoms()) + " atoms }").c_str());
sipRes = PyString_FromString(String(
String("Residue ")
+ sipCpp->getFullName()
+ " { " + String(sipCpp->countAtoms()) + " atoms }").c_str());
%End
};