Skip to content

Commit

Permalink
Unknown residue names
Browse files Browse the repository at this point in the history
  • Loading branch information
sguionni committed Jun 6, 2024
1 parent d1562aa commit e81d914
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 6 deletions.
37 changes: 34 additions & 3 deletions lib/app/src/app/component/chemistry/residue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,41 @@ namespace VTX::App::Component::Chemistry

const std::string & Residue::getShortName() const
{
return ChemDB::Residue::SYMBOL_SHORT_STR[ int( getSymbol() ) ];
ChemDB::Residue::SYMBOL symbol = getSymbol();
if ( symbol == ChemDB::Residue::SYMBOL::UNKNOWN )
{
return _moleculePtr->_moleculeStruct.residueUnknownNames[ _index ];
}
else
{
return ChemDB::Residue::SYMBOL_SHORT_STR[ int( symbol ) ];
}
}
const std::string & Residue::getName() const
{
ChemDB::Residue::SYMBOL symbol = getSymbol();
if ( symbol == ChemDB::Residue::SYMBOL::UNKNOWN )
{
return _moleculePtr->_moleculeStruct.residueUnknownNames[ _index ];
}
else
{
return ChemDB::Residue::SYMBOL_STR[ int( symbol ) ];
}
}

const std::string & Residue::getLongName() const
{
ChemDB::Residue::SYMBOL symbol = getSymbol();
if ( symbol == ChemDB::Residue::SYMBOL::UNKNOWN )
{
return _moleculePtr->_moleculeStruct.residueUnknownNames[ _index ];
}
else
{
return ChemDB::Residue::SYMBOL_NAME[ int( symbol ) ];
}
}
const std::string & Residue::getName() const { return ChemDB::Residue::SYMBOL_STR[ int( getSymbol() ) ]; }
const std::string & Residue::getLongName() const { return ChemDB::Residue::SYMBOL_NAME[ int( getSymbol() ) ]; }

ChemDB::Atom::TYPE Residue::getAtomType() const
{
Expand Down
1 change: 1 addition & 0 deletions lib/core/include/core/struct/molecule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace VTX::Core::Struct
std::vector<size_t> residueBondCounts;
std::vector<size_t> residueOriginalIds;
std::vector<ChemDB::SecondaryStructure::TYPE> residueSecondaryStructureTypes;
std::vector<std::string> residueUnknownNames;

void initResidues( const size_t p_count );
size_t getResidueCount() const;
Expand Down
2 changes: 2 additions & 0 deletions lib/core/src/core/chemdb/residue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace VTX::Core::ChemDB::Residue

return symbol.value_or( SYMBOL::UNKNOWN );
}

const SYMBOL getSymbolFromLongName( const std::string & p_residueName )
{
std::string formattedName = std::string( p_residueName.begin(), p_residueName.end() );
Expand All @@ -51,6 +52,7 @@ namespace VTX::Core::ChemDB::Residue

return SYMBOL::UNKNOWN;
}

const SYMBOL getSymbolFromAnyName( const std::string & p_residueName )
{
const size_t residueNameSize = p_residueName.size();
Expand Down
1 change: 1 addition & 0 deletions lib/core/src/core/struct/molecule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace VTX::Core::Struct
residueBondCounts.resize( p_count, 0 );
residueOriginalIds.resize( p_count, 0 );
residueSecondaryStructureTypes.resize( p_count, ChemDB::SecondaryStructure::TYPE::UNKNOWN );
residueUnknownNames.resize( p_count );
}
size_t Molecule::getResidueCount() const { return residueSymbols.size(); }

Expand Down
7 changes: 6 additions & 1 deletion lib/io/src/io/reader/molecule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#include <core/chemdb/secondary_structure.hpp>
#include <core/struct/molecule.hpp>
#include <core/struct/trajectory.hpp>
#include <util/enum.hpp>
#include <map>
#include <util/chrono.hpp>
#include <util/constants.hpp>
#include <util/enum.hpp>
#include <util/logger.hpp>

namespace VTX::IO::Reader
Expand Down Expand Up @@ -100,6 +100,7 @@ namespace VTX::IO::Reader

const ChemDB::Residue::SYMBOL residueSymbol = VTX::Core::ChemDB::Residue::getSymbolFromName( residueName );

// TODO: delete?
// int symbolValue;

// if ( residueSymbol == ChemDB::Residue::SYMBOL::UNKNOWN )
Expand Down Expand Up @@ -129,6 +130,10 @@ namespace VTX::IO::Reader
//}

p_molecule.residueSymbols[ residueIdx ] = residueSymbol;
if ( residueSymbol == ChemDB::Residue::SYMBOL::UNKNOWN )
{
p_molecule.residueUnknownNames[ residueIdx ] = residueName;
}

const std::string secondaryStructure
= p_chemfileStruct.getCurrentResidueStringProperty( "secondary_structure" );
Expand Down
2 changes: 0 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include <vector>

#ifdef _WIN32
// #include <Windows.h>

extern "C"
{
__declspec( dllexport ) uint32_t NvOptimusEnablement = 0x00000001;
Expand Down

0 comments on commit e81d914

Please sign in to comment.